diff options
-rw-r--r-- | mesonbuild/compilers/compilers.py | 4 | ||||
-rwxr-xr-x | run_unittests.py | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 352c49e..70c7c3c 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -521,7 +521,7 @@ class CompilerArgs(list): dedup2_suffixes = () dedup2_args = () # Arg prefixes and args that must be de-duped by returning 1 - dedup1_prefixes = ('-l',) + dedup1_prefixes = ('-l', '-Wl,-l') dedup1_suffixes = ('.lib', '.dll', '.so', '.dylib', '.a') # Match a .so of the form path/to/libfoo.so.0.1.0 # Only UNIX shared libraries require this. Others have a fixed extension. @@ -625,7 +625,7 @@ class CompilerArgs(list): group_start = -1 group_end = -1 for i, each in enumerate(new): - if not each.startswith('-l') and not each.endswith('.a') and \ + if not each.startswith(('-Wl,-l', '-l')) and not each.endswith('.a') and \ not soregex.match(each): continue group_end = i diff --git a/run_unittests.py b/run_unittests.py index c1aa8de..16eee3e 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -284,6 +284,9 @@ class InternalTests(unittest.TestCase): # Adding a non-library argument doesn't include it in the group l += ['-Lfoo', '-Wl,--export-dynamic'] self.assertEqual(l.to_native(copy=True), ['-Lfoo', '-Lfoodir', '-Wl,--start-group', '-lfoo', '-Lbardir', '-lbar', '-lbar', '/libbaz.a', '-Wl,--end-group', '-Wl,--export-dynamic']) + # -Wl,-lfoo is detected as a library and gets added to the group + l.append('-Wl,-ldl') + self.assertEqual(l.to_native(copy=True), ['-Lfoo', '-Lfoodir', '-Wl,--start-group', '-lfoo', '-Lbardir', '-lbar', '-lbar', '/libbaz.a', '-Wl,--export-dynamic', '-Wl,-ldl', '-Wl,--end-group']) def test_string_templates_substitution(self): dictfunc = mesonbuild.mesonlib.get_filenames_templates_dict |