summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-04-09 09:09:59 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-04-09 09:09:59 +0000
commit79766820a3ba2e792593ee89d26225bf686f7440 (patch)
tree7f5ea26df3768286567c515e1ef6a56d113cc1a3
parent889bf9fe007c0915d8860bbc3ec877692792dd45 (diff)
downloadbcm5719-llvm-79766820a3ba2e792593ee89d26225bf686f7440.tar.gz
bcm5719-llvm-79766820a3ba2e792593ee89d26225bf686f7440.zip
[dsymutil] Don't try to load Swift ASTs as objects.
With the threading refactoring, loading of object files happens before checking whether we're dealing with a swift AST. While that's not an issue per se, it causes a warning to be printed: warning: /path/to/a.swiftmodule: The file was not recognized as a valid object file note: while processing /path/to/a.swiftmodule This suppresses the warning by checking for a Swift AST before attempting to load is as an object file. rdar://39240444 llvm-svn: 329553
-rw-r--r--llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test1
-rw-r--r--llvm/tools/dsymutil/DwarfLinker.cpp5
2 files changed, 6 insertions, 0 deletions
diff --git a/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test b/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
index 95f8e4aa3bf..e124a9d5b4d 100644
--- a/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
+++ b/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
@@ -9,6 +9,7 @@ Compiled with:
ld swift-ast.o -add_ast_path Inputs/swift-ast.swiftmodule -arch x86_64 -lSystem -macosx_version_min 10.9.0
DSYMUTIL: filename:{{.*}}swift-ast.swiftmodule
+DSYMUTIL-NOT: The file was not recognized as a valid object file
DSYMUTIL: DEBUG MAP OBJECT:{{.*}}swift-ast.swiftmodule
READOBJ: Name:{{.*}}__swift_ast
diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp
index 42f65049f3b..d3a6a15268c 100644
--- a/llvm/tools/dsymutil/DwarfLinker.cpp
+++ b/llvm/tools/dsymutil/DwarfLinker.cpp
@@ -1562,6 +1562,11 @@ private:
LinkContext(const DebugMap &Map, DwarfLinker &Linker, DebugMapObject &DMO,
bool Verbose = false)
: DMO(DMO), BinHolder(Verbose), RelocMgr(Linker) {
+ // Swift ASTs are not object files.
+ if (DMO.getType() == MachO::N_AST) {
+ ObjectFile = nullptr;
+ return;
+ }
auto ErrOrObj = Linker.loadObject(BinHolder, DMO, Map);
ObjectFile = ErrOrObj ? &*ErrOrObj : nullptr;
DwarfContext = ObjectFile ? DWARFContext::create(*ObjectFile) : nullptr;
OpenPOWER on IntegriCloud