unrecognized command line option ‘-rdynamic’ on GCC v4.9.2

女生的网名这么多〃 提交于 2019-11-30 16:07:23

I think I've got it...

Here's what happens on my laptop (Cygwin 2.831 x86 on W7 x64):

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-cygwin/4.8.2/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2/configure --srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --disable-__cxa_atexit --with-dwarf2 --with-arch=i686 --with-tune=generic --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libjava --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib
Thread model: posix
gcc version 4.8.2 (GCC)

When I pass -rdynamic:

gcc -rdynamic
gcc: fatal error: no input files
compilation terminated.

Compared to -rdynamic1:

gcc -rdynamic1
gcc: error: unrecognized command line option ‘-rdynamic1’
gcc: fatal error: no input files
compilation terminated.

The man page of my gcc mentions it (I'm not sure how relevant is that), but gcc -v --help doesn't display it under the linker specific options. I thought that maybe something is different about how the gccs are configured but I didn't see any difference that would matter (both have --with-gnu-ld - which seems related - specified).

Then I downloaded 4.8.2 and 4.9.2 sources and start searching and comparing but again I couldn't find anything (it's true the search could be widely extended :) ).

But while browsing the configure file I noticed something that could be related, then I checked the ld command line options and I think I have an alternative:

Instead of -rdynamic you could pass -Wl,--export-all-symbols. That works for me (that's not very relevant since -rdynamic also works for me, unlike in your case :))

The link you give says:

-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.

(Emphasis added.)

Is Cygwin using ELF format object files? It seems unlikely.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!