ip2unix icon indicating copy to clipboard operation
ip2unix copied to clipboard

Building with "-flto=auto" causes apps to crash

Open etam opened this issue 2 years ago • 4 comments

In openSUSE all packages have by default enabled LTO (but in cases like this it can be easily disabled). Fortunately this is caught by the tests, because helpers/helper_accept_no_peer_addr crashes and a test fails.

etam avatar Aug 27 '23 07:08 etam

This is probably because we're using a custom --version-script:

https://github.com/nixcloud/ip2unix/blob/1083369be4c2a09256f06507bacdf2accadd8d78/meson.build#L85-L92

aszlig avatar Oct 13 '23 10:10 aszlig

~~Okay, just tested this and it's not because of the --version-script,~~ investigating...

aszlig avatar Jul 07 '24 12:07 aszlig

Sooo, this essentially boils down to a nullptr dereference because the symbols actually resolve to null:

With LTO:

$ nm -D result/lib/libip2unix.so | grep socket
0000000000000000 A socket

Without LTO:

$ nm -D result/lib/libip2unix.so | grep socket
000000000000fed0 T socket

aszlig avatar Jul 07 '24 12:07 aszlig

Okay, backtracking on what I wrote earlier, it is the linker script indeed. I accidentally run a isolated test which ran into essentially a no-op without the linker script.

aszlig avatar Jul 07 '24 13:07 aszlig