[PATCH] D126072: [lld-macho] Stop crash when emitting personalities with -dead_strip
Alex Brachet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 20 14:41:08 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG190b0f42cf55: [lld-macho] Stop crash when emitting personalities with -dead_strip (authored by abrachet).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126072/new/
https://reviews.llvm.org/D126072
Files:
lld/MachO/UnwindInfoSection.cpp
lld/test/MachO/weak-definition-gc.s
Index: lld/test/MachO/weak-definition-gc.s
===================================================================
--- lld/test/MachO/weak-definition-gc.s
+++ lld/test/MachO/weak-definition-gc.s
@@ -66,15 +66,19 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/weak-aligned-1.s -o %t/weak-aligned-1.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/weak-aligned-2.s -o %t/weak-aligned-2.o
# RUN: %lld -o %t/out -lSystem %t/weak-aligned-1.o %t/weak-aligned-2.o
-# RUN: llvm-objdump --syms --section=__const --full-contents %t/out | FileCheck --check-prefix=ALIGN %s
-# ALIGN: SYMBOL TABLE:
-# ALIGN-DAG: [[#%x, ADDR:]] l O __DATA_CONST,__const _weak1
-# ALIGN-DAG: {{0*}}[[#ADDR+ 0x4]] l O __DATA_CONST,__const _weak3
-# ALIGN-DAG: {{0*}}[[#ADDR+ 0x8]] l O __DATA_CONST,__const _weak2
-# ALIGN-DAG: {{0*}}[[#ADDR+0x10]] g O __DATA_CONST,__const _aligned
-# ALIGN: Contents of section __DATA_CONST,__const:
-# ALIGN-NEXT: {{0*}}[[#ADDR]] 11111111 33333333 22222222 00000000
-# ALIGN-NEXT: {{0*}}[[#ADDR+0x10]] 81818181 81818181 82828282 82828282
+# RUN: llvm-objdump --syms --section=__const --full-contents %t/out | FileCheck --check-prefixes=ALIGN,ALIGN2 %s
+# RUN: %lld -o %t/out -lSystem %t/weak-aligned-1.o %t/weak-aligned-2.o -dead_strip
+# RUN: llvm-objdump --syms --section=__const --full-contents %t/out | FileCheck --check-prefixes=ALIGN,ALIGN3 %s
+# ALIGN: SYMBOL TABLE:
+# ALIGN-DAG: [[#%x, ADDR:]] l O __DATA_CONST,__const _weak1
+# ALIGN2-DAG: {{0*}}[[#ADDR+ 0x4]] l O __DATA_CONST,__const _weak3
+# ALIGN3-DAG: {{0*}}[[#ADDR+ 0x4]] l O __DATA_CONST,__const _weak2
+# ALIGN2-DAG: {{0*}}[[#ADDR+ 0x8]] l O __DATA_CONST,__const _weak2
+# ALIGN-DAG: {{0*}}[[#ADDR+0x10]] g O __DATA_CONST,__const _aligned
+# ALIGN: Contents of section __DATA_CONST,__const:
+# ALIGN2-NEXT: {{0*}}[[#ADDR]] 11111111 33333333 22222222 00000000
+# ALIGN3-NEXT: {{0*}}[[#ADDR]] 11111111 22222222 00000000 00000000
+# ALIGN-NEXT: {{0*}}[[#ADDR+0x10]] 81818181 81818181 82828282 82828282
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/weak-def.s -o %t/weak-def.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/strong-def.s -o %t/strong-def.o
Index: lld/MachO/UnwindInfoSection.cpp
===================================================================
--- lld/MachO/UnwindInfoSection.cpp
+++ lld/MachO/UnwindInfoSection.cpp
@@ -309,6 +309,7 @@
/*includeInSymtab=*/true,
/*isThumb=*/false, /*isReferencedDynamically=*/false,
/*noDeadStrip=*/false);
+ s->used = true;
in.got->addEntry(s);
}
r.referent = s;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126072.431062.patch
Type: text/x-patch
Size: 2775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220520/e51cd17c/attachment.bin>
More information about the llvm-commits
mailing list