[clang] [Driver] Add support for -export-dynamic which can match GCC behavior. (PR #72781)

Eli Schwartz via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 30 11:32:05 PDT 2024


eli-schwartz wrote:

The `-export-dynamic` flag is supported by libtool, not gcc and not binutils ld. If passed to libtool, it will cause `$export_dynamic_flag_spec` as conditionally per-platform defined in a GNU autotools configure script to be evaluated and passed to the compiler:
- for gcc, this is `$wl--export-dynamic`
- for cygwin, this is `$wl--export-all-symbols`
- for interix, this is `$wl-E`
- for AIX, this is `$wl-bexpall`

Anyone passing libtool flags to gcc has incorrectly and erroneously ported their project away from libtool, or else cargo-culted flags that get misinterpreted. Simply do not do so, and do not patch new linkers to implement the libtool interface out of the mistaken belief that it is a linker interface.

(Or do implement libtool within clang, if you would like to. However if you do so, please do so intentionally, rather than accidentally.)

https://github.com/llvm/llvm-project/pull/72781


More information about the cfe-commits mailing list