gcc doesn't know -rdynamic option From gcc-4.3.1 man page -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. From ld 2.18 man page --export-dynamic When creating a dynamically linked executable, add all symbols to the dynamic symbol table. The dynamic symbol table is the set of symbols which are visible from dynamic objects at run time. So I believe that gcc should know "-rdynamic" My fix was to add the following line to the #define LINK_SPEC in the file gcc-4.3.1/gcc/config/sol2.h at line 145: %{rdynamic:--export-dynamic} \ OS and tools SunOS solaris 5.11 snv_95 i86pc i386 i86pc Solaris gcc (GCC) 4.3.1 ld (GNU Binutils) 2.18
Note you can use Sun's ld with GCC so that patch is not always the correct one.
-rdynamic could be enabled by the --with-gnu-ld configure option.
Subject: Bug 37454 Author: sje Date: Fri Jan 8 21:54:37 2010 New Revision: 155745 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155745 Log: 2010-01-08 Steve Ellcey <sje@cup.hp.com> PR target/37454 * configure.ac: Modify -rdynamic check. * configure: Regenerate. Modified: trunk/gcc/ChangeLog trunk/gcc/configure trunk/gcc/configure.ac
Subject: Bug 37454 Author: sje Date: Sun Jan 10 20:23:08 2010 New Revision: 155792 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155792 Log: 2010-01-10 Steve Ellcey <sje@cup.hp.com> PR target/37454 * configure.ac: Save and restore LDFLAGS and LIBS * configure: Regenerate. Modified: trunk/gcc/ChangeLog trunk/gcc/configure trunk/gcc/configure.ac
Mine.
Fixed for 4.5.1, 4.6.0.
*** Bug 28845 has been marked as a duplicate of this bug. ***