Commit Graph

65 Commits

Author SHA1 Message Date
Nirbheek Chauhan b293852d07 vs: Write checksums in PE binaries (DLLs and EXEs)
This is needed for detecting data corruption, and its absence (or
an incorrect value) is also used as a hint by anti-viruses that the
binary may be malware.

Flag is only supported by MSVC `link.exe`, not `lld-link.exe`

https://docs.microsoft.com/en-us/cpp/build/reference/release-set-the-checksum
2020-01-22 19:34:05 +05:30
Nirbheek Chauhan 89b132f240 linkers: Accept both str and List[str] for _apply_prefix
Simplifies some usage.
2020-01-22 19:34:05 +05:30
Nirbheek Chauhan 38db769aaf linkers: Clarify a comment about rspfiles 2020-01-22 19:34:05 +05:30
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Dylan Baker 9e21942780 linkers: Remove get_allow_undefined_args from link.exe
PE DLLs don't work like elf or mach-o, there's no way to define symbols
at run time, they must all be defined as import or export at link time.
As such there's no value in being able to have undefined symbols in
MSVC, nor does meson expose an option to change them

Fixes: #6342
2019-12-18 21:57:03 +02:00
Dylan Baker 47dfe34c85 Consider compiler arguments in linker detection logic
If a user passes -fuse-ld=gold to gcc or clang, they expect that they'll
get ld.gold, not whatever the default is. Meson currently doesn't do
that, because it doesn't pass these arguments to the linker detection
logic. This patch fixes that. Another case that this is needed is with
clang's --target option

This is a bad solution, honestly, and it would be better to use $LD or a
cross/native file but this is needed for backwards compatability.

Fixes #6057
2019-12-12 10:57:27 -08:00
Jussi Pakkanen 17dd9e5bff
Merge pull request #6207 from dcbaker/linker-option
Add a way to select the dynamic linker meson uses
2019-12-11 23:29:33 +02:00
Dylan Baker c00e17b35a Partially revert "lgtm: fix Missing call to __init__ during object initialization"
This partially reverts commit fe853ee516.

In particular this reverts the changes to the DynamicLinker __init__
methods. Frankly this is *bad* because it allows a mixin class (which
should not be directly instantiated) to be directly instantiated, and
complicates the init process. It also increases the amount of code for
zero gain, and makes the code less resilient to refactors.
2019-12-05 22:15:40 +02:00
Daniel Mensinger fe853ee516 lgtm: fix Missing call to __init__ during object initialization
Either mark the missing calls as intentional, or explicetly call
the right __init__ method and avoid mixing super() and explicit
base calss calls.
2019-12-05 00:22:10 +02:00
Dylan Baker afe00f4217 linkers: make constructor signature of VisualStudioLike linkers the same 2019-12-03 13:08:42 -08:00
Dylan Baker a1bfd22120 linkers: Correct MSVC-like linkers invoke directly flag
This is returning the inverse of the correct value, which happens to
work out because in general the compilers that a link.exe-like linker is
paired with accepts the same arguments.
2019-12-03 13:08:42 -08:00
Dylan Baker 8091b4c744 Intel: Dump worthless Xild abstractions
This dumps xild on mac and linux. After a lot of reading and banging my
head I've discovered we (meson) don't care about xild, xild is only
useful if your invoke ld directly (not through icc/icpc) and you want to
do ipo/lto/wpo. Instead just make icc report what it's actually doing,
invoking ld or ld64 (for linux and mac respectively) directly. This
allows us to get -fuse-ld working on linux.
2019-12-03 13:08:42 -08:00
Dylan Baker ef9aeb188e Allow selecting the dynamic linker
This uses the normal meson mechanisms, an LD environment variable or via
cross/native files.

Fixes: #6057
2019-12-02 16:39:06 -08:00
Dylan Baker 52aa24e997 linkers: Fix Apple and VS-like linkers always_args
Which would not call the super() method, thus overriding the default
behavior when it should have instead extended it.
2019-12-02 13:39:37 -08:00
Mihai Moldovan 2c4a08ee56 linkers: AppleDynamicLinker supports -pie.
The linker implementation split up introduced a regression: since the
AppleDynamicLinker subclass doesn't expose PIE support, builds using
that feature just plainly fail.

Add back support for it using the default and supported -pie flag.
2019-11-29 08:11:06 -08:00
Michael Hirsch, Ph.D 8313e8fd54 dep: MPI make work for intel-cl and improve robustness
optimize intelMPI variables

mpi: extract version from non-OpenMPI wrapper
2019-11-25 13:08:01 +02:00
Kurtis Rader ffdacc4c9c Enable code coverage using LLVM on macOS Catalina
Fixes #6188
2019-11-19 12:46:27 +02:00
mfurukawa facf87edd8 pass sanitize option to linker on macOS 2019-11-08 21:41:59 +02:00
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Jussi Pakkanen b6af3f3810
Merge pull request #5833 from dcbaker/remove-compiler-type
Remove compiler type
2019-10-09 19:53:56 +03:00
Dylan Baker 225c93c5c0 linkers: Concatenate -L and the directory
It is perfectly valid to pass the arguments separately `-L /some/dir/`,
however, meson later groups arguments by whether they start with -L or
not, which breaks passing the -L and the directory separately.

