diff --git a/meson.build b/meson.build index 6113deb0aa0..e9c3dccfceb 100644 --- a/meson.build +++ b/meson.build @@ -45,6 +45,12 @@ endif if get_option('b_lto') project_version += '-lto' + # LTO causes random issues that are nearly impossible to debug, so bug reports from LTO builds have been + # rejected for a long time now. + # Explicitly reject LTO when building to prevent more people from running into bugs that end up inactionable. + if not get_option('allow-broken-lto') + error('Building Mesa with LTO is not supported. Please disable LTO for building Mesa.') + endif endif with_llvm = get_option('llvm') diff --git a/meson.options b/meson.options index 9a132f802c3..d22431f82e0 100644 --- a/meson.options +++ b/meson.options @@ -865,3 +865,10 @@ option( type : 'feature', description : 'Use SPIRV-Tools for dumping SPIR-V for debugging purposes (required by CLC)' ) + +option( + 'allow-broken-lto', + type : 'boolean', + value : false, + description : 'Manual override switch to enable LTO, which is unsupported due to being broken. WARNING: This option may break your driver randomly!' +)