Skip to content

Commit

Permalink
Remove linkerlike args from compile checks. Closes #4542.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Nov 27, 2018
1 parent 37ffff0 commit 85d62bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mesonbuild/compilers/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,13 @@ def _get_compiler_check_args(self, env, extra_args, dependencies, mode='compile'
args += env.coredata.get_external_preprocess_args(self.language)
elif mode == 'compile':
# Add CFLAGS/CXXFLAGS/OBJCFLAGS/OBJCXXFLAGS from the env
args += env.coredata.get_external_args(self.language)
sys_args = env.coredata.get_external_args(self.language)
# Apparently it is a thing to inject linker flags _both_
# via CFLAGS and LDFLAGS. Even though the latter are
# also used during linking. These flags can break
# argument checks. Thanks, Autotools.
cleaned_sys_args = self.remove_linkerlike_args(sys_args)
args += cleaned_sys_args
elif mode == 'link':
# Add LDFLAGS from the env
args += env.coredata.get_external_link_args(self.language)
Expand Down
3 changes: 3 additions & 0 deletions mesonbuild/compilers/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,9 @@ def get_undefined_link_args(self):
'''
return []

def remove_linkerlike_args(self, args):
return [x for x in args if not x.startswith('-Wl')]


@enum.unique
class CompilerType(enum.Enum):
Expand Down

0 comments on commit 85d62bf

Please sign in to comment.