[llvm] r268894 - [dsymutil] Fix -arch option for thumb variants.

Frederic Riss via llvm-commits llvm-commits at lists.llvm.org
Sun May 8 23:01:13 PDT 2016


Author: friss
Date: Mon May  9 01:01:12 2016
New Revision: 268894

URL: http://llvm.org/viewvc/llvm-project?rev=268894&view=rev
Log:
[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).

Added:
    llvm/trunk/test/tools/dsymutil/ARM/thumb.c
    llvm/trunk/test/tools/dsymutil/Inputs/thumb.armv7m   (with props)
    llvm/trunk/test/tools/dsymutil/Inputs/thumb.o
Modified:
    llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp

Added: llvm/trunk/test/tools/dsymutil/ARM/thumb.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/ARM/thumb.c?rev=268894&view=auto
==============================================================================
--- llvm/trunk/test/tools/dsymutil/ARM/thumb.c (added)
+++ llvm/trunk/test/tools/dsymutil/ARM/thumb.c Mon May  9 01:01:12 2016
@@ -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"

Added: llvm/trunk/test/tools/dsymutil/Inputs/thumb.armv7m
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/thumb.armv7m?rev=268894&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/thumb.armv7m (added) and llvm/trunk/test/tools/dsymutil/Inputs/thumb.armv7m Mon May  9 01:01:12 2016 differ

Propchange: llvm/trunk/test/tools/dsymutil/Inputs/thumb.armv7m
------------------------------------------------------------------------------
    svn:executable = *

Added: llvm/trunk/test/tools/dsymutil/Inputs/thumb.o
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/thumb.o?rev=268894&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/thumb.o (added) and llvm/trunk/test/tools/dsymutil/Inputs/thumb.o Mon May  9 01:01:12 2016 differ

Modified: llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp?rev=268894&r1=268893&r2=268894&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp (original)
+++ llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp Mon May  9 01:01:12 2016
@@ -294,7 +294,11 @@ static bool shouldLinkArch(SmallVectorIm
       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() {




More information about the llvm-commits mailing list