Commit Graph

55 Commits

Author SHA1 Message Date
Martin Storsjo 9705898bf3 [MinGW] Hook up the --exclude-all-symbols option
Differential Revision: https://reviews.llvm.org/D58380

llvm-svn: 354387
2019-02-19 21:57:49 +00:00
Martin Storsjo dfb2fcd224 [MinGW] Add --insert-timestamp as complement to the --no-insert-timestamp option
Differential Revision: https://reviews.llvm.org/D57808

llvm-svn: 353342
2019-02-06 21:05:29 +00:00
Martin Storsjo 537a718fcb [MinGW] Hook up the --no-insert-timestamp option
This fixes PR40582.

Patch by Georg Koppen!

Differential Revision: https://reviews.llvm.org/D57679

llvm-svn: 353145
2019-02-05 08:16:06 +00:00
Martin Storsjo d79a4b7ad7 [MinGW] Don't define names for ignored options. NFC.
Move them to the same section as the newly added ignored options
without a defined name.

Also move options that actually weren't ignored to the right section.

Differential Revision: https://reviews.llvm.org/D57374

llvm-svn: 352529
2019-01-29 19:24:32 +00:00
Martin Storsjo 5d1862b76c [MinGW] Ignore the --plugin and --plugin-opt option
GCC can use LLD with -fuse-ld=lld for MinGW these days, but by
default these options are passed to the linker (unless -fno-lto
is passed to the GCC driver).

Differential Revision: https://reviews.llvm.org/D57304

llvm-svn: 352459
2019-01-29 08:38:48 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Martin Storsjo 5abe10ac21 [MinGW] Expand comment for MinGW driver. NFC.
Originally authored by Rui Ueyama.

Differential Revision: https://reviews.llvm.org/D53031

llvm-svn: 350464
2019-01-05 10:43:59 +00:00
Martin Storsjo 803b37ad5d [MinGW] Pass libpath to the COFF linker
This is necessary for handling defaultlib directives embedded in
object files, unless they use an absolute path.

Differential Revision: https://reviews.llvm.org/D53015

llvm-svn: 344123
2018-10-10 09:00:03 +00:00
Martin Storsjo db62913f28 [MinGW] Hook up the --require-defined option to -include:
Differential Revision: https://reviews.llvm.org/D51840

llvm-svn: 341846
2018-09-10 17:41:40 +00:00
Martin Storsjo c0826745cf [MinGW] Implement the GNU ld options -S/--strip-debug
In this mode, we retain the symbol table, but skip the actual debug
information.

Differential Revision: https://reviews.llvm.org/D48745

llvm-svn: 335947
2018-06-29 06:08:31 +00:00
Martin Storsjo 0366155500 [MinGW] Handle the GNU ld option -Map for outputting a linker map
Differential Revision: https://reviews.llvm.org/D46872

llvm-svn: 332398
2018-05-15 21:12:29 +00:00
Martin Storsjo b7d50115ba [MinGW] Add a LLD specific option -pdb
This allows producing pdb debug info. This is an LLD specific option
since GCC and GNU binutils doesn't support the PDB file format.

Differential Revision: https://reviews.llvm.org/D46796

llvm-svn: 332327
2018-05-15 06:34:18 +00:00
Martin Storsjo fb36e6e82c [MinGW] Add support for the GNU ld flag --kill-at
llvm-svn: 327562
2018-03-14 20:17:24 +00:00
Rui Ueyama b34bd34fd2 [MinGW] Fix --{start,end}-group.
Currently --start-group=foo is accidentally accepted by the MinGW driver.

Differential Revision: https://reviews.llvm.org/D43836

llvm-svn: 326478
2018-03-01 20:38:38 +00:00
Martin Storsjo 41ffd96445 [MinGW] Ignore the --start-group --end-group parameters
These are required for handling circular dependencies between
static libraries, which is something that lld-link always does without
any extra parameters.

Differential Revision: https://reviews.llvm.org/D43786

llvm-svn: 326172
2018-02-27 06:26:35 +00:00
Martin Storsjo cf29eb8c22 [MinGW] Ignore the --no-seh flag
The COFF linker automatically sets the IMAGE_DLL_CHARACTERISTICS_NO_SEH
when suitable, similarly to link.exe.

Differential Revision: https://reviews.llvm.org/D41275

llvm-svn: 320861
2017-12-15 20:53:10 +00:00
Sam Clegg 51d7798237 Add missing reference to lldCommon in MinGW/CMakeLists.txt
Without this the LLVM_BUILD_LLVM_DYLIB+DLLVM_LINK_LLVM_DYLIB build
break.

Also remove unneeded lldCore from wasm/CMakeLists.txt

Differential Revision: https://reviews.llvm.org/D41194

llvm-svn: 320610
2017-12-13 20:39:02 +00:00
Rui Ueyama 338c4b2336 Use the standard error handling mechanism in MinGW driver.
Differential Revision: https://reviews.llvm.org/D41127

