[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
Mon Jan 9 09:51:06 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG20894a478da2: [lld-macho] Prevent assertions for aliases to weak_def_can_be_hidden symbols (authored by paulkirth).

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.487488.patch
Type: text/x-patch
Size: 1039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230109/400d4e8c/attachment.bin>


More information about the llvm-commits mailing list