From 12428a08fefdfdcd07b92eb855a501df4344b97e Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 7 Jul 2024 17:06:36 +0200 Subject: [PATCH] meson: Throw error if built with LTO enabled Right now, link-time optimisation doesn't work and produces symbols with null references with our linker script. For example without LTO: $ nm -D result/lib/libip2unix.so | grep socket 000000000000fed0 T socket With LTO enabled however, we get the following: $ nm -D result/lib/libip2unix.so | grep socket 0000000000000000 A socket I haven't managed to find out why *exactly* this happens, but since we don't have a fix yet, let's at least make sure users get an error message early on instead of a crash. Signed-off-by: aszlig Issue: https://github.com/nixcloud/ip2unix/issues/33 --- meson.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meson.build b/meson.build index 451838e..637d3f1 100644 --- a/meson.build +++ b/meson.build @@ -20,6 +20,11 @@ if std_fs_check.returncode() != 0 ' please update your compiler toolchain.') endif +if get_option('b_lto') + error('Link-time optimisation is not supported,' + + ' please build with b_lto set to false (-Db_lto=false)') +endif + warning_flags = [ '-Wcast-qual', '-Wcovered-switch-default',