On the availability of "--exclude-libs" like functionality in ld64
On the availability of "--exclude-libs" like functionality in ld64
- Subject: On the availability of "--exclude-libs" like functionality in ld64
- From: Francesco Pretto via Darwin-dev <email@hidden>
- Date: Mon, 21 Feb 2022 11:06:13 +0100
Hello,
I'm writing to darwin-dev since I was unable to find a more suitable
list discussing specific apple clang/ld64 topics, but please point me
out if this is not the right place for this topic and where I should
ask instead. When developing cross platform software and targeting
apple platforms, I noticed that the official apple linker (ld64)
apparently doesn't offer an equivalent functionality of the
"--exclude-libs" switch in gcc[1] and lld[2]. When creating a shared
library, the --exclude-libs switch allows to exclude exporting symbols
from a list of linked libraries, with the option to exclude all of
them with the "ALL" wildcard. This switch is very convenient when
building a complex project with a lot of static compiled 3rd party
dependencies. These dependencies may in fact contain a lot of
symbols intentionally marked with default visibility,
__attribute__((visibility("default"))), or the symbols are manually
exported through assembly code, even when the library is actually
compiled statically. In these cases, compiling the libraries enforcing
the -fvisibility=hidden compilation flag is not enough to prevent
these symbols from being exported when linking into the final
.so/.dylib, and patching source is necessary to avoid exporting
unnecessary symbols that can be erroneously bound by software in
the same process performing reckless dynamic symbols loading. The
--exclude-libs switch is very convenient as it basically allows to drop
all these symbols unconditionally from the linked libraries, not
requiring to patch 3rd party source.
Is the same functionality available in ld64 with a different
name/semantics? If not, do you plan to implement it in a future
release of ld64?
Kind regards,
Francesco
[1]
https://sourceware.org/binutils/docs/ld/Options.html#index-_002d_002dexclude_002dlibs
[2] https://reviews.llvm.org/D34422
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden