aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/linkers.py
AgeCommit message (Collapse)AuthorFilesLines
2021-06-25linkers: move linkers.py into the linkers packageDaniel Mensinger1-1429/+0
2021-05-30Only try to get RSP syntax if RSP is supported (#8804)Dylan Baker1-1/+1
2021-03-14compilers/linkers: Add a methhod for getting the rspfile syntaxDylan Baker1-1/+43
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz1-18/+18
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04various python neatness cleanupsEli Schwartz1-3/+3
All changes were created by running "pyupgrade --py3-only --keep-percent-format" and committing the results. I have not touched string formatting for now. - use set literals - simplify .format() parameter naming - remove __future__ - remove default "r" mode for open() - use OSError rather than compatibility aliases - remove stray parentheses in function(generator) scopes
2021-02-14aix: avoid -bsvr4 flagPeter Harris1-9/+22
The svr4 linker flag causes issues, especially when compiling c++. Replace '-z' options with the equivalent non-svr4 flags. When using -blibpath, we must be careful to include the default system library path, or the resulting executables will not be able to find libc. This patch was suggested by @andreaskem in #7581.
2021-01-11move handling of CFLAGS and friends to environmentDylan Baker1-16/+1
This has a bunch of nice features. It obviously centralizes everything, which is nice. It also means that env is only re-read at `meson --wipe`, not `meson --reconfigure`. And it's going to allow more cleanups.
2021-01-11import MachineChoice from mesonlibDylan Baker1-1/+1
there are a couple of places importing it from envconfig, which is not correct. It's defined in mesonlib, and then imported into envconfig.
2021-01-04use OptionKey for compiler_optionsDylan Baker1-6/+6
2020-12-22linkers: add rpath_dirs_to_remove support to SolarisDynamicLinkerAlan Coopersmith1-1/+6
Applies the changes made to GnuLikeDynamicLinkerMixin by commit d7235c5905fa98207d90f3ad34bf590493498d5b to SolarisDynamicLinker This makes test_build_rpath pass with the Solaris linker, where before this change it failed with: New rpath must not be longer than the old one. Old: $ORIGIN/sub:/foo/bar New: /baz:$ORIGIN/sub:/foo/bar FAILED: meson-install Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-12-15Fix the subsystem options for lld in mingw modeMartin Storsjö1-15/+12
lld in gnu like mode (e.g. for mingw) needs these options in the same for as gnu ld, thus remove the lld specific code bit and move the code for gnu like options into GnuLikeDynamicLinkerMixin. This unbreaks linking with lld for mingw targets after 2fb4d1f7512a4ec125883fd65115ab33a5b06b6f.
2020-12-14Less restrictive get_win_subsystem_args implementationsLaurin-Luis Lehning1-6/+12
2020-12-14Propagate Windows target checks upLaurin-Luis Lehning1-24/+13
2020-12-14Give get_gui_app_args access to the EnvironmentLaurin-Luis Lehning1-4/+4
2020-12-14Slight consistency changes to get_gui_app_argsLaurin-Luis Lehning1-0/+10
2020-12-14Oversight in VisualStudioLikeLinkerMixinLaurin-Luis Lehning1-1/+1
2020-12-14Give get_win_subsystem_args access to envLaurin-Luis Lehning1-3/+3
2020-12-14Make win_subsystem a linker propertyLaurin-Luis Lehning1-0/+31
2020-12-13Add support for driving lld-link indirectly through clang on WindowsLaurin-Luis Lehning1-0/+8
2020-11-17Revert "Add thinlto support. Closes #7493."Jussi Pakkanen1-5/+3
This reverts commit 3e6fbde94c1cb8d4e01b7daf0282c315ff0e6c7d.
2020-11-08Add thinlto support. Closes #7493.Jussi Pakkanen1-3/+5
2020-10-04linkers: Drop -pie on macOSRoman Bolshakov1-1/+1
Projects that specify b_pie=true clutter build logs with the warning: clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument] No option is needed to produce PIE binaries because ld64 is making PIE executables on 10.7 and above by default, as documented in ld(1). Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
2020-10-01linkers: Fix Xilink constructorDylan Baker1-2/+5
2020-09-24compilers: Tell mypy that the compiler mixins are just thatDylan Baker1-0/+1
We do this by making the mixins inherit the Compiler class only when mypy is examining the code (using some clever inheritance shenanigans). This caught a bunch of issues, and also lets us delete a ton of code.
2020-09-18Some fixes for CompCertSebastian Meyer1-2/+2
1. Like with gcc's `ld`, also use the `group_start` code to create a `--start-group`/`--end-group` 2. xc16 tricked into believing the 'link_whole' was about `--*-group`, but it should use gcc's `--whole-archive` instead. 3. Not clear what the get_lib_prefix should really do, but for picolibc it seems I want just `''`. The problem with picolibc was that the `-l` would be prefixed to a lib like `picolib/libm/libm.a`. Though of course the `-l` would be necessary for just a plain `m` (that's what I assumed this would be used for). I think this might need some clarification from the meson devs ;-)
2020-09-16linkers: fully type annotate and fix mypy issuesDylan Baker1-6/+24
This makes GnuDynamicLinker not suitable for instantiation, so the tests need to be changed to use the BFD class.
2020-09-16linkers/compilers: Move an emscripten method to the compilerDylan Baker1-7/+0
This needed an attribute the linker doesn't have.
2020-09-16linkers: Make id a class variable for DynamicLinkersDylan Baker1-33/+48
Originally I had this idea that you'd be able to pass the id in to be able to deduplicate some cases (like ld.gold and ld.bfd). That went away because it ended up being really un-dry, but this id per instance remained. Getting rid of it allows us to get rid of a bunch of otherwise useless super calls, which makes adding type annotations easier.
2020-09-16linkers: Fix argument errorDylan Baker1-1/+1
The name of the argument passed was not the name of the argument used.
2020-09-15Add support for the CompCert C CompilerSebastian Meyer1-0/+53
* Add preliminary support for the CompCert C Compiler The intention is to use this with the picolibc, so some GCC flags are automatically filtered. Since CompCert uses GCC is for linking, those GCC-linker flags which are used by picolibc, are automatically prefixed with '-WUl', so that they're passed to GCC. Squashed commit of the following: commit 4e0ad66dca9de301d2e41e74aea4142afbd1da7d Author: Sebastian Meyer <meyer@absint.com> Date: Mon Aug 31 14:20:39 2020 +0200 remove '-fall' from default arguments, also filter -ftls-model=.* commit 41afa3ccc62ae72824eb319cb8b34b7e6693cb67 Author: Sebastian Meyer <meyer@absint.com> Date: Mon Aug 31 14:13:55 2020 +0200 use regex for filtering ccomp args commit d68d242d0ad22f8bf53923ce849da9b86b696a75 Author: Sebastian Meyer <meyer@absint.com> Date: Mon Aug 31 13:54:36 2020 +0200 filter some gcc arguments commit 982a01756266bddbbd211c54e8dbfa2f43dec38f Author: Sebastian Meyer <meyer@absint.com> Date: Fri Aug 28 15:03:14 2020 +0200 fix ccomp meson configuration commit dce0bea00b1caa094b1ed0c6c77cf6c12f0f58d9 Author: Sebastian Meyer <meyer@absint.com> Date: Thu Aug 27 13:02:19 2020 +0200 add CompCert to meson (does not fully work, yet) * remove unused import and s/cls/self/ fixes the two obvious LGTM warnings * CompCert: Do not ignore unsupported GCC flags Some are safe to ignore, however, as per https://github.com/mesonbuild/meson/pull/7674, they should not be ignored by meson itself. Instead the meson.build should take care to select only those which are actually supported by the compiler. * remove unused variable * Only add arguments once. * Apply suggestions from code review Co-authored-by: Dylan Baker <dylan@pnwbakers.com> * Remove erroneous ' ' from '-o {}'.format() As noticed by @dcbaker * added release note snippet for compcert * properly split parameters As suggested by @dcbaker, these parameters should be properly split into multiple strings. Co-authored-by: Dylan Baker <dylan@pnwbakers.com> * Update add_compcert_compiler.md Added a sentence about the state of the implementation (experimental); use proper markdown * properly separate arguments Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-08-25Merge pull request #7581 from peterh/aixJussi Pakkanen1-0/+44
Add AIX support
2020-08-22Merge pull request #7447 from scivision/nvcJussi Pakkanen1-1/+5
Add support for NVidia HPC SDK compilers
2020-08-12aix: allow both 32-bit and 64-bit objects in a static libraryPeter Harris1-0/+12
Without the -Xany flag, the ar command will complain when an .o file is compiled for the non-default bit width. This change is necessary to allow 64-bit builds via a native (or cross) file.
2020-08-12aix: detect and support the AIX dynamic linkerPeter Harris1-0/+32
2020-08-02Make meson recognize the Qualcomm LLVM toolchainAntony Chan1-0/+6
Meson calls `path/to/clang++ --version` to guess which build toolchain the user has picked to build the source code. For the Qualcomm LLVM toolchain, the output have an unusual output as shown below: ``` clang version 8.0.12 Snapdragon LLVM ARM Compiler 8.0.12 (based on llvm.org 7.0+) Target: arm-unknown-linux-gnueabi Thread model: posix Repository: (ssh://git-hexagon-aus.qualcomm.com:...) InstalledDir: /pkg/qct/software/llvm/release/arm/8.0.12/bin ``` Another unusual pattern is the output of `path/to/ld.qcld --version`: ``` ARM Linker from Snapdragon LLVM ARM Compiler Version 8.0.12 ARM Linker based on LLVM version: 8.0 ``` The Meson logic is modified accordingly so that Meson can correctly determine toolchain as "LLVM aarch64 cross-compiler on GNU/Linux64 OS". This is the expected output of `meson --native-file native_file.ini --cross-file cross_file.ini build/aarch64-debug/`: ``` ... C++ compiler for the host machine: ... (clang 8.0.12 "clang version 8.0.12") C++ linker for the host machine: ... ld.lld 8.0.12 ... ```
2020-07-14Merge pull request #7422 from alanc/solaris-fixesJussi Pakkanen1-1/+7
Solaris fixes revisited
2020-07-13Fix native builds on Windows ARM64 machinesNirbheek Chauhan1-13/+0
I made the mistake of always selecting the debug CRT for compiler checks on Windows 4 years ago: https://github.com/mesonbuild/meson/pull/543 https://github.com/mesonbuild/meson/pull/614 The idea was to always build the tests with debugging enabled so that the compiler doesn't optimize the tests away. But we stopped doing that a while ago, and also the debug CRT has no relation to that. We should select the CRT in the same way that we do for building targets: based on the options. On Windows ARM64, the debug CRT for ARM64 isn't always available, and the release CRT is available only after installing the runtime package. Without this, we will always try to pick the debug CRT even when --buildtype=debugoptimized or release.
2020-07-13add Nvidia HPC SDK compilersMichael Hirsch, Ph.D1-1/+5
2020-07-07SolarisDynamicLinker: Check if linker supports -z type=pieAlan Coopersmith1-1/+7
As suggested by dcbaker in https://github.com/mesonbuild/meson/pull/7370#discussion_r445145889 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-06-22SolarisDynamicLinker: add get_asneeded_args() & get_pie_args()Alan Coopersmith1-0/+7
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-06-22compilers: Return CompilerArgs from compiler instanceDylan Baker1-0/+4
Since the CompileArgs class already needs to know about the compiler, and we really need at least per-lanaguage if not per-compiler CompilerArgs classes, let's get the CompilerArgs instance from the compiler using a method.
2020-06-11apple: -headerpad args are ignored when bitcode is enabledNirbheek Chauhan1-5/+7
Causes spammy warnings from the linker: ld: warning: -headerpad_max_install_names is ignored when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
2020-06-05gnulike linkers (and ar) accept rsp files.Dan Kegel1-0/+7
2020-05-16Let .pc files specify rpath.Dan Kegel1-22/+27
Fixes #4027
2020-05-08Do not pass rpath flags to wasm-ldAndrei Alexeyev1-0/+5
2020-04-21switch python2 %s for python3 .formatMichael1-6/+6
2020-03-23Fix legacy env var support with crossJohn Ericson1-7/+15
Fix #3969
2020-03-21-Add xc16 and c2000 C,Cpp toolchain supportalanNz1-0/+111
2020-03-12Merge pull request #6356 from dcbaker/fix-d-compiler-abstractionsJussi Pakkanen1-2/+13
Fix d compiler abstractions
2020-03-09linkers: Allow optlink to be invoked indirectlyDylan Baker1-2/+9