diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-11-25 14:20:58 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-12-12 10:57:27 -0800 |
commit | 47dfe34c8517747d51ef063474e3594c487fde82 (patch) | |
tree | 5f17ce21d886962533f48ffce024d451ccbb8ae7 /mesonbuild/compilers/compilers.py | |
parent | 87766b37276164eaf359c9e99522dcd6a53be180 (diff) | |
download | meson-47dfe34c8517747d51ef063474e3594c487fde82.zip meson-47dfe34c8517747d51ef063474e3594c487fde82.tar.gz meson-47dfe34c8517747d51ef063474e3594c487fde82.tar.bz2 |
Consider compiler arguments in linker detection logic
If a user passes -fuse-ld=gold to gcc or clang, they expect that they'll
get ld.gold, not whatever the default is. Meson currently doesn't do
that, because it doesn't pass these arguments to the linker detection
logic. This patch fixes that. Another case that this is needed is with
clang's --target option
This is a bad solution, honestly, and it would be better to use $LD or a
cross/native file but this is needed for backwards compatability.
Fixes #6057
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 9631bd2..20b339b 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -681,6 +681,7 @@ class Compiler: internal_libs = () LINKER_PREFIX = None # type: typing.Union[None, str, typing.List[str]] + INVOKES_LINKER = True def __init__(self, exelist, version, for_machine: MachineChoice, info: 'MachineInfo', linker: typing.Optional['DynamicLinker'] = None, **kwargs): @@ -1175,7 +1176,8 @@ def get_args_from_envvars(lang: str, use_linker_args: bool) -> typing.Tuple[typi return compile_flags, link_flags -def get_global_options(lang: str, properties: Properties) -> typing.Dict[str, coredata.UserOption]: +def get_global_options(lang: str, comp: typing.Type[Compiler], + properties: Properties) -> typing.Dict[str, coredata.UserOption]: """Retreive options that apply to all compilers for a given language.""" description = 'Extra arguments passed to the {}'.format(lang) opts = { @@ -1190,7 +1192,7 @@ def get_global_options(lang: str, properties: Properties) -> typing.Dict[str, co if properties.fallback: # Get from env vars. # XXX: True here is a hack - compile_args, link_args = get_args_from_envvars(lang, True) + compile_args, link_args = get_args_from_envvars(lang, comp.INVOKES_LINKER) else: compile_args = [] link_args = [] |