如何更改GCC的crti.o默认搜索目录? [英] How do I change GCC's default search directory for crti.o?

查看:82
本文介绍了如何更改GCC的crti.o默认搜索目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为 startfile 指定GCC的搜索目录,并 endfile : crt1.o crti.o crtn.o .在命令行上将 -B 传递给GCC驱动程序可以工作,但是不方便.如何修改规格文件( lib/gcc/x86_64-unknown-linux-gnu/4.9.2/specs )指定 startfile ?

I'd like to specify GCC's search directory for the startfile and endfile: crt1.o, crti.o and crtn.o. Passing -B on the command line to the GCC driver works, but is inconvenient. How do I modify the specs file (lib/gcc/x86_64-unknown-linux-gnu/4.9.2/specs) to specify the search path for startfile?

我尝试在 startfile 规范中添加 -B 选项,但出现错误: ld:无法识别的选项'-B/gsc/btl/linuxbrew/lib'

I tried adding the -B option to the startfile spec and got the error: ld: unrecognized option '-B/gsc/btl/linuxbrew/lib'

然后我尝试将 -B 选项添加到 cc1 规范中,并得到错误消息: cc1:错误:命令行选项'-B/gsc/btl/linuxbrew/lib'有效对于驱动程序,但不适用于C

I then tried adding the -B option to the cc1 spec and got the error: cc1: error: command line option '-B/gsc/btl/linuxbrew/lib' is valid for the driver but not for C

如果无法通过 specs 文件执行此操作,那么GCC是否有可以实现相同目标的环境变量或configure选项?

If it's not possible to do this via the specs file, is there an environment variable or a configure option to GCC that accomplishes the same goal?

我在主目录中安装了最新版本的 glibc .一切都很好.我已经修改了 specs 文件以链接到 glibc 的新版本,但是它仍然链接到/usr 中的旧系统版本. startfile endfile .

I've installed a recent version of glibc in my home directory. Everything's working great. I've modified the specs file to link against the new version of glibc, but it's still linking against the old system version in /usr of startfile and endfile.

以下是未解决的问题code> gcc-help 邮件列表.这是一个与Linuxbrew有关的错误, gfortran已被独立的Linuxbrew破坏,并提出了修复建议, gcc,binutils:链接到Cellar而不是系统库.

Here's a the unanswered question on the gcc-help mailing list. Here's a related Linuxbrew bug, gfortran is broken with stand alone Linuxbrew, and a proposed fix, gcc, binutils: link to Cellar instead of system libs.

谢谢,
肖恩

推荐答案

您可以在规范的 * startfile: * endfile:部分中使用绝对路径文件,而不是默认的相对路径.这将覆盖GCC选择的默认位置.

You can use an absolute path in the *startfile: and *endfile: sections in the specs file, instead of the default relative paths. This will override GCC's choice of the default location.

这篇关于如何更改GCC的crti.o默认搜索目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