gcc.c
尝试回答(我从查看驱动程序源和 Makefile 环境的几分钟中收集到)。
这些路径是在运行时从以下位置构建的:
- GCC exec 前缀(参见GCC文档)
GCC_EXEC_PREFIX
- 环境
$LIBRARY_PATH
变量
- 环境变量(被
$LPATH
视为$LIBRARY_PATH
)
- 传递给
-B
命令行开关的任何值
- 标准可执行前缀(在编译时指定)
- 工具目录前缀
最后一个(tooldir前缀)通常定义为相对路径:From gcc'sMakefile.in
# Directory in which the compiler finds libraries etc.
libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version)
# Directory in which the compiler finds executables
libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version)
# Used to produce a relative $(gcc_tooldir) in gcc.o
unlibsubdir = ../../..
....
# These go as compilation flags, so they define the tooldir base prefix
# as ../../../../, and the one of the library search prefixes as ../../../
# These get PREFIX appended, and then machine for which gcc is built
# i.e i484-linux-gnu, to get something like:
# /usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../i486-linux-gnu/lib/../lib/
DRIVER_DEFINES = \
-DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \
-DTOOLDIR_BASE_PREFIX=\"$(unlibsubdir)/../\" \
但是,这些是针对特定于编译器版本的路径。您的示例可能会受到我上面列出的环境变量的影响(LIBRARY_PATH
, LPATH
)