[PATCH] D107011: [lld-macho] Downgrade "cannot export hidden symbol" to warning
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 28 15:38:36 PDT 2021
int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This matches ld64's behavior, and makes it easier to fit LLD
into existing build systems.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D107011
Files:
lld/MachO/Driver.cpp
lld/test/MachO/export-options.s
Index: lld/test/MachO/export-options.s
===================================================================
--- lld/test/MachO/export-options.s
+++ lld/test/MachO/export-options.s
@@ -42,11 +42,17 @@
# EXPORT-DAG: g F __TEXT,__text _keep_lazy
## Check that exported symbol is global
-# RUN: not %lld -dylib %t/default.o -o /dev/null \
+# RUN: %no_fatal_warnings_lld -dylib %t/default.o -o %t/hidden-export \
# RUN: -exported_symbol _private_extern 2>&1 | \
# RUN: FileCheck --check-prefix=PRIVATE %s
-# PRIVATE: error: cannot export hidden symbol _private_extern
+# PRIVATE: warning: cannot export hidden symbol _private_extern
+
+## Check that we still hide the other symbols despite the warning
+# RUN: llvm-objdump --macho --exports-trie %t/hidden-export | \
+# RUN: FileCheck --check-prefix=EMPTY-TRIE %s
+# EMPTY-TRIE: Exports trie:
+# EMPTY-TRIE-EMPTY:
## Check that the export trie is unaltered
# RUN: %lld -dylib %t/default.o -o %t/default
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -1438,8 +1438,8 @@
StringRef symbolName = defined->getName();
if (config->exportedSymbols.match(symbolName)) {
if (defined->privateExtern) {
- error("cannot export hidden symbol " + symbolName +
- "\n>>> defined in " + toString(defined->getFile()));
+ warn("cannot export hidden symbol " + symbolName +
+ "\n>>> defined in " + toString(defined->getFile()));
}
} else {
defined->privateExtern = true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107011.362569.patch
Type: text/x-patch
Size: 1669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210728/5b2e4a1b/attachment.bin>
More information about the llvm-commits
mailing list