Skip to content

Commit 83402c3

Browse files
authored
[dsymutil] Support generating dSYMs for firmware environments (llvm#87432)
Support generating dSYM companion files for (non-Darwin) firmware environments by considering the binary component of the triple in addition to the OS component. rdar://125629792
1 parent ed1cfff commit 83402c3

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
$ cat test.c
2+
int main() {
3+
return 0;
4+
}
5+
6+
$ xcrun clang -O0 -target arm64-apple-unknown-macho test.c -c -o test.o
7+
$ xcrun ld -arch arm64 -o test.out test.o -platform_version firmware 0 0
8+
9+
RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/firmware/test.out -o %t.dSYM
10+
RUN: llvm-objdump -h %t.dSYM/Contents/Resources/DWARF/test.out | FileCheck %s
11+
CHECK: file format mach-o arm64
Binary file not shown.
Binary file not shown.

llvm/tools/dsymutil/DwarfLinkerForBinary.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,9 @@ bool DwarfLinkerForBinary::linkImpl(
857857
return error(toString(std::move(E)));
858858
}
859859

860-
if (Map.getTriple().isOSDarwin() && !Map.getBinaryPath().empty() &&
860+
auto MapTriple = Map.getTriple();
861+
if ((MapTriple.isOSDarwin() || MapTriple.isOSBinFormatMachO()) &&
862+
!Map.getBinaryPath().empty() &&
861863
ObjectType == Linker::OutputFileType::Object)
862864
return MachOUtils::generateDsymCompanion(
863865
Options.VFS, Map, *Streamer->getAsmPrinter().OutStreamer, OutFile,

0 commit comments

Comments
 (0)