aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/linkers/linkers.py
AgeCommit message (Collapse)AuthorFilesLines
2024-06-29linkers: Fix AppleDynamicLinker not returning any rpaths to removePiotr Brzeziński1-2/+4
Fixes regression from commit 78e9009ff9d36925e04f329f9082841002ddd848. The above commit relied on rpath_dirs_to_remove being present and correctly filled, which was never the case for the AppleDynamicLinker. The result was that all the build-dir-only RPATHs were being carried over to the installed files. This commit implements returning the list of RPATHs to remove in AppleDynamicLinker, doing pretty much the same thing as what's in the GnuLikeDynamicLinkerMixin. Thanks to that, depfixer now correctly removes build-time Meson-created RPATHs, as it used to before 1.4.1.
2024-06-26compilers: pass Environment to openmp_flagsDylan Baker1-1/+1
This will be needed by the Apple compiler
2024-06-05Add -export_dynamic flag for AppleDynamicLinkerWolfgang Walther1-0/+3
The apple linker uses -export_dynamic instead of --export-dynamic [1]. This should be set when setting export_dynamic: true. Resolves #13290 [1]: https://opensource.apple.com/source/ld64/ld64-609/doc/man/man1/ld.1.auto.html
2024-05-15Merge pull request #11421 from mon/ti-armclangJussi Pakkanen1-3/+24
Basic support for TI Arm Clang toolchain
2024-04-05Merge pull request #12144 from amyspark/fix-msvc-clangcl-linker-flag-detectionJussi Pakkanen1-0/+6
linkers: Fix detection of link arguments to Clang(-cl) + MSVC
2024-03-13Basic support for TI ARM-CLANG toolchainWilliam Toohey1-3/+24
2024-03-12Added support for Texas Instruments C6000 compiler.Petr Machacek1-0/+6
2024-03-03compilers: only wrap multiple input libraries with start/end groupEli Schwartz1-2/+2
When only a single input file shows up in an arglist, it makes no sense to inject `-W,--start-group -lone -Wl,--end-group`, since there is nothing being grouped together. It's just longer command lines for nothing.
2024-02-25linkers: Fix detection of link arguments to Clang(-cl) + MSVCL. E. Segovia1-0/+6
Currently, not only Meson lacks a way to induce a "--fatal-warnings" on LINK.exe, it is also unable to pass flags appropriately when using clang-cl or Microsoft's stock clang. This commit fixes it by implementing `fatal_warnings()` in the MSVCDynamicLinker and ClangCLDynamicLinker classes, and by implementing the requisite conversion steps in linker_to_compiler_args for ClangCompiler.
2023-12-23Remove `get_buildtype_args` functionCharles Brunet1-32/+27
This is a first step to make `buildtype` a true alias of `debug` and `optimization` options. See #10808. Relates to: - #11645 - #12096 - #5920 - #5814 - #8220 - #8493 - #9540 - #10487 - #12265 - #8308 - #8214 - #7194 - #11732
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker1-11/+1
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-12-06macos: Do not emit -undefined,error for Sonoma compatibilityAndres Freund1-1/+9
Emitting -undefined,error was correct,, but starting with Xcode 15 / Sonoma, doing so triggers "ld: warning: -undefined error is deprecated". Given that "-undefined error" is documented to be the linker's default behaviour, this warning seems ill advised. However, it does create a lot of noise. As "-undefined error" is the default behaviour, the least bad way to deal with this seems to be to just not emit anything. Of course that only works as long as nothing else injects -undefined dynamic_lookup, or such. Complain to Apple. Fixes: https://github.com/mesonbuild/meson/issues/12450
2023-10-12MSVCDynamicLinker: prevent duplicated /nologo argumentCharles Brunet1-1/+1
2023-10-05msvc: unify debug filename handlingDudemanguy1-2/+1
The MSVC code is extremely confusing, and it turns out it actually constructs debug (pdb) files names/path independently in separate places. This is really hard to parse. Instead, refactor it so that the source of the debug filename is within the target itself (get_debug_filename). Add a couple of generic methods to retrieve the full path of the debug filename name in the backend and use that when needed.
2023-09-06backends/ninja: run `ranlib -c $out` when using the apple arDylan Baker1-0/+4
Apple's AR is old, and doesn't add externed symbols to the symbol table, instead relying on the user calling ranlib with -c. We need to do that for the user
2023-07-25make 'gui_app' an interpreter only conceptDylan Baker1-13/+0
Since it's deprecated anyway, we don't really want to plumb it all the way down into the build and backend layers. Instead, we can just turn it into a `win_subsystem` value in the interpreter if `win_subsystem` isn't already set.
2023-07-19mypy: add more mixin base classesEli Schwartz1-3/+3
These don't have new errors or old ignored ones, but add them anyway so we can generally validate their sanity.
2023-07-19linkers: fix mypy errors that were ignored due to lack of inheritanceEli Schwartz1-4/+11
A linker mixin has to be able to align with the base linker it will be used for, in order to reference super(). Since they weren't inherited, calls to super() resulted in mypy errors, which we ignored, and casting. Use the same trick we use for compilers, and make the linker inherit from the base linker type when running under mypy, and from object at runtime.
2023-07-19linkers: reorganize code so that linker base classes always come firstEli Schwartz1-199/+200
So that we can later reference them.
2023-07-12Fix return type of debugfile functionsTristan Partin1-2/+2
It was returning None in some cases while being marked as returning string.
2023-07-12Match the method signatures of parent classesTristan Partin1-5/+5
Names and types of some methods did not match their parent methods.
2023-07-12Annotate naked fundamental Python typesTristan Partin1-6/+6
Although mypy wasn't complaining, pyright was.
2023-07-12Replace some type comments with annotationsTristan Partin1-13/+13
2023-06-27Archive shared library in AIX (#11850)Aditya Kamath1-0/+24
* Archive shared library in AIX This code change to ensure we archive shared libraries in AIX. The things we do are: Archive shared library Install archived shared library Build all must build the archived shared library blibpath must have the archived shared library dependency. * Archive shared library in AIX. Made changes as per the review comments given in the first PR request. They are:- Use self.environment.machines[t.for_machine].is_aix() Remove trial spaces Use of val instead of internal Changed comments wherever requested * Space after octothorpe * Fixed failed test case causing build break during install section * Moved AIX specific code to AIXDynamicLinker from backend * Fix indentation, trailing spaces, add type annotations and Linux/macOS build break * Remove some more trailing space issues * Fixed the wrong return type in linkers
2023-06-26linkers: delay implementations import until detect is runEli Schwartz1-32/+4
This saves on a 1500-line import at startup and may be skipped entirely if no compiled languages are used. In exchange, we move the implementation to a new file that is imported instead. Followup to commit ab20eb5bbc21ae855bcd211131132d2778602bcf.
2023-06-08dependencies/llvm: strip default include dirsKarol Herbst1-2/+2
Fixes an issue with rust.bindgen if a cmake LLVM dependency with the system include_type is getting used as a dependency.
2023-04-24Initial support for Metrowerks C/C++ compilerNomura1-0/+65
2023-04-11fix various spelling issuesJosh Soref1-2/+2
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-02-01treewide: add future annotations importEli Schwartz1-0/+1
2023-01-10linkers: detect ld64 as AppleDynamicLinkerjack1-0/+5
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 Robillard1-1/+1
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-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 Baker1-1/+1
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-07-25linkers: Add a representation for the Apple AR LinkerDylan Baker1-0/+7
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-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 Jastrow1-1/+6
[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-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 Toohey1-7/+17
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 Schwartz1-1/+1