diff options
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/c.py | 7 | ||||
-rw-r--r-- | mesonbuild/compilers/compilers.py | 8 |
2 files changed, 10 insertions, 5 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index d4626d6..d4d6f66 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -35,6 +35,7 @@ from .compilers import ( get_largefile_args, gnu_winlibs, msvc_winlibs, + unixy_compiler_internal_libs, vs32_instruction_set_args, vs64_instruction_set_args, ArmCompiler, @@ -52,8 +53,6 @@ from .compilers import ( CcrxCompiler, ) -gnu_compiler_internal_libs = ('m', 'c', 'pthread', 'dl', 'rt') - class CCompiler(Compiler): # TODO: Replace this manual cache with functools.lru_cache @@ -61,7 +60,7 @@ class CCompiler(Compiler): program_dirs_cache = {} find_library_cache = {} find_framework_cache = {} - internal_libs = gnu_compiler_internal_libs + internal_libs = unixy_compiler_internal_libs @staticmethod def attribute_check_func(name): @@ -1375,7 +1374,7 @@ class IntelCCompiler(IntelCompiler, CCompiler): class VisualStudioCCompiler(CCompiler): std_warn_args = ['/W3'] std_opt_args = ['/O2'] - ignore_libs = gnu_compiler_internal_libs + ignore_libs = unixy_compiler_internal_libs internal_libs = () crt_args = {'none': [], 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) |