Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit c0fdf88

Browse files
committed
[dsymutil] Fix -arch option for thumb variants.
r267249 removed the dual ARM/Thumb interface from MachOObjectFile, simplifying llvm-dsymutil's code. This unfortunately also regressed llvm-dsymutil's ability to select thumb slices, because the simplified code was also dealing with the discrepency between the slice arch (eg. armv7m) and the triple arch name (eg. thumbv7m). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268894 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 3c29a69 commit c0fdf88

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

test/tools/dsymutil/ARM/thumb.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: llvm-dsymutil -f -oso-prepend-path=%p/.. %p/../Inputs/thumb.armv7m -o - | llvm-dwarfdump - | FileCheck %s
2+
// RUN: llvm-dsymutil -arch armv7m -f -oso-prepend-path=%p/.. %p/../Inputs/thumb.armv7m -o - | llvm-dwarfdump - | FileCheck %s
3+
4+
/* Compile with:
5+
clang -c thumb.c -arch armv7m -g
6+
clang thumb.o -o thumb.armv7m -arch armv7m -nostdlib -static -Wl,-e,_start
7+
*/
8+
9+
void start() {
10+
}
11+
12+
CHECK: DW_AT_name{{.*}}"thumb.c"
13+
CHECK: DW_AT_name{{.*}}"start"
4.19 KB
Binary file not shown.

test/tools/dsymutil/Inputs/thumb.o

1.2 KB
Binary file not shown.

tools/dsymutil/MachODebugMapParser.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,11 @@ static bool shouldLinkArch(SmallVectorImpl<StringRef> &Archs, StringRef Arch) {
294294
std::find(Archs.begin(), Archs.end(), "arm") != Archs.end())
295295
return true;
296296

297-
return std::find(Archs.begin(), Archs.end(), Arch) != Archs.end();
297+
SmallString<16> ArchName = Arch;
298+
if (Arch.startswith("thumb"))
299+
ArchName = ("arm" + Arch.substr(5)).str();
300+
301+
return std::find(Archs.begin(), Archs.end(), ArchName) != Archs.end();
298302
}
299303

300304
bool MachODebugMapParser::dumpStab() {

0 commit comments

Comments
 (0)