[PATCH] D141082: [lld-macho] Prevent assertions for aliases to weak_def_can_be_hidden symbols

Paul Kirth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 13:57:32 PST 2023


paulkirth updated this revision to Diff 486985.
paulkirth retitled this revision from "[lld] Prevent assertions for aliases to weak_def_can_be_hidden symbols" to "[lld-macho] Prevent assertions for aliases to weak_def_can_be_hidden symbols".
paulkirth edited the summary of this revision.
paulkirth added a comment.

Address comments

- remove assert
- update comment in test file


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141082

Files:
  lld/MachO/InputFiles.cpp
  lld/test/MachO/weak-def-can-be-hidden.s


Index: lld/test/MachO/weak-def-can-be-hidden.s
===================================================================
--- lld/test/MachO/weak-def-can-be-hidden.s
+++ lld/test/MachO/weak-def-can-be-hidden.s
@@ -116,6 +116,10 @@
 _foo:
   retq
 
+# An alias is the only way to set .weak_def_can_be_hidden on an already-hidden symbol.
+# Veryify that LLD can handle these double-hidden symbols gracefully.
+.set l_foo, _foo
+
 #--- weak-foo-pe.s
 .private_extern _foo
 .globl _foo
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -698,8 +698,6 @@
         sym.n_desc & REFERENCED_DYNAMICALLY, sym.n_desc & N_NO_DEAD_STRIP,
         isWeakDefCanBeHidden);
   }
-  assert(!isWeakDefCanBeHidden &&
-         "weak_def_can_be_hidden on already-hidden symbol?");
   bool includeInSymtab = !isPrivateLabel(name) && !isEhFrameSection(isec);
   return make<Defined>(
       name, isec->getFile(), isec, value, size, sym.n_desc & N_WEAK_DEF,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141082.486985.patch
Type: text/x-patch
Size: 1039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230106/ecfcacbd/attachment.bin>


More information about the llvm-commits mailing list