summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/include/lld/Driver/DarwinInputGraph.h4
-rw-r--r--lld/include/lld/Driver/GnuLdInputGraph.h5
-rw-r--r--lld/include/lld/Driver/InputGraph.h3
-rw-r--r--lld/include/lld/Driver/WinLinkInputGraph.h5
-rw-r--r--lld/lib/Driver/InputGraph.cpp7
5 files changed, 18 insertions, 6 deletions
diff --git a/lld/include/lld/Driver/DarwinInputGraph.h b/lld/include/lld/Driver/DarwinInputGraph.h
index 76845c129c1..9b0b1ba0d93 100644
--- a/lld/include/lld/Driver/DarwinInputGraph.h
+++ b/lld/include/lld/Driver/DarwinInputGraph.h
@@ -42,7 +42,9 @@ public:
/// \brief Parse the input file to lld::File.
llvm::error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) {
- if (error_code ec = readFile(ctx, diagnostics))
+ // Read the file to _buffer.
+ bool isYaml = false;
+ if (error_code ec = readFile(ctx, diagnostics, isYaml))
return ec;
(void) (_isWholeArchive);
return llvm::error_code::success();
diff --git a/lld/include/lld/Driver/GnuLdInputGraph.h b/lld/include/lld/Driver/GnuLdInputGraph.h
index e2b78916bb4..af0e66e6bbc 100644
--- a/lld/include/lld/Driver/GnuLdInputGraph.h
+++ b/lld/include/lld/Driver/GnuLdInputGraph.h
@@ -73,8 +73,11 @@ public:
/// \brief Parse the input file to lld::File.
llvm::error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) {
// Read the file to _buffer.
- if (error_code ec = readFile(ctx, diagnostics))
+ bool isYaml = false;
+ if (error_code ec = readFile(ctx, diagnostics, isYaml))
return ec;
+ if (isYaml)
+ return error_code::success();
// Identify File type
llvm::sys::fs::file_magic FileType =
diff --git a/lld/include/lld/Driver/InputGraph.h b/lld/include/lld/Driver/InputGraph.h
index 6d4bcb3e57d..c5c4b7e3fab 100644
--- a/lld/include/lld/Driver/InputGraph.h
+++ b/lld/include/lld/Driver/InputGraph.h
@@ -309,7 +309,8 @@ public:
protected:
/// \brief Read the file into _buffer.
- error_code readFile(const LinkingContext &ctx, raw_ostream &diagnostics);
+ error_code readFile(const LinkingContext &ctx, raw_ostream &diagnostics,
+ bool &isYaml);
StringRef _path; // The path of the Input file
InputGraph::FileVectorT _files; // A vector of lld File objects
diff --git a/lld/include/lld/Driver/WinLinkInputGraph.h b/lld/include/lld/Driver/WinLinkInputGraph.h
index 9cfafa571dc..c0eb035b468 100644
--- a/lld/include/lld/Driver/WinLinkInputGraph.h
+++ b/lld/include/lld/Driver/WinLinkInputGraph.h
@@ -40,8 +40,11 @@ public:
/// \brief Parse the input file to lld::File.
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) {
// Read the file to _buffer.
- if (error_code ec = readFile(ctx, diagnostics))
+ bool isYaml = false;
+ if (error_code ec = readFile(ctx, diagnostics, isYaml))
return ec;
+ if (isYaml)
+ return error_code::success();
llvm::sys::fs::file_magic FileType =
llvm::sys::fs::identify_magic(_buffer->getBuffer());
diff --git a/lld/lib/Driver/InputGraph.cpp b/lld/lib/Driver/InputGraph.cpp
index 7b43c1d3b3c..27636641b15 100644
--- a/lld/lib/Driver/InputGraph.cpp
+++ b/lld/lib/Driver/InputGraph.cpp
@@ -99,7 +99,8 @@ FileNode::FileNode(StringRef path, int64_t ordinal)
/// \brief Read the file into _buffer.
error_code
-FileNode::readFile(const LinkingContext &ctx, raw_ostream &diagnostics) {
+FileNode::readFile(const LinkingContext &ctx, raw_ostream &diagnostics,
+ bool &isYaml) {
ErrorOr<StringRef> filePath = getPath(ctx);
if (!filePath &&
error_code(filePath) == llvm::errc::no_such_file_or_directory)
@@ -119,9 +120,11 @@ FileNode::readFile(const LinkingContext &ctx, raw_ostream &diagnostics) {
// YAML file is identified by a .objtxt extension
// FIXME : Identify YAML files by using a magic
- if (filePath->endswith(".objtxt"))
+ if (filePath->endswith(".objtxt")) {
if (error_code ec = ctx.getYAMLReader().parseFile(_buffer, _files))
return ec;
+ isYaml = true;
+ }
return error_code::success();
}
OpenPOWER on IntegriCloud