summaryrefslogtreecommitdiff
path: root/mesonbuild/linkers/detect.py
AgeCommit message (Collapse)Author
2025-11-19linkers: Store a reference to the Environment in the DynamicLinkerDylan Baker
For the same reason that the StaticLinker needs this, we need it in the DynamicLinker as well.
2025-11-14Add `os2_emxomf' option to generate OMF files on OS/2KO Myung-Hun
1. Generate OMF objs with `-Zomf' compiler flags 2. Generate OMF libs with `.lib' suffix using `emxomfar' as a librarian
2025-11-14Add OS2 dynamic linker supportKO Myung-Hun
2025-07-10compilers: move CFLAGS/CXXFLAGS handling to EnvironmentPaolo Bonzini
That is where env_opts are stored, so make the compiler call back directly into the environment. Suggested-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-07-03Update linker detection for ELDKushal Pal
ELD updated the output for `--version` flag https://github.com/qualcomm/eld/pull/156 this commit updates detection for new output. Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
2025-06-05Add eld as default linker for Qualcomm Hexagon compilerKushal Pal
Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
2025-04-16linkers: pass system to DynamicLinker.__init__ for Darwin linkersPaolo Bonzini
Apple linkers need to use different arguments on macOS and iOS-like platforms. Pass the system to the constructor so that it can be examined. Co-authored-by: Russell Keith-Magee <russell@keith-magee.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-09-27linkers: Fix linker detection with clang on SolarisAlan Coopersmith
Fixes: #13711
2024-09-24linkers: basic support for the 'zig cc' linkerAndrei Alexeyev
2024-08-07linkers: Fix RSP syntax for linkers invoked with clangKacper Michajłow
Fixes: #8981 Fixes: 2be074b1d445fcd30535bcf7518f8ce0738bcbf3 Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2024-07-04linkers: Loosen the check for GNU interface style in LLD for WindowsMartin Storsjö
Don't require the string to be enclosed in parentheses. https://github.com/llvm/llvm-project/pull/97323 changed the LLD version printout to no longer be enclosed in parentheses, which made Meson fail to detect the linker style used here. The LLD change is being reverted in https://github.com/llvm/llvm-project/pull/97698 in order to fix building with existing Meson versions, but for the future, loosen the check slightly, to not require the parentheses.
2024-05-19pylint: fix false positive for missing else branchEli Schwartz
We cover every case as if/elif/elif. mypy can handle this fine, but pylint doesn't do control flow or type checking and thinks in the missing else case, the variable might not be defined. For mypy as well, doing this instance check is unnecessary as it can be inferred. So just micro-optimize the check and allow pylint to safely analyze the logic.
2024-05-15Merge pull request #11421 from mon/ti-armclangJussi Pakkanen
Basic support for TI Arm Clang toolchain
2024-03-13Basic support for TI ARM-CLANG toolchainWilliam Toohey
2024-02-25compilers: Forward Meson's preference of lld-link to clang-clL. E. Segovia
The latter prefers LINK.exe by default, which rejects GNU-like linker flags.
2024-01-18linkers_detect: detect xtools (Apple ld64 derivative)Fabian Groffen
xtools is in use on Gentoo Prefix x86_64 and ppc based Darwin installs. Pick it up as a valid linker. Since xtools is answering with a version to --version, as opposed to ld64, detection of xtools in the ld64 handling block is not possible, since --version already succeeded. Bug: https://bugs.gentoo.org/868516 Bug: https://github.com/mesonbuild/meson/issues/10805 Signed-off-by: Fabian Groffen <grobian@gentoo.org> Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
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-03Handle macos linker reporting error message in pluring during detectionAndres Freund
Previously macos reported "ld: unknown option: --version" when being passed --version, but now sometimes it reports in plural, albeit without an obvious pattern when. To handle that, simply just check for the prefix without the : Fixes: https://github.com/mesonbuild/meson/issues/12552
2023-08-11treewide: automatic rewriting of all comment-style type annotationsEli Schwartz
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-10Fix Xcode 15 beta linker detection. Closes #11958.Jussi Pakkanen
2023-06-26linkers: delay implementations import until detect is runEli Schwartz
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-14WIP: refactor loggable popen calls for consistencyEli Schwartz
2023-04-11fix various spelling issuesJosh Soref
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-01-10linkers: detect ld64 as AppleDynamicLinkerjack
2022-11-24Fix various spelling errorsDavid Robillard
Found with codespell.
2022-09-19pylint: enable use-maxsplit-argDylan Baker
This finds a bunch of places where we can do more efficient string splitting.
2022-08-24fix linker regression for compilers that don't accept LDFLAGS directlyEli Schwartz
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 Schwartz
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 Schwartz
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 Schwartz
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 Schwartz
Use join_args to ensure that commands are rendered correctly and with less code.
2022-06-13flake8: fix various whitespace nitsEli Schwartz
2022-05-29linkers: try a bit harder to autodetect the correct linker idEli Schwartz
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-04-30linkers: Add support for mold linkerFini Jastrow
[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 Schwartz
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.
2021-10-27fix various flake8 whitespace errorsEli Schwartz
2021-10-18linkers: detect LLD when built with PACKAGE_VENDORPaolo Bonzini
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-03fix typo in error message breaking newline escapeEli Schwartz
Broken in commit 3feaea6b29197cd224fbce0ac65fd43d08c3beac.
2021-10-02Improve linker detection failure error message.Jussi Pakkanen
2021-06-25Split compiler detection from EnvironmentDaniel Mensinger
This moves all the compiler detection logic into the new compilers.detect module. This dramatically reduces the size and complexity of Environment.