Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference betwen --export-dynamic and --export-all-symbols?

After compiling on Cygwin with gcc or clang, ld complains about

/usr/bin/ld: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols?

Changing the linkerflag as suggested fixes this behavior, but I am not sure if this is correct. Therefore the question is simple:

What is the difference betwen --export-dynamic and --export-all-symbols?

like image 663
user69453 Avatar asked Jan 21 '26 05:01

user69453


1 Answers

--export-dynamic is for ELF targets:

Note that this option is specific to ELF targeted ports. PE targets support a similar function to export all symbols from a DLL or EXE; see the description of ‘--export-all-symbols’ below.

--export-all-symbols is for PE targets:

This option is specific to the i386 PE targeted port of the linker

It would probably have been possible to subsume both under --export-dynamic (because that was there first), but the implementation is completely different, and this leaked out to the ld command line interface.

like image 180
Florian Weimer Avatar answered Jan 23 '26 11:01

Florian Weimer