Fixes #6003
2019-10-08 00:07:06 +03:00
Dylan Baker 506eb998d1 linkers: Use PosixDynamicLinkerMixin for Cuda
Since cuda is currently reimplementing all of the shared methods itself,
including a bug fixed by the next patch.
2019-10-08 00:07:06 +03:00
Dylan Baker 0c22798b1a compilers: replace CompilerType with MachineInfo
Now that the linkers are split out of the compilers this enum is
only used to know what platform we're compiling for. Which is
what the MachineInfo class is for
2019-10-07 12:08:20 -07:00
Aleksey Gurtovoy 7dbabdc7b6 Correctly handle platform-specific LDFLAGS options 2019-09-27 00:57:21 +03:00
Aleksey Gurtovoy 6ac5db50c9 CUDA support on Windows 2019-09-24 14:22:20 -07:00
Jussi Pakkanen d67d5411bb
Merge pull request #5823 from scivision/linker-pgi-linux
PGI compiler fixes
2019-09-05 23:45:54 +03:00
Aleksey Gurtovoy 75daed27bc mesonlib.split_args/quote_arg/join_args 2019-09-05 23:42:47 +03:00
Michael Hirsch, Ph.D c8d380e4ef
PGI: use ar link wrapper on Windows 2019-09-05 11:50:17 -04:00
Kramer Peace 7e8febaa8c Add get_soname_args method to CUDA linker
Currently it retruns an empty string array.
2019-09-05 08:38:56 -07:00
Kramer Peace fb9a5ce867 Add a CUDA linker object
Fixes issue #5870
2019-09-05 08:38:56 -07:00
Dylan Baker 0efab591da compilers: Move the compiler argument to proxy linker flags to the compiler class
Instead of the DynamicLinker returning a hardcoded value like
`-Wl,-foo`, it now is passed a value that could be '-Wl,', or could be
something '-Xlinker='

This makes a few things cleaner, and will make it possible to fix using
clang (not clang-cl) on windows, where it invokes either link.exe or
lld-link.exe instead of a gnu-ld compatible linker.
2019-08-30 00:01:32 +03:00
Dylan Baker 6864058b10 Fix type annotations in linkers for python < 3.5.4
Before python 3.5.4 typing didn't have the NoReturn type, use a string
to forward declare it.

aside: I can't wait to be able to use python 3.7's
__future__.annotations and not have to deal wit hthis anymore.

Fixes #5822
2019-08-21 20:51:59 +03:00
Dylan Baker 06dcbd50ee compilers: Dispatch to dynamic linker class
Most of the cuda code is from Olexa Bilaniuk.
Most of the PGI code is from Michael Hirsc
2019-08-14 13:13:23 -07:00
Dylan Baker 4e74867f4b linkers: Add DMDs optlink 2019-08-14 13:13:23 -07:00
Dylan Baker 1bb5d53b5a linkers: Add SolarisDynamicLinker
A dynamic linker for solaris/opensolaris. This is still completely
untested and probably doesn't work.
2019-08-14 13:13:23 -07:00
Dylan Baker c77414a20b linkers: Add intel xilink 2019-08-14 13:13:23 -07:00
Dylan Baker d9b6b5de31 linkers: Add MSVC like linkers 2019-08-14 13:13:23 -07:00
Michael Hirsch, Ph.D 7c5b25ce51 linkers: Add PGIDynamicLinker 2019-08-14 13:13:23 -07:00
Dylan Baker cd134b78c0 linkers: Add the armclang dynamic linker 2019-08-14 13:13:23 -07:00
Dylan Baker 5ababa413c linkers: Add ArmDynamicLinker class
Much of this code was written by Vasu Penugonda
2019-08-14 13:13:23 -07:00
Dylan Baker 686fd03af5 linkers: Add Ccrx Dynamic Linker 2019-08-14 13:13:23 -07:00
Dylan Baker 3406b315be linkers: Add class for Intel Xild linker. 2019-08-14 13:13:23 -07:00
Dylan Baker c0a1ec9346 linkers: Add the AppleDynamicLinker 2019-08-14 13:13:23 -07:00
Dylan Baker 43d47899f8 linkers: Add LLVM linker 2019-08-14 13:13:23 -07:00
Dylan Baker d708b274a1 linkers: Add GNU linkers 2019-08-14 13:13:23 -07:00
Dylan Baker b5b48f33bc linkers: Add a PosixDynamicLinkerMixin
This is a mixin class for DynamicLinkers that aims to provide only the
most basic posix-like linker arguments, in other words bits that gnu ld,
apple's ld, solaris's ld, and other completely disjoint linkers that are
used on Unix-like OSes share.
2019-08-14 13:13:23 -07:00
Dylan Baker 6770af4d36 linkers: Add a Dynamiclinker base class
This class defines a few basics, and sets up the other methods that a
linker needs to implement.
2019-08-14 13:13:23 -07:00
Dylan Baker e0f036f3a4 linkers: Always use mesonlib namespace 2019-07-23 09:58:24 +00:00
Dylan Baker 24c4c079e7 linkers: Add get_base_link_args method to static linkers
MSVC needs an argument to static linkers for doing LTO, so we need a way
for the static linker to tell us that.
2019-07-23 09:58:24 +00:00
Dylan Baker 32c57ca782 linkers: simplify and annotate
I started out just annotating, but realized there is a lot of really
silly duplication of methods in this module. Nearly all of the methods
return [], but each class implemented the same methods over and over!
I've fixed this by moving the default implementation down into the
`StaticLinker` class, and then overriding as necessary in the derived
classes.
2019-07-23 09:58:24 +00:00