]> granicus.if.org Git - llvm/commitdiff
[dsymutil] Fix -arch option for thumb variants.
authorFrederic Riss <friss@apple.com>
Mon, 9 May 2016 06:01:12 +0000 (06:01 +0000)
committerFrederic Riss <friss@apple.com>
Mon, 9 May 2016 06:01:12 +0000 (06:01 +0000)
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

test/tools/dsymutil/ARM/thumb.c [new file with mode: 0644]
test/tools/dsymutil/Inputs/thumb.armv7m [new file with mode: 0755]
test/tools/dsymutil/Inputs/thumb.o [new file with mode: 0644]
tools/dsymutil/MachODebugMapParser.cpp

diff --git a/test/tools/dsymutil/ARM/thumb.c b/test/tools/dsymutil/ARM/thumb.c
new file mode 100644 (file)
index 0000000..4589653
--- /dev/null
@@ -0,0 +1,13 @@
+// RUN: llvm-dsymutil -f -oso-prepend-path=%p/.. %p/../Inputs/thumb.armv7m -o - | llvm-dwarfdump - | FileCheck %s
+// RUN: llvm-dsymutil -arch armv7m -f -oso-prepend-path=%p/.. %p/../Inputs/thumb.armv7m -o - | llvm-dwarfdump - | FileCheck %s
+
+/* Compile with:
+   clang -c thumb.c -arch armv7m -g
+   clang thumb.o -o thumb.armv7m -arch armv7m -nostdlib -static -Wl,-e,_start
+*/
+
+void start() {
+}
+
+CHECK: DW_AT_name{{.*}}"thumb.c"
+CHECK: DW_AT_name{{.*}}"start"
diff --git a/test/tools/dsymutil/Inputs/thumb.armv7m b/test/tools/dsymutil/Inputs/thumb.armv7m
new file mode 100755 (executable)
index 0000000..785ab99
Binary files /dev/null and b/test/tools/dsymutil/Inputs/thumb.armv7m differ
diff --git a/test/tools/dsymutil/Inputs/thumb.o b/test/tools/dsymutil/Inputs/thumb.o
new file mode 100644 (file)
index 0000000..8bac2a1
Binary files /dev/null and b/test/tools/dsymutil/Inputs/thumb.o differ
index 476ac80fba2913084cfc12d6ad838f6284f64b41..22215200ed5f611adfd50c6f8a2322fa3dc4d1a6 100644 (file)
@@ -294,7 +294,11 @@ static bool shouldLinkArch(SmallVectorImpl<StringRef> &Archs, StringRef Arch) {
       std::find(Archs.begin(), Archs.end(), "arm") != Archs.end())
     return true;
 
-  return std::find(Archs.begin(), Archs.end(), Arch) != Archs.end();
+  SmallString<16> ArchName = Arch;
+  if (Arch.startswith("thumb"))
+    ArchName = ("arm" + Arch.substr(5)).str();
+
+  return std::find(Archs.begin(), Archs.end(), ArchName) != Archs.end();
 }
 
 bool MachODebugMapParser::dumpStab() {