summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/test/tools/dsymutil/ARM/empty-map.test2
-rw-r--r--llvm/test/tools/dsymutil/ARM/fat-arch-name.test21
-rw-r--r--llvm/tools/dsymutil/MachOUtils.cpp7
-rw-r--r--llvm/tools/dsymutil/MachOUtils.h2
-rw-r--r--llvm/tools/dsymutil/dsymutil.cpp3
5 files changed, 33 insertions, 2 deletions
diff --git a/llvm/test/tools/dsymutil/ARM/empty-map.test b/llvm/test/tools/dsymutil/ARM/empty-map.test
index 4cc0e5f67b5..54d9a35cc6e 100644
--- a/llvm/test/tools/dsymutil/ARM/empty-map.test
+++ b/llvm/test/tools/dsymutil/ARM/empty-map.test
@@ -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)
diff --git a/llvm/test/tools/dsymutil/ARM/fat-arch-name.test b/llvm/test/tools/dsymutil/ARM/fat-arch-name.test
new file mode 100644
index 00000000000..a8b7ca92c58
--- /dev/null
+++ b/llvm/test/tools/dsymutil/ARM/fat-arch-name.test
@@ -0,0 +1,21 @@
+# REQUIRES: object-emission
+# 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
diff --git a/llvm/tools/dsymutil/MachOUtils.cpp b/llvm/tools/dsymutil/MachOUtils.cpp
index 15605fe00eb..8f4d2610b8f 100644
--- a/llvm/tools/dsymutil/MachOUtils.cpp
+++ b/llvm/tools/dsymutil/MachOUtils.cpp
@@ -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(SmallVectorImpl<ArchAndFilename> &ArchFiles,
// 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");
diff --git a/llvm/tools/dsymutil/MachOUtils.h b/llvm/tools/dsymutil/MachOUtils.h
index f1b2ad9dadd..d6b6f3d61c3 100644
--- a/llvm/tools/dsymutil/MachOUtils.h
+++ b/llvm/tools/dsymutil/MachOUtils.h
@@ -24,6 +24,8 @@ struct ArchAndFilename {
bool generateUniversalBinary(SmallVectorImpl<ArchAndFilename> &ArchFiles,
StringRef OutputFileName, const LinkOptions &);
+
+std::string getArchName(StringRef Arch);
}
}
}
diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp
index 3d9851eca7e..9e112ba0727 100644
--- a/llvm/tools/dsymutil/dsymutil.cpp
+++ b/llvm/tools/dsymutil/dsymutil.cpp
@@ -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))
OpenPOWER on IntegriCloud