Update to the LLVM 4.0 release branch

This commit is contained in:
Martin Storsjö authored and Martin Storsjo committed 2017-04-03 14:42:55 +03:00
1 parent 423f5a656a
commit 2504fdbd88
21 files changed
+89 -2129

No files matched your search

+27 -27
View File
@@ -1,7 +1,7 @@
From 808dcadd650fd54174a0c033547a6668bf77e4f1 Mon Sep 17 00:00:00 2001
From d2b8d30134e620ec5d36be0765e52c7bf9bc57d6 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Wed, 28 Oct 2015 19:32:16 +0000
Subject: [PATCH 1/5] add support for gnu arguments in lld coff
Subject: [PATCH 1/2] add support for gnu arguments in lld coff
---
COFF/Driver.cpp | 31 ++++++++++++++++++++++++++++++-
@@ -12,10 +12,10 @@ Subject: [PATCH 1/5] add support for gnu arguments in lld coff
5 files changed, 75 insertions(+), 2 deletions(-)
diff --git a/COFF/Driver.cpp b/COFF/Driver.cpp
index bb6a60e..0821591 100644
index 4dabd9e..4992296 100644
--- a/COFF/Driver.cpp
+++ b/COFF/Driver.cpp
@@ -125,6 +125,7 @@ void LinkerDriver::parseDirectives(StringRef S) {
@@ -232,6 +232,7 @@ void LinkerDriver::parseDirectives(StringRef S) {
case OPT_fastfail:
case OPT_guardsym:
case OPT_throwingnew:
@@ -23,7 +23,7 @@ index bb6a60e..0821591 100644
break;
default:
fatal(Arg->getSpelling() + " is not allowed in .drectve");
@@ -153,6 +154,31 @@ StringRef LinkerDriver::doFindFile(StringRef Filename) {
@@ -260,6 +261,31 @@ StringRef LinkerDriver::doFindFile(StringRef Filename) {
return Filename;
}
@@ -45,7 +45,7 @@ index bb6a60e..0821591 100644
+ SmallString<128> Path = Dir;
+ llvm::sys::path::append(Path, Name.c_str());
+ if (llvm::sys::fs::exists(Path.str()))
+ return Alloc.save(Path.str());
+ return Saver.save(Path.str());
+ }
+ }
+ fatal("Unable to find library -l" + Filename);
@@ -55,17 +55,17 @@ index bb6a60e..0821591 100644
// Resolves a file path. This never returns the same path
// (in that case, it returns None).
Optional<StringRef> LinkerDriver::findFile(StringRef Filename) {
@@ -452,6 +478,9 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
// for /defaultlib option.
std::vector<StringRef> Paths;
std::vector<MemoryBufferRef> MBs;
@@ -667,6 +693,9 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
for (auto *Arg : Args.filtered(OPT_defaultlib))
if (Optional<StringRef> Path = findLib(Arg->getValue()))
enqueuePath(*Path);
+ for (auto *Arg : Args.filtered(OPT_l))
+ if (Optional<StringRef> Path = searchLibrary(Arg->getValue()))
+ Paths.push_back(*Path);
for (auto *Arg : Args.filtered(OPT_INPUT))
if (Optional<StringRef> Path = findFile(Arg->getValue()))
Paths.push_back(*Path);
@@ -573,7 +602,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
+ enqueuePath(*Path);
// Windows specific -- Create a resource file containing a manifest file.
if (Config->Manifest == Configuration::Embed)
@@ -753,7 +782,7 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
if (Config->ImageBase == uint64_t(-1))
Config->ImageBase = getDefaultImageBase();
@@ -75,10 +75,10 @@ index bb6a60e..0821591 100644
Config->SEHTable = Symtab.addRelative("___safe_se_handler_table", 0);
Config->SEHCount = Symtab.addAbsolute("___safe_se_handler_count", 0);
diff --git a/COFF/Driver.h b/COFF/Driver.h
index 23969ee..230ec35 100644
index 4489426..d293014 100644
--- a/COFF/Driver.h
+++ b/COFF/Driver.h
@@ -84,6 +84,9 @@ private:
@@ -86,6 +86,9 @@ private:
StringRef doFindFile(StringRef Filename);
StringRef doFindLib(StringRef Filename);
@@ -89,10 +89,10 @@ index 23969ee..230ec35 100644
void addLibSearchPaths();
diff --git a/COFF/DriverUtils.cpp b/COFF/DriverUtils.cpp
index 5d7dc2b..e2f1f2d 100644
index 14dd004..f5f3d6d 100644
--- a/COFF/DriverUtils.cpp
+++ b/COFF/DriverUtils.cpp
@@ -591,7 +591,7 @@ static const llvm::opt::OptTable::Info infoTable[] = {
@@ -637,7 +637,7 @@ static const llvm::opt::OptTable::Info infoTable[] = {
class COFFOptTable : public llvm::opt::OptTable {
public:
@@ -102,12 +102,12 @@ index 5d7dc2b..e2f1f2d 100644
// Parses a given list of options.
diff --git a/COFF/Options.td b/COFF/Options.td
index e5c9c5b..322b162 100644
index 9dfbcc8..b3b30a3 100644
--- a/COFF/Options.td
+++ b/COFF/Options.td
@@ -93,6 +93,26 @@ def nosymtab : F<"nosymtab">;
// Flags for debugging
def lldmap : Joined<["/", "-"], "lldmap:">;
@@ -99,6 +99,26 @@ def dumppdb : Joined<["/", "-"], "dumppdb">;
def lldmap : F<"lldmap">;
def lldmap_file : Joined<["/", "-"], "lldmap:">;
+
+def output : Separate<["-"], "o">, Alias<out>;
@@ -133,10 +133,10 @@ index e5c9c5b..322b162 100644
// The flags below do nothing. They are defined only for link.exe compatibility.
//==============================================================================
diff --git a/tools/lld/lld.cpp b/tools/lld/lld.cpp
index 8805e02..68c8735 100644
index 0c32ff1..5bd823a 100644
--- a/tools/lld/lld.cpp
+++ b/tools/lld/lld.cpp
@@ -51,6 +51,24 @@ static Flavor getFlavor(StringRef S) {
@@ -49,6 +49,24 @@ static Flavor getFlavor(StringRef S) {
.Default(Invalid);
}
@@ -161,7 +161,7 @@ index 8805e02..68c8735 100644
static Flavor parseProgname(StringRef Progname) {
#if __APPLE__
// Use Darwin driver for "ld" on Darwin.
@@ -101,6 +119,9 @@ int main(int Argc, const char **Argv) {
@@ -99,6 +117,9 @@ int main(int Argc, const char **Argv) {
llvm_shutdown_obj Shutdown;
std::vector<const char *> Args(Argv, Argv + Argc);
@@ -170,7 +170,7 @@ index 8805e02..68c8735 100644
+
switch (parseFlavor(Args)) {
case Gnu:
return !elf::link(Args);
return !elf::link(Args, true);
--
2.7.4