llvm-svn: 320526
2017-12-12 20:34:38 +00:00
Martin Storsjo 71663a2eac [MinGW] Don't pass -dynamicbase:no by default for arm/arm64
The linker refuses using -dynamicbase:no on these architectures.

Stop passing -dynamicbase (which just reinforces the lld-link
default) for simplicity.

Differential Revision: https://reviews.llvm.org/D41052

llvm-svn: 320518
2017-12-12 19:39:18 +00:00
Martin Storsjo a4eaf16d94 [MinGW] Ignore the --build-id, --pie-executable and --disable-auto-image-base options
LLD already writes a build id if debug info is enabled.

Some projects set --pie-executable to avoid GNU ld bugs about stripping
base relocations from an executable when they actually are used.
Since -fixed:no is the default (and we don't support setting the
-fixed option via the MinGW frontend), we don't need to handle this.

--disable-auto-image-base is ignored just like --enable-auto-image-base
(as we ignore from before).

Differential Revision: https://reviews.llvm.org/D40031

llvm-svn: 318285
2017-11-15 08:18:28 +00:00
Martin Storsjo b190fd2bb4 [MinGW] Implement the --[no-]gc-sections and --icf options
GNU ld doesn't seem to support --icf at all, but this was suggested
in D39885, and GNU gold seems to support it.

Differential Revision: https://reviews.llvm.org/D40019

llvm-svn: 318283
2017-11-15 08:18:20 +00:00
Martin Storsjo e916868269 [MinGW] Implement support for the --image-base option
Differential Revision: https://reviews.llvm.org/D40018

llvm-svn: 318282
2017-11-15 08:18:15 +00:00
Martin Storsjo 094d8c09e6 [MinGW] Add support for --dynamicbase, ignore --nxcompat, --tsaware and --high-entropy-va
All of these are disabled by default in GNU ld, but enabled by default
in lld.

Disable dynamicbase by default since it potentially could cause
compatibility issues, but just ignore the others since the lld
default should be fine for most concievable cases.

Differential Revision: https://reviews.llvm.org/D40017

