Skip to content

Commit

Permalink
meson: Throw error if built with LTO enabled
Browse files Browse the repository at this point in the history
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 <aszlig@nix.build>
Issue: #33
  • Loading branch information
aszlig committed Jul 7, 2024
1 parent bfca40e commit 12428a0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 12428a0

Please sign in to comment.