public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* --export-dynamic question
@ 2004-08-31 11:54 Toon Knapen
  2004-08-31 12:07 ` Paul Brook
  2004-08-31 12:09 ` Andreas Schwab
  0 siblings, 2 replies; 3+ messages in thread
From: Toon Knapen @ 2004-08-31 11:54 UTC (permalink / raw)
  To: binutils

I would suspect the symbols defined in the static libraries that I link 
into my executable to appear in the final exe when the --export-dynamic 
option is passed on the command-line. However my findings proove 
otherwise (using redhat 8, ld version 2.13.90.02)

Using following files:

<begin foo.cpp>
int foo()
{ return 99 ; }
<end foo.cpp>

<begin main.cpp>
int main()
{ return 0 ; }
<end main.cpp>

I do:

gcc -c foo.cpp
gcc -c main.cpp
ld main.o foo.o

If I now 'nm a.out', I clearly see the function 'foo' in my a.out.

Now I first put the foo.o object-file into a library and then link the 
library into the exe like so:

ar ru libfoo.a foo.o
ld main.o libfoo.a

Now the function foo does not appear anymore when I 'nm a.out' (as 
expected since it is dead code)

Now however I link a.out using following command-line:

ld --export-dynamic main.o libfoo.a

And the funtion foo does not appear either (although I would expect the 
export-dynamic flag to prevent the dead-code elimination) ?

Thanks in advance,

Toon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-08-31 12:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-31 11:54 --export-dynamic question Toon Knapen
2004-08-31 12:07 ` Paul Brook
2004-08-31 12:09 ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).