Skip to content

[dsymutil] Support generating dSYMs for firmware environments #87432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions llvm/test/tools/dsymutil/ARM/firmware.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$ cat test.c
int main() {
return 0;
}

$ xcrun clang -O0 -target arm64-apple-unknown-macho test.c -c -o test.o
$ xcrun ld -arch arm64 -o test.out test.o -platform_version firmware 0 0

RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/firmware/test.out -o %t.dSYM
RUN: llvm-objdump -h %t.dSYM/Contents/Resources/DWARF/test.out | FileCheck %s
CHECK: file format mach-o arm64
Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,9 @@ bool DwarfLinkerForBinary::linkImpl(
return error(toString(std::move(E)));
}

if (Map.getTriple().isOSDarwin() && !Map.getBinaryPath().empty() &&
auto MapTriple = Map.getTriple();
if ((MapTriple.isOSDarwin() || MapTriple.isOSBinFormatMachO()) &&
!Map.getBinaryPath().empty() &&
ObjectType == Linker::OutputFileType::Object)
return MachOUtils::generateDsymCompanion(
Options.VFS, Map, *Streamer->getAsmPrinter().OutStreamer, OutFile,
Expand Down