summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-01-18 07:03:17 +0000
committerEli Schwartz <eschwartz93@gmail.com>2024-01-18 02:19:26 -0500
commit85cfc1fafcda047fa497d1d6219a8c742523b5a6 (patch)
tree2825dd41b8b0d17151de2091844c2103a5db653c /mesonbuild/compilers/compilers.py
parent92f638e1f9a9306a4296631cbc8f97c253e6ba88 (diff)
downloadmeson-85cfc1fafcda047fa497d1d6219a8c742523b5a6.tar.gz
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>
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r--mesonbuild/compilers/compilers.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index f1a2b7376..fbe30f6f0 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/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'), '')