Compilers: pass -Werror to the linker with b_lto

With LTO, the linker will re-execute the compiler and various warnings may
be emitted. We must therefore pass -Werror to the linker as well when -Werror
is enabled to capture these. This is only required / useful with LTO.

Closes: https://github.com/mesonbuild/meson/issues/7360
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
pull/12750/head
Sam James 10 months ago committed by Eli Schwartz
parent 92f638e1f9
commit 85cfc1fafc
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 3
      mesonbuild/compilers/compilers.py

@ -324,6 +324,9 @@ def get_base_link_args(options: 'KeyedOptionDictType', linker: 'Compiler',
args: T.List[str] = []
try:
if options[OptionKey('b_lto')].value:
if options[OptionKey('werror')].value:
args.extend(linker.get_werror_args())
thinlto_cache_dir = None
if get_option_value(options, OptionKey('b_thinlto_cache'), False):
thinlto_cache_dir = get_option_value(options, OptionKey('b_thinlto_cache_dir'), '')

Loading…
Cancel
Save