aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-02-21 17:03:08 +0200
committerGitHub <noreply@github.com>2020-02-21 17:03:08 +0200
commit33fbc548ab74e79280d2f57b2cd499d14c1f1e91 (patch)
tree0791f09890c3bd99048d38a4488a6116344e8c16 /mesonbuild/compilers/compilers.py
parent48f3e72493c28d7721c6f25e644638bad5c63835 (diff)
parent36b4dec26270e8908307e80fcc174004bc69a181 (diff)
downloadmeson-33fbc548ab74e79280d2f57b2cd499d14c1f1e91.zip
meson-33fbc548ab74e79280d2f57b2cd499d14c1f1e91.tar.gz
meson-33fbc548ab74e79280d2f57b2cd499d14c1f1e91.tar.bz2
Merge pull request #6668 from mesonbuild/nirbheek/strip-more-unused-linkerlike-args
macOS: Remove more unused linkerlike args
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r--mesonbuild/compilers/compilers.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 0e52a82..2f1e104 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1065,7 +1065,25 @@ class Compiler:
return self.linker.get_undefined_link_args()
def remove_linkerlike_args(self, args):
- return [x for x in args if not x.startswith('-Wl')]
+ rm_exact = ('-headerpad_max_install_names',)
+ rm_prefixes = ('-Wl,', '-L',)
+ rm_next = ('-L',)
+ ret = []
+ iargs = iter(args)
+ for arg in iargs:
+ # Remove this argument
+ if arg in rm_exact:
+ continue
+ # If the argument starts with this, but is not *exactly* this
+ # f.ex., '-L' should match ['-Lfoo'] but not ['-L', 'foo']
+ if arg.startswith(rm_prefixes) and arg not in rm_prefixes:
+ continue
+ # Ignore this argument and the one after it
+ if arg in rm_next:
+ next(iargs)
+ continue
+ ret.append(arg)
+ return ret
def get_lto_compile_args(self) -> T.List[str]:
return []