aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2019-03-12 17:56:44 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-03-14 12:21:05 +0000
commit07818dac6acc7a805548be4b605320dd27de126c (patch)
tree768d8eff8970d3c51312153ea0426660f11c9779 /mesonbuild/compilers/compilers.py
parent5f00c3020073962edbeb2f3f709c27acdb09fd74 (diff)
downloadmeson-07818dac6acc7a805548be4b605320dd27de126c.zip
meson-07818dac6acc7a805548be4b605320dd27de126c.tar.gz
meson-07818dac6acc7a805548be4b605320dd27de126c.tar.bz2
compilers: Try harder to dedup builtin libs
Compiler internal libs should always be de-duplicated, no matter what. Closes https://github.com/mesonbuild/meson/issues/2150 Test case is by Bruce Richardson in the issue.
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r--mesonbuild/compilers/compilers.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 94ebf16..ceefefe 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -81,6 +81,9 @@ cflags_mapping = {'c': 'CFLAGS',
'vala': 'VALAFLAGS',
'rust': 'RUSTFLAGS'}
+# execinfo is a compiler lib on BSD
+unixy_compiler_internal_libs = ('m', 'c', 'pthread', 'dl', 'rt', 'execinfo')
+
# All these are only for C-linkable languages; see `clink_langs` above.
def sort_clink(lang):
@@ -659,6 +662,9 @@ class CompilerArgs(list):
# Only UNIX shared libraries require this. Others have a fixed extension.
dedup1_regex = re.compile(r'([\/\\]|\A)lib.*\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$')
dedup1_args = ('-c', '-S', '-E', '-pipe', '-pthread')
+ # In generate_link() we add external libs without de-dup, but we must
+ # *always* de-dup these because they're special arguments to the linker
+ always_dedup_args = tuple('-l' + lib for lib in unixy_compiler_internal_libs)
compiler = None
def _check_args(self, args):
@@ -793,7 +799,7 @@ class CompilerArgs(list):
normal_flags = []
lflags = []
for i in iterable:
- if i.startswith('-l') or i.startswith('-L'):
+ if i not in self.always_dedup_args and (i.startswith('-l') or i.startswith('-L')):
lflags.append(i)
else:
normal_flags.append(i)