[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:47:06 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdc9ee3925179: [lld-macho] Downgrade "cannot export hidden symbol" to warning (authored by int3).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107011/new/

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
@@ -1436,8 +1436,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.362572.patch
Type: text/x-patch
Size: 1669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210728/f8d15085/attachment.bin>


More information about the llvm-commits mailing list