[llvm] r245988 - [dsymutil] Reapply r245960.

Frederic Riss via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 16:15:26 PDT 2015


Author: friss
Date: Tue Aug 25 18:15:26 2015
New Revision: 245988

URL: http://llvm.org/viewvc/llvm-project?rev=245988&view=rev
Log:
[dsymutil] Reapply r245960.

There was an issue in the test setup because the test requires an arch that
wasn't filtered by the lit.local.cfg, but given the set of bots that failed,
I'm not confident this is the (only) issue. So this commit also adds more
output to the test to help me track down the failure if it happens again.

Original commit message:
[dsymutil] Rewrite thumb triple names in user visible messages.

We autodetect triples from the input file(s) while reading the mach-o debug map.
As we need to create a Target from those triples, we always chose the thumb
variant (because the arm variant might not be 'instantiable' eg armv7m). The
user visible architecture names should still be 'arm' and not 'thumb' variants
though.

Added:
    llvm/trunk/test/tools/dsymutil/ARM/fat-arch-name.test
Modified:
    llvm/trunk/test/tools/dsymutil/ARM/empty-map.test
    llvm/trunk/test/tools/dsymutil/ARM/lit.local.cfg
    llvm/trunk/tools/dsymutil/MachOUtils.cpp
    llvm/trunk/tools/dsymutil/MachOUtils.h
    llvm/trunk/tools/dsymutil/dsymutil.cpp

Modified: llvm/trunk/test/tools/dsymutil/ARM/empty-map.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/ARM/empty-map.test?rev=245988&r1=245987&r2=245988&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/ARM/empty-map.test (original)
+++ llvm/trunk/test/tools/dsymutil/ARM/empty-map.test Tue Aug 25 18:15:26 2015
@@ -5,4 +5,4 @@
 triple:          'thumbv7-apple-darwin'
 ...
 
-# CHECK: warning: no debug symbols in executable (-arch thumbv7)
+# CHECK: warning: no debug symbols in executable (-arch armv7)

Added: llvm/trunk/test/tools/dsymutil/ARM/fat-arch-name.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/ARM/fat-arch-name.test?rev=245988&view=auto
==============================================================================
--- llvm/trunk/test/tools/dsymutil/ARM/fat-arch-name.test (added)
+++ llvm/trunk/test/tools/dsymutil/ARM/fat-arch-name.test Tue Aug 25 18:15:26 2015
@@ -0,0 +1,22 @@
+# REQUIRES: object-emission
+# RUN: llvm-dsymutil %p/../Inputs/fat-test.arm.dylib -o %t1.dSYM -verbose
+# RUN: llvm-dsymutil %p/../Inputs/fat-test.arm.dylib -o %t.dSYM -verbose 2>&1 | FileCheck %s
+
+# We detect thumb triples from the binaries, because those are the only ones
+# that are guaranteed to be able to generate a Target instance (for example
+# we would detect armv7m-apple-darwin as non-thumb triple, but you can't
+# instantiate a Target from that). In the user-visible architecture names, and
+# in the lipo invocation, we need to rewrite the thumb arch names to the arm
+# ones.
+
+# CHECK: warning: no debug symbols in executable (-arch armv7)
+
+# CHECK: warning: no debug symbols in executable (-arch armv7s)
+
+# CHECK: warning: no debug symbols in executable (-arch arm64)
+
+# CHECK: Running lipo
+# CHECK-NEXT: lipo -create
+# CHECK-SAME: -segalign armv7
+# CHECK-SAME: -segalign armv7s
+# CHECK-SAME: -segalign arm64

Modified: llvm/trunk/test/tools/dsymutil/ARM/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/ARM/lit.local.cfg?rev=245988&r1=245987&r2=245988&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/ARM/lit.local.cfg (original)
+++ llvm/trunk/test/tools/dsymutil/ARM/lit.local.cfg Tue Aug 25 18:15:26 2015
@@ -1,2 +1,4 @@
 if not 'ARM' in config.root.targets:
     config.unsupported = True
+if not 'AArch64' in config.root.targets:
+    config.unsupported = True

Modified: llvm/trunk/tools/dsymutil/MachOUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/MachOUtils.cpp?rev=245988&r1=245987&r2=245988&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/MachOUtils.cpp (original)
+++ llvm/trunk/tools/dsymutil/MachOUtils.cpp Tue Aug 25 18:15:26 2015
@@ -17,6 +17,12 @@ namespace llvm {
 namespace dsymutil {
 namespace MachOUtils {
 
+std::string getArchName(StringRef Arch) {
+  if (Arch.startswith("thumb"))
+    return (llvm::Twine("arm") + Arch.drop_front(5)).str();
+  return Arch;
+}
+
 static bool runLipo(SmallVectorImpl<const char *> &Args) {
   auto Path = sys::findProgramByName("lipo");
 
@@ -64,6 +70,7 @@ bool generateUniversalBinary(SmallVector
 
   // Align segments to match dsymutil-classic alignment
   for (auto &Thin : ArchFiles) {
+    Thin.Arch = getArchName(Thin.Arch);
     Args.push_back("-segalign");
     Args.push_back(Thin.Arch.c_str());
     Args.push_back("20");

Modified: llvm/trunk/tools/dsymutil/MachOUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/MachOUtils.h?rev=245988&r1=245987&r2=245988&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/MachOUtils.h (original)
+++ llvm/trunk/tools/dsymutil/MachOUtils.h Tue Aug 25 18:15:26 2015
@@ -24,6 +24,8 @@ struct ArchAndFilename {
 
 bool generateUniversalBinary(SmallVectorImpl<ArchAndFilename> &ArchFiles,
                              StringRef OutputFileName, const LinkOptions &);
+
+std::string getArchName(StringRef Arch);
 }
 }
 }

Modified: llvm/trunk/tools/dsymutil/dsymutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.cpp?rev=245988&r1=245987&r2=245988&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/dsymutil.cpp (original)
+++ llvm/trunk/tools/dsymutil/dsymutil.cpp Tue Aug 25 18:15:26 2015
@@ -301,7 +301,8 @@ int main(int argc, char **argv) {
 
       if (Map->begin() == Map->end())
         llvm::errs() << "warning: no debug symbols in executable (-arch "
-                     << Map->getTriple().getArchName() << ")\n";
+                     << MachOUtils::getArchName(Map->getTriple().getArchName())
+                     << ")\n";
 
       std::string OutputFile = getOutputFileName(InputFile, NeedsTempFiles);
       if (OutputFile.empty() || !linkDwarf(OutputFile, *Map, Options))




More information about the llvm-commits mailing list