--export-dynamic 和 --export-all-symbols 之间有什么区别?

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

使用 gcc 或 clang 在 Cygwin 上编译后,ld 抱怨

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

按照建议更改 linkerflag 可以修复此行为,但我不确定这是否正确。所以问题很简单:

--export-dynamic--export-all-symbols有什么区别?

--export-dynamic 用于 ELF 目标:

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 用于 PE 目标:

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

可能可以将两者都包含在 --export-dynamic 下(因为那是第一个),但实现方式完全不同,这会泄露到 ld 命令行界面。