diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-08-04 02:05:33 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-08-07 23:28:48 +0300 |
commit | 0ec039d2597526c670f7e0478a7b5008e14ff474 (patch) | |
tree | 5085659f6d6e0edf852af6d88ee794dd3d2f4401 | |
parent | 952dd7773d79074938572216c8f8e73ce602b92c (diff) | |
download | meson-0ec039d2597526c670f7e0478a7b5008e14ff474.zip meson-0ec039d2597526c670f7e0478a7b5008e14ff474.tar.gz meson-0ec039d2597526c670f7e0478a7b5008e14ff474.tar.bz2 |
linkers: detection should invoke the linker with lang_link_args only
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.
-rw-r--r-- | mesonbuild/linkers/detect.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/linkers/detect.py b/mesonbuild/linkers/detect.py index 17c5478..684328b 100644 --- a/mesonbuild/linkers/detect.py +++ b/mesonbuild/linkers/detect.py @@ -16,7 +16,7 @@ from __future__ import annotations from .. import mlog from ..mesonlib import ( - EnvironmentException, OptionKey, + EnvironmentException, Popen_safe, join_args, search_version ) from .linkers import ( @@ -71,7 +71,7 @@ def guess_win_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty elif isinstance(comp_class.LINKER_PREFIX, list): check_args = comp_class.LINKER_PREFIX + ['/logo'] + comp_class.LINKER_PREFIX + ['--version'] - check_args += env.coredata.options[OptionKey('args', lang=comp_class.language, machine=for_machine)].value + check_args += env.coredata.get_external_link_args(for_machine, comp_class.language) override = [] # type: T.List[str] value = env.lookup_binary_entry(for_machine, comp_class.language + '_ld') @@ -140,7 +140,7 @@ def guess_nix_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty """ env.coredata.add_lang_args(comp_class.language, comp_class, for_machine, env) extra_args = extra_args or [] - extra_args += env.coredata.options[OptionKey('args', lang=comp_class.language, machine=for_machine)].value + extra_args += env.coredata.get_external_link_args(for_machine, comp_class.language) if isinstance(comp_class.LINKER_PREFIX, str): check_args = [comp_class.LINKER_PREFIX + '--version'] + extra_args |