aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/linkers
AgeCommit message (Collapse)AuthorFilesLines
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-08-11treewide: automatic rewriting of all comment-style type annotationsEli Schwartz1-2/+2
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
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-17Merge pull request #11976 from tristan957/cleanupsJussi Pakkanen1-26/+26
Some various type related cleanups
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-07-10Fix Xcode 15 beta linker detection. Closes #11958.Jussi Pakkanen1-1/+1
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 Schwartz4-185/+77
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-26fix regression in handling output overwriting for ar-like linkersEli Schwartz1-0/+2
Linkers that aren't actually ar, were refactored into a base class in commit 253ff71e6b801786290b6ecb23aea61dcfeebeca, which however didn't take into account that we were doing checks for this.
2023-06-14WIP: refactor loggable popen calls for consistencyEli Schwartz1-16/+4
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++ compilerNomura2-0/+77
2023-04-11fix various spelling issuesJosh Soref2-3/+3
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 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