aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/linkers
AgeCommit message (Collapse)AuthorFilesLines
2023-02-01treewide: add future annotations importEli Schwartz1-0/+1
2023-01-10linkers: detect ld64 as AppleDynamicLinkerjack2-6/+28
2023-01-09linkers: Do not use numeric windows subsystems with lldJan Janssen1-12/+25
Fixes: #11258
2023-01-09linkers: Fix lld detectionJan Janssen1-1/+1
This was actually probing bfd without always_args passed. Fixes: #10763
2022-12-27emscripten: use single arguments when specifying optionsKleis Auke Wolthuizen1-2/+2
i.e. without a space between the "-s" and option name. See: https://github.com/emscripten-core/emscripten/issues/11463 This is supported since Emscripten 1.39.19, see: https://github.com/emscripten-core/emscripten/commit/f45bea21f3a8f74a68ed4e3e3d7e290807ee2aff
2022-11-24Fix various spelling errorsDavid Robillard2-2/+2
Found with codespell.
2022-11-16linkers: Don't build thin archives on illumos or SolarisAlan Coopersmith1-2/+6
The system linkers don't support this particular GNU extension on these OS'es, so don't build them there. Based on an OpenIndiana patch created by @alarcher. Closes #9882.
2022-10-13Add b_thinlto_cache for automatically configuring incremental ThinLTOTatsuyuki Ishi1-0/+18
2022-10-13linkers: Add missing mold entries to __init__Tatsuyuki Ishi1-0/+2
2022-10-03AIX: allow link_whole, it's the only supported behaviour anywayAndres Freund1-0/+6
As ld's manpage says: "The ld command processes all input files in the same manner, whether they are archives or not"
2022-09-19pylint: enable use-maxsplit-argDylan Baker2-4/+4
This finds a bunch of places where we can do more efficient string splitting.
2022-09-19compilers: directly import from subpackagesEli Schwartz1-4/+4
It turns out we don't generally need to proxy every compiler ever through the top-level package. The number of times we directly poke at one is negligible and direct imports are pretty clean.
2022-08-26Fix purely white space issues reported by flake8Alf Henrik Sauge1-1/+1
2022-08-24fix linker regression for compilers that don't accept LDFLAGS directlyEli Schwartz1-1/+3
e.g. ldc -- the compiler needs to process args before consuming them. Fixes #10693
2022-08-07linkers: detection should invoke the linker with lang_link_args onlyEli Schwartz1-3/+3
Currently we invoke it with lang_args only, which is wrong and probably useless. Fixes misdetecting the linker when overridden as -fuse-ld, which led to Meson trying to pass incompatible flags, outright failing if CFLAGS contained flags that only work with a non-default linker, or in the most benevolent case, having the status log report the wrong linker.
2022-07-31linkers: make sure the linker is actually Apple when matching failureEli Schwartz1-5/+11
Not all "use -v" errors are Apple ld, and if it doesn't have better output with -v instead of --version, we should not assume that is what it is.
2022-07-31linkers: include linker detection output in the debug logsEli Schwartz1-1/+8
We do something similar when running get_compiler() method checks from the DSL. This ensures that if errors happen, the log file we tell people to check actually works.
2022-07-31linkers: better reporting of command failuresEli Schwartz1-3/+3
Use join_args to ensure that commands are rendered correctly and with less code.
2022-07-25linkers: Add a representation for the Apple AR LinkerDylan Baker2-0/+9
Which is old and annoying and doesn't expose global symbols by default, so we need a work around. see: https://github.com/mesonbuild/meson/pull/10587 see: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
2022-07-21ar linker: detect the "osx ld" case (where generating thin archives won't ↵Justin Blanchard1-7/+8
work) based on host OS, not build OS.
2022-06-13flake8: fix various whitespace nitsEli Schwartz1-1/+1
2022-05-29linkers: try a bit harder to autodetect the correct linker idEli Schwartz1-2/+4
mingw GCC using ld.bfd emits diagnostics that include "-plugin-opt=-pass-through=-lmoldname" and this triggers a match for mold when it should not. Instead, always check the very beginning of the output for the linker id. This is pretty consistent: - it is always on stdout - GCC may put additional things on stderr we don't care about - swift is bizarre and on some OSes redirects the linker stdout to swiftc's stderr, but it will still be the only stderr; we didn't even check stderr at all until commit 712cbe056811ebdf0d7358ba07a874717a1c736f For gold/bfd linkers, the linker id is always the *second* word, after the legally mandated "GNU" we already check for.
2022-05-18Fix --allow-shlib-undefined for LLVM versions > 9Tristan Partin1-1/+2
2022-05-10linkers/MinGW: Allow `efi_application` value for `win_subsystem`Lens1-7/+25
Previously, any value other than `windows` or `console` caused an exception. This change allows for `efi_application` to be passed as the `win_subsystem` to MinGW based linkers.
2022-04-30linkers: Add support for mold linkerFini Jastrow2-6/+15
[why] Support for the relatively new mold linker is missing. If someone wants to use mold as linker `LDFLAGS="-B/path/to/mold"` has to be added instead of the usual `CC_LD=mold meson ...` or `CXX_LD=mold meson ...`. [how] Allow `mold' as linker for clang and newer GCC versions (that versions that have support). The error message can be a bit off, because it is generic for all GNU like compilers, but I guess that is ok. (i.e. 'mold' is not listed as possible linker, even if it would be possible for the given compiler.) [note] GCC Version 12.0.1 is not sufficient to say `mold` is supported. The expected release with support will be 12.1.0. On the other hand people that use the un-released 12.0.1 will probably have built it from trunk. Allowing 12.0.1 is helping bleeding edge developers to use mold in Meson already now. Fixes: #9072 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-03-07move a bunch of imports into TYPE_CHECKING blocksEli Schwartz1-3/+5
These are only used for type checking, so don't bother importing them at runtime. Generally add future annotations at the same time, to make sure that existing uses of these imports don't need to be quoted.
2022-03-07treewide: string-quote the first argument to T.castEli Schwartz1-1/+1
Using future annotations, type annotations become strings at runtime and don't impact performance. This is not possible to do with T.cast though, because it is a function argument instead of an annotation. Quote the type argument everywhere in order to have the same effect as future annotations. This also allows linters to better detect in some cases that a given import is typing-only.
2022-02-02Genericise TI compiler and add MSP430 supportWilliam Toohey2-7/+21
2021-12-30fix type annotations for compiler toolchain rpathsEli Schwartz1-12/+12
We pass around a tuple of rpaths, because rpaths *can* be more than one. But all the annotations said it would be a str instead.
2021-10-27Changing xc16's linker from 'xc16-gcc.exe' to 'xc16-gcc'. Windows willgeorgev931-2/+2
still find the correct linker and now linux will be able to use its xc16-gcc as the linker.
2021-10-27fix various flake8 whitespace errorsEli Schwartz2-6/+6
2021-10-18linkers: detect LLD when built with PACKAGE_VENDORPaolo Bonzini1-3/+3
https://github.com/Homebrew/homebrew-core/commit/e7c972b6062af753e564104e58d1fa20c0d1ad7a added PACKAGE_VENDOR to lld, causing the -v output to start with "Homebrew LLD" rather than just "LLD". Meson no longer detects it and fails the test_ld_environment_variable_lld unit test. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-10-10Fix typos discovered by codespellChristian Clauss1-1/+1
2021-10-10ar linker: generate thin archives for uninstalled static librariesEli Schwartz1-8/+19
Since they will never be used outside of the build directory, they do not need to literally contain the .o files, and references will be sufficient. This covers a major use of object libraries, which is that the static library would potentially take up a lot of space by including another copy of every .o file. Fixes #9292 Fixes #8057 Fixes #2129
2021-10-10linkers: reorganize Ar linker into a base classEli Schwartz1-29/+24
The `init__()` method basically existed solely to be overridden by every derivative class. Better to use it only in the class that needs it. This fixes several warnings, including missing calls to init because we skipped ArLinker due to not wanting it... also get rid of a pointless popen return code saved as pc, which we never checked.
2021-10-03fix typo in error message breaking newline escapeEli Schwartz1-1/+1
Broken in commit 3feaea6b29197cd224fbce0ac65fd43d08c3beac.
2021-10-02Improve linker detection failure error message.Jussi Pakkanen1-3/+5
2021-09-10Comments on nagfor options setup.Mat Cross1-1/+8
2021-09-10Implemented some missing operation for the NAG Fortran Compiler.Mat Cross2-0/+32
2021-08-31pylint: turn on superflous-parensDylan Baker1-1/+1
We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
2021-07-18Cuda: Fix linking with shared versioned internal libsDavid Seifert1-2/+6
2021-07-18Merge pull request #8996 from bonzini/fix8746Jussi Pakkanen1-24/+11
Do not add SONAME to shared modules
2021-07-17Update linkers.pyIan Harvey1-0/+6
Add /subsystem:xxx to xilink command line, either as specified in the build settings or as "console" by default.
2021-07-14linkers: remove is_shared_module argument to get_soname_argsPaolo Bonzini1-22/+11
The argument is now unused, drop it.
2021-07-14do not add SONAME to shared modulesPaolo Bonzini1-2/+0
For an ELF targets, shared_module() builds a module with SONAME field (using -Wl,-soname argument). This is wrong: only the shared_library() needs SONAME, while shared_module() does not. Moreover, tools such as debian's dpkg-shlibdeps use presence of SONAME field as an indicator that this is shared library as opposed to shared module (e.g., for the module it is okay to have unresolved symbols which are imported from the executable which loads the module, while a library should have all symbols resolved). This was in fact already the behavior on Darwin; extend it to ELF targets as well. Fixes: #8746 Reported-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-05condense linesEli Schwartz1-6/+3
2021-07-05simplify mesonlib imports for the sake of line lengthsEli Schwartz1-11/+12
2021-07-05more f-strings too complex to be caught by pyupgradeEli Schwartz1-4/+4
2021-07-01C2000: linker uses now binary setting defined within the cross-filemiebka1-2/+2
2021-06-25Split compiler detection from EnvironmentDaniel Mensinger2-0/+227
This moves all the compiler detection logic into the new compilers.detect module. This dramatically reduces the size and complexity of Environment.