Bug 37454

Summary: gcc: unrecognized option '-rdynamic'
Product: gcc Reporter: Yevgeniy <YLitvinenko>
Component: targetAssignee: Rainer Orth <ro>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, pawel_sikora
Priority: P3 Keywords: patch
Version: 4.3.1   
Target Milestone: 4.5.1   
URL: http://gcc.gnu.org/ml/gcc-patches/2010-03/msg01458.html
Host: Target: ix86-sun-solaris
Build: Known to work: 4.5.1 4.6.0
Known to fail: Last reconfirmed: 2010-04-28 20:32:15

Description Yevgeniy 2008-09-10 06:44:47 UTC
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
Comment 1 Andrew Pinski 2008-09-14 04:43:45 UTC
Note you can use Sun's ld with GCC so that patch is not always the correct one.
Comment 2 Pawel Sikora 2008-09-14 07:06:03 UTC
-rdynamic could be enabled by the --with-gnu-ld configure option.
Comment 3 Steve Ellcey 2010-01-08 21:55:06 UTC
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

Comment 4 Steve Ellcey 2010-01-10 20:23:22 UTC
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

Comment 5 Rainer Orth 2010-04-28 20:32:15 UTC
Mine.
Comment 6 Rainer Orth 2010-04-28 20:34:25 UTC
Fixed for 4.5.1, 4.6.0.
Comment 7 Pawel Sikora 2010-04-28 20:51:49 UTC
*** Bug 28845 has been marked as a duplicate of this bug. ***