[PATCH] D103350: [lld/mac] Don't crash on -order_file with assembly inputs on arm64
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 28 17:39:32 PDT 2021
thakis created this revision.
thakis added a reviewer: lld-macho.
Herald added a subscriber: kristof.beyls.
Herald added a reviewer: int3.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
thakis requested review of this revision.
.s files with `-g` generate __debug_aranges on darwin/arm64 for some
reason, and those lead to `nullptr` symbols. Don't crash on that.
Fixes PR50517.
https://reviews.llvm.org/D103350
Files:
lld/MachO/Writer.cpp
lld/test/MachO/order-file.s
Index: lld/test/MachO/order-file.s
===================================================================
--- lld/test/MachO/order-file.s
+++ lld/test/MachO/order-file.s
@@ -172,3 +172,7 @@
_main:
callq "-[Foo doFoo:andBar:]"
ret
+
+.section __DWARF,__debug_aranges,regular,debug
+ltmp1:
+ .byte 0
Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -748,7 +748,7 @@
for (const InputFile *file : inputFiles) {
if (isa<ObjFile>(file))
for (Symbol *sym : file->symbols)
- if (auto *d = dyn_cast<Defined>(sym))
+ if (auto *d = dyn_cast_or_null<Defined>(sym))
addSym(*d);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103350.348606.patch
Type: text/x-patch
Size: 718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210529/313cb8ff/attachment.bin>
More information about the llvm-commits
mailing list