62 lines
2.4 KiB
Diff
62 lines
2.4 KiB
Diff
From 6fa2a85b5bfc696204939659c7f51c185d1d8b47 Mon Sep 17 00:00:00 2001
|
|
From: Martin Storsjo <martin@martin.st>
|
|
Date: Mon, 8 Aug 2016 15:37:59 +0300
|
|
Subject: [PATCH 2/2] Make the "gnu arguments in lld coff" patch not break
|
|
using lld-link in normal MSVC mode
|
|
|
|
---
|
|
COFF/Driver.cpp | 1 +
|
|
COFF/DriverUtils.cpp | 5 ++++-
|
|
COFF/Options.td | 2 ++
|
|
3 files changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/COFF/Driver.cpp b/COFF/Driver.cpp
|
|
index 4992296..b19998f 100644
|
|
--- a/COFF/Driver.cpp
|
|
+++ b/COFF/Driver.cpp
|
|
@@ -782,6 +782,7 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
|
|
if (Config->ImageBase == uint64_t(-1))
|
|
Config->ImageBase = getDefaultImageBase();
|
|
|
|
+ Symtab.addRelative(mangle("__ImageBase"), 0);
|
|
Symtab.addRelative(mangle("__image_base__"), 0);
|
|
if (Config->Machine == I386) {
|
|
Config->SEHTable = Symtab.addRelative("___safe_se_handler_table", 0);
|
|
diff --git a/COFF/DriverUtils.cpp b/COFF/DriverUtils.cpp
|
|
index f5f3d6d..aab554f 100644
|
|
--- a/COFF/DriverUtils.cpp
|
|
+++ b/COFF/DriverUtils.cpp
|
|
@@ -637,7 +637,10 @@ static const llvm::opt::OptTable::Info infoTable[] = {
|
|
|
|
class COFFOptTable : public llvm::opt::OptTable {
|
|
public:
|
|
- COFFOptTable() : OptTable(infoTable) {}
|
|
+ // GNU ld option style support requires case sensitive option matching
|
|
+ // (for -L vs -l), needing aliases for a few link.exe options that can
|
|
+ // appear in upper case in embedded directives in libraries.
|
|
+ COFFOptTable() : OptTable(infoTable, false) {}
|
|
};
|
|
|
|
// Parses a given list of options.
|
|
diff --git a/COFF/Options.td b/COFF/Options.td
|
|
index b3b30a3..dec6a0a 100644
|
|
--- a/COFF/Options.td
|
|
+++ b/COFF/Options.td
|
|
@@ -19,11 +19,13 @@ def align : P<"align", "Section alignment">;
|
|
def alternatename : P<"alternatename", "Define weak alias">;
|
|
def base : P<"base", "Base address of the program">;
|
|
def defaultlib : P<"defaultlib", "Add the library to the list of input files">;
|
|
+def DEFAULTLIB : P<"DEFAULTLIB", "">, Alias<defaultlib>;
|
|
def delayload : P<"delayload", "Delay loaded DLL name">;
|
|
def entry : P<"entry", "Name of entry point symbol">;
|
|
def export : P<"export", "Export a function">;
|
|
// No help text because /failifmismatch is not intended to be used by the user.
|
|
def failifmismatch : P<"failifmismatch", "">;
|
|
+def FAILIFMISMATCH : P<"FAILIFMISMATCH", "">, Alias<failifmismatch>;
|
|
def heap : P<"heap", "Size of the heap">;
|
|
def implib : P<"implib", "Import library name">;
|
|
def libpath : P<"libpath", "Additional library search path">;
|
|
--
|
|
2.7.4
|
|
|