我用gcc
的Solaris 10
构建make
程序,并获得以下信息:
gcc: unrecognized option `-rdynamic'
在检查了文档中的rdynamic之后gcc
,我得到以下提示:
-rdynamic
Pass the flag -export-dynamic to the ELF linker, on targets that support it. This instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. This option is needed for some uses of dlopen or to allow obtaining backtraces from within a program.
我的问题是:
(1)尽管gcc
打印“ gcc: unrecognized option -rdynamic
”,但构建仍然成功。这是默认行为gcc
吗?
(2)在Makefile-rdynamic
中用“ -export-dynamic
”替换“ ”,构建成功。这种替代有副作用吗?
PS我的gcc
信息:
bash-3.00# gcc -v
Reading specs from /usr/local/lib/gcc/i386-pc-solaris2.10/3.4.6/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --enable-shared --enable-languages=c,c++,f77
Thread model: posix
gcc version 3.4.6
您使用的是gcc的过时版本,但您参考的是最新文档。gcc-3.4.6没有此类链接器选项,请参阅https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Link-Options.html。
-Wl,--export-dynamic
链接时尝试使用选项。
我在Makefile中替换
-rdynamic
为-export-dynamic
,构建成功。这种替代有副作用吗?
该选项没有文档说明,它可能什么也不做,您需要检查strace
输出将哪些命令行选项传递给链接器。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句