Files
llvm-mingw/patches/lld-0002.patch
T
Martin Storsjö 93a77a441a Update patches for lld 3.9
The previously existing patch needed some modifications to fit
on top of lld 3.9.

Patch 2 makes sure that one still can use the lld built in this
way for linking in MSVC mode.

Patch 3 fixes linking binaries larger than 4 MB or so (previously
the binaries linked fine but didn't work).

Patch 4 makes sure to error out if the relocations are too far
away (instead of producing a broken binary), which happens after
16 MB.

Patch 5 fixes relocations that have an offset, which probably
happens in hand-written assembly (in libav).
2016-08-10 14:52:16 +03:00

62 lines
2.5 KiB
Diff

From f8cba388440ff846c5f479889fc64a03066ff39c 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/5] 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 0821591..65cfa9f 100644
--- a/COFF/Driver.cpp
+++ b/COFF/Driver.cpp
@@ -602,6 +602,7 @@ void LinkerDriver::link(llvm::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 e2f1f2d..f9c37ec 100644
--- a/COFF/DriverUtils.cpp
+++ b/COFF/DriverUtils.cpp
@@ -591,7 +591,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 322b162..4e7338a 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