gcc 如何查找子程序 subprogram, collect2 如何查找 ld nm
来源:互联网 发布:日本paymo支付软件 编辑:程序博客网 时间:2024/06/05 02:41
GCC 如何查找子程序
For each subprogram to be run
1. the compiler driver first tries the -B prefix, if any.
2. If that name is not found, or if -B is not specified, the driver tries two standard prefixes, /usr/lib/gcc/ and /usr/local/lib/gcc/.
3. If neither of those results in a file name that is found, the unmodified program name is searched for using the directories specified in your PATH environment variable.
Collect2 如何查找 ld nm
The program collect2
is installed as ld
in the directory where the passes of the compiler are installed. When collect2
needs to find the real ld
, it tries the following file names:
- a hard coded linker file name, if GCC was configured with the --with-ld option.
- real-ld in the directories listed in the compiler's search directories.
- real-ld in the directories listed in the environment variable
PATH
. - The file specified in the
REAL_LD_FILE_NAME
configuration macro, if specified. - ld in the compiler's search directories, except that
collect2
will not execute itself recursively. - ld in
PATH
.
“The compiler's search directories” means all the directories where gcc searches for passes of the compiler. This includes directories that you specify with -B.
Cross-compilers search a little differently:
- real-ld in the compiler's search directories.
- target-real-ld in
PATH
. - The file specified in the
REAL_LD_FILE_NAME
configuration macro, if specified. - ld in the compiler's search directories.
- target-ld in
PATH
.
collect2
explicitly avoids running ld
using the file name under which collect2
itself was invoked. In fact, it remembers up a list of such names—in case one copy of collect2
finds another copy (or version) of collect2
installed as ld
in a second place in the search path.
collect2
searches for the utilities nm
and strip
using the same algorithm as above for ld
.
-B
prefixThe compiler driver program runs one or more of the subprograms cpp, cc1, as and ld. It tries prefix as a prefix for each program it tries to run, both with and without ‘machine/version/’ (see Target Options).
For each subprogram to be run, the compiler driver first tries the -B prefix, if any. If that name is not found, or if -B is not specified, the driver tries two standard prefixes, /usr/lib/gcc/ and /usr/local/lib/gcc/. If neither of those results in a file name that is found, the unmodified program name is searched for using the directories specified in your PATH environment variable.
The compiler checks to see if the path provided by the -B refers to a directory, and if necessary it adds a directory separator character at the end of the path.
-B prefixes that effectively specify directory names also apply to libraries in the linker, because the compiler translates these options into -L options for the linker. They also apply to include files in the preprocessor, because the compiler translates these options into -isystem options for the preprocessor. In this case, the compiler appends ‘include’ to the prefix.
The runtime support file libgcc.a can also be searched for using the -B prefix, if needed. If it is not found there, the two standard prefixes above are tried, and that is all. The file is left out of the link if it is not found by those means.
Another way to specify a prefix much like the -B prefix is to use the environment variable GCC_EXEC_PREFIX. See Environment Variables.
As a special kludge, if the path provided by -B is [dir/]stageN/, where N is a number in the range 0 to 9, then it is replaced by [dir/]include. This is to help with boot-strapping the compiler.
- gcc 如何查找子程序 subprogram, collect2 如何查找 ld nm
- gcc: collect2 cannot find 'ld'
- 如何查找源代码
- 如何查找期刊论文
- 如何查找增强
- 如何查找bug
- Linux gcc编译error:"collect2: ld returned 1 exit status"
- unbuntu运行gcc出现collect2: fatal error: cannot find 'ld'
- collect2和ld区别
- collect2和ld区别
- Collect2 LD -L
- 如何查找重复记录
- 如何查找文章全文链接
- 如何查找 JAVA 内存溢出
- 如何查找SQL注入点
- 如何查找局域网中的故障
- 如何查找jsp运行错误
- 如何查找、安装设备驱动...
- java String类
- javascript内存管理和垃圾回收
- java编码(四)编码错误例子
- 让JAVA窗口居中的方法
- GridView匯出Excel(NPOI篇)[1]
- gcc 如何查找子程序 subprogram, collect2 如何查找 ld nm
- AccessType.PROPERTY和AccessType.FIELD的区别
- Kinect for Windows SDK开发入门(二):基础知识 上
- Redis命令总结
- linux 添加新用户并赋予sudo执行权限
- IOS7毛玻璃效果
- QT获得目下的所有文件名
- 三维建模的相关网站或者博客参考集锦
- verilog中wire与reg类型的区别