On the availability of "--exclude-libs" like functionality in ld64
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=FL+o6+MsdKOl36ferKevCL0BVl7jtsFs0JDHTw2JDaw=; b=EwvENVuC3+ylu6fGSqAVz564mJi4I0hgp7oM4W2ZhVyJq3qQb2EXQ6BdtxbVOAp5f4 RSScTwZWK5YfFlVCI651MXXs7IQn91FRXQ+8qsiJ8TwDhL4gNtpdWzqIA6uzpyMl0clB xz9nkqWboMccRAMvgBZYUDq47/eXUFIH3nSXNOhqSiPIt3pby9PAoG8z9hluo7gusO6n 1t3q6tSVkn3xrM5e1IovGCIa9P5nR8LzNvxwdQdkeCJXcYvGNuc825uB5hdYefdLueS/ KUJpRRJAGyBMnlfPlHGA+wQxpGFd8IGZ9HjUA6uwCgG/5RSBwxYmT0ud31QPf0c73xEE kpBQ== 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... [2] https://reviews.llvm.org/D34422 _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.app... This email sent to site_archiver@lists.apple.com
participants (1)
-
Francesco Pretto via Darwin-dev