[lld] dc9ee39 - [lld-macho] Downgrade "cannot export hidden symbol" to warning
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 28 15:46:59 PDT 2021
Author: Jez Ng
Date: 2021-07-28T18:46:26-04:00
New Revision: dc9ee3925179c2de79cd2d1ffafc41e70249352c
URL: https://github.com/llvm/llvm-project/commit/dc9ee3925179c2de79cd2d1ffafc41e70249352c
DIFF: https://github.com/llvm/llvm-project/commit/dc9ee3925179c2de79cd2d1ffafc41e70249352c.diff
LOG: [lld-macho] Downgrade "cannot export hidden symbol" to warning
This matches ld64's behavior, and makes it easier to fit LLD
into existing build systems.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D107011
Added:
Modified:
lld/MachO/Driver.cpp
lld/test/MachO/export-options.s
Removed:
################################################################################
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index a8c11b6994b95..3098e6dac0d6c 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -1436,8 +1436,8 @@ bool macho::link(ArrayRef<const char *> argsArr, bool canExitEarly,
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;
diff --git a/lld/test/MachO/export-options.s b/lld/test/MachO/export-options.s
index 113a2c3fcd52e..30f05effad1b8 100644
--- a/lld/test/MachO/export-options.s
+++ b/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
More information about the llvm-commits
mailing list