llvm-svn: 318281
2017-11-15 08:18:11 +00:00
Martin Storsjo 3c8d4b5a73 [MinGW] Handle --large-address-aware
In GNU ld, this option is only available on i386, not on x86_64
(where it's enabled by default with no option to disable it either).

Differential Revision: https://reviews.llvm.org/D40015

llvm-svn: 318280
2017-11-15 08:18:06 +00:00
Martin Storsjo 068512dfb9 [MinGW] Output debug info by default, unless the -s parameter is passed
Differential Revision: https://reviews.llvm.org/D39541

llvm-svn: 317376
2017-11-03 22:10:37 +00:00
Martin Storsjo 107b548368 [MinGW] Add an option -Xlink for passing options through to lld-link
Also move the -mllvm option to the right section of the options
list.

Differential Revision: https://reviews.llvm.org/D39528

llvm-svn: 317302
2017-11-03 07:18:37 +00:00
Martin Storsjo ab9c98c70d [MinGW] Ignore the --enable-auto-import flag
In GNU ld, this option is enabled by default, but can be set
to reduce some warnings.

For lld, ignore the flag (for now); in case linking still succeeds
everything should be fine, if not, it should be clear to the user
what part failed (possibly requiring adjusting the user project
to not rely on this feature), instead of straight out failing due to
an unknown flag.

Differential Revision: https://reviews.llvm.org/D39330

llvm-svn: 316693
2017-10-26 20:12:01 +00:00
Martin Storsjo 27af6b0082 [MinGW] Support --out-implib=name in addition to "--out-implib name"
Differential Revision: https://reviews.llvm.org/D39329

llvm-svn: 316692
2017-10-26 20:11:58 +00:00
Rui Ueyama 6f4e255219 lld::COFF: better behavior when using as a library
Previously, the COFF driver would call exit(0) when called
as a library.  Now it takes `ExitEarly` option, and if it
is false, it doesn't exit.  So it is now more library-friendly.

Furthermore, link() calls freeArena() before returning, to
clean up resources.

Based on an Andrew Kelley's patch.

Differential Revision: https://reviews.llvm.org/D39202

llvm-svn: 316370
2017-10-23 20:03:32 +00:00
Martin Storsjo a84a47741a [MinGW] Hook up the --export-all-symbols and --output-def options
Differential Revision: https://reviews.llvm.org/D38761

llvm-svn: 315563
2017-10-12 05:37:18 +00:00
NAKAMURA Takumi d791eaa559 lld: Reorder libdeps.
Differential Revision: https://reviews.llvm.org/D38828

llvm-svn: 315529
2017-10-11 23:18:43 +00:00
Rui Ueyama 6cb7141c80 Fix another build breakage.
llvm-svn: 314730
2017-10-02 22:05:46 +00:00
Rui Ueyama 1f4cdcfec9 Accept not only --foo but also -foo.
GNU ld manual says that multi-letter long option can be prefixed with
either -- or -. Therefore, we should accept not only --subsystem but
also -subsystem, for example.

There is one exception. If an option starts with "o", it should only be
prefixed with -- to avoid ambiguity with -o<filename> option.

Differential Revision: https://reviews.llvm.org/D37825

llvm-svn: 313286
2017-09-14 18:33:21 +00:00
Rui Ueyama b359263011 Filenames are case-insensitive on Windows, so .DEF is the same as .def.
Differential Revision: https://reviews.llvm.org/D37823

llvm-svn: 313285
2017-09-14 18:33:09 +00:00
Rui Ueyama a835babef9 Do not use hasArgNoClaim().
Arg instances can be claimed. After claimed, its `isClaimed` function
returns true. We do not use that notion in lld, so using NoClaim
versions of functions is just confusing. This patch is to just use
hasArg instead of hasArgNoClaim.

llvm-svn: 313187
2017-09-13 20:30:59 +00:00
Rui Ueyama 9c37d8c18b Use getUnaliasedOption so that this switch works for option aliases.
There are no alises handled by this switch, but getUnaliasesdOption is
preferred way of doing this. This is also consistent with ELF and COFF.

llvm-svn: 313180
2017-09-13 19:44:36 +00:00
Rui Ueyama 7d306a598e Move a piece of code above some local variable definitions to make their scope narrower.
llvm-svn: 313178
2017-09-13 19:40:07 +00:00
Martin Storsjo 2ba37d4b3e [MinGW] Only apply -Bstatic to following libraries
This is how the flag is documented in GNU binutils ld; -Bstatic
only applies to -l options after it, until the next -Bdynamic.

Differential Revision: https://reviews.llvm.org/D37794

llvm-svn: 313175
2017-09-13 19:29:44 +00:00
Martin Storsjo 31fe4cd25d [MinGW] Support dllexport on i386
In MinGW configurations (GCC, or clang with a *-windows-gnu target),
the -export directives in the object file contains the undecorated
symbol name, while it is decorated in MSVC configurations. (On the
command line, link.exe takes an undecorated symbol name for the
-export argument though.)

Differential Revision: https://reviews.llvm.org/D37772

llvm-svn: 313174
2017-09-13 19:29:39 +00:00
NAKAMURA Takumi 34fc973b08 lldMinGW itself doesn't require libpthread.
llvm-svn: 313129
2017-09-13 07:59:07 +00:00
Martin Storsjo 064b0fac93 [MinGW] Support creating DLLs with a def file
Differential Revision: https://reviews.llvm.org/D37761

llvm-svn: 313125
2017-09-13 07:28:13 +00:00
Martin Storsjo 32e1626a2e [MinGW] Add support for the options --[no-]whole-archive
Differential Revision: https://reviews.llvm.org/D37769

llvm-svn: 313124
2017-09-13 07:28:09 +00:00
Martin Storsjo 6d8dace438 [MinGW] Pass the undecorated entry point name to the COFF linker
On i386, the --entry parameter to GNU ld is supposed to be a decorated
symbol name, while it is an undecorated name in link.exe.

Differential Revision: https://reviews.llvm.org/D37710

llvm-svn: 313066
2017-09-12 19:23:54 +00:00
NAKAMURA Takumi 8a55c471ba lldMinGW: Add LLVMSupport in libdeps.
llvm-svn: 312981
2017-09-12 00:01:07 +00:00
Rui Ueyama d2da71f971 Reorder functions so that related functions come closer.
llvm-svn: 312964
2017-09-11 22:04:37 +00:00
Rui Ueyama 447479677f Rename COFFLdOptTable MinGWOptTable for consistency.
llvm-svn: 312963
2017-09-11 22:04:25 +00:00
Rui Ueyama c16fd25c29 Make the scope of an anonymous namespace as narrow as possible.
llvm-svn: 312962
2017-09-11 22:04:13 +00:00
Rui Ueyama 95114b497f Remove unused includes and do not enclose the entire file with a namespace.
llvm-svn: 312961
2017-09-11 22:04:01 +00:00
Rui Ueyama febfec2b3c Fix MinGW/CMakeLists.txt.
We do not use "Shim" as a name of MinGW driver, so rename it MinGW.
I don't think the former dependency list was correct. MinGW driver
depends on COFF.

llvm-svn: 312960
2017-09-11 22:03:49 +00:00
Martell Malone 0d17638b89 LLD: Add -mllvm flag to the MinGW driver.
This adds support for passing LTO flags to the MINGW driver
in GNU LD style i.e. -mllvm flag -> /mllvm:flag

Reviewers: ruiu, mstorsjo

Differential Revision: https://reviews.llvm.org/D37712

llvm-svn: 312956
2017-09-11 21:36:37 +00:00