InBetweenNames / gentooLTO

A Gentoo Portage configuration for building with -O3, Graphite, and LTO optimizations
GNU General Public License v2.0
570 stars 96 forks source link

Glibc 2.30 #402

Open FireBurn opened 5 years ago

FireBurn commented 5 years ago

I've been experiencing some issues with the Iris driver recently and I think it coincides with the glibc 2.30 release

https://bugs.freedesktop.org/show_bug.cgi?id=111376

I've just rebuild my system with gcc 9.2 and glibc 2.30 uisng these flags:

CFLAGS="-O3 -march=native -pipe -flto=8" CXXFLAGS="${CFLAGS}" LDFLAGS="${CFLAGS} -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,--build-id=sha1"

(Just -O3 -march=native -pipe for glibc)

And now I'm seeing segfaults in libacl when systemd-tmpfiles starts preventing bootup

0x00007ffff7cc79ce in __acl_entry_pp_compare () from /lib64/libacl.so.1 (gdb) bt

0 0x00007ffff7cc79ce in __acl_entry_pp_compare () from /lib64/libacl.so.1

1 0x00007ffff7b2fec4 in ?? () from /lib64/libc.so.6

2 0x00007ffff7b2fe52 in ?? () from /lib64/libc.so.6

3 0x00007ffff7b2fe35 in ?? () from /lib64/libc.so.6

4 0x00007ffff7b30212 in qsort_r () from /lib64/libc.so.6

5 0x00007ffff7cc86e4 in __acl_reorder_obj_p () from /lib64/libacl.so.1

6 0x00007ffff7cc89a8 in __acl_from_xattr () from /lib64/libacl.so.1

7 0x00007ffff7cc9ce0 in acl_get_file () from /lib64/libacl.so.1

8 0x00007ffff7e4921d in acls_for_file () from /lib/systemd/libsystemd-shared-243.so

9 0x000055555555c9a5 in ?? ()

10 0x000055555555cd55 in ?? ()

11 0x000055555555fe19 in ?? ()

12 0x000055555555895c in ?? ()

13 0x00007ffff7b17e8b in __libc_start_main () from /lib64/libc.so.6

14 0x0000555555558a8a in ?? ()

(gdb) Quit (gdb) Quit (gdb) q

with an unstripped sys-apps/acl

If I compile it with -O3 -march=native -pipe the issues go away

With the Iris driver dropping LTO, or enabling the debug flag, or using clang makes the issue go away

Has anyone else seen these issues?

javashin commented 5 years ago
javashin commented 5 years ago

i have gcc 9.2 and glibc 2.30 too but i had no rebooted today up 14 hours, 27 minutes and i emerged gcc and glibc this morning

javashin commented 5 years ago

sys-apps/acl-2.2.53::gentoo was built with the following: USE="nls (split-usr) -static-libs" ABI_X86="32 (64) (-x32)" CFLAGS="-march=native -mfpmath=both -funroll-loops -falign-functions=32 -fuse-ld=bfd -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -fno-plt -fno-math-errno -fno-trapping-math -fno-stack-protector -pipe -Wl,-O2 -Wl,--as-needed,-z,now -Wl,--hash-style=gnu" CXXFLAGS="-march=native -mfpmath=both -funroll-loops -falign-functions=32 -fuse-ld=bfd -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -fno-plt -fno-math-errno -fno-trapping-math -fno-stack-protector -pipe -Wl,-O2 -Wl,--as-needed,-z,now -Wl,--hash-style=gnu"

javashin commented 5 years ago

but i dont build systemd with lto because i use systemd-boot which dont boot with lto

FireBurn commented 5 years ago

I notice you're using bfd - I'm using gold - it could be the reason

FireBurn commented 5 years ago

I passed -fuse-ld=bfd -O3 and libacl is no longer segfaulting

Which binutils are you using?

javashin commented 5 years ago

last version too sys-devel/binutils-2.32-r1::gentoo was built with the following: USE="cxx gold nls plugins -default-gold -doc -multitarget -static-libs -test" ABI_X86="(64)" CFLAGS="-march=native -mfpmath=both -funroll-loops -falign-functions=32 -fuse-ld=bfd -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=3 -fuse-linker-plugin -fno-plt -fno-math-errno -fno-trapping-math -fno-stack-protector -pipe -Wl,-O2 -Wl,--as-needed,-z,now -Wl,--hash-style=gnu" CXXFLAGS="-march=native -mfpmath=both -funroll-loops -falign-functions=32 -fuse-ld=bfd -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=3 -fuse-linker-plugin -fno-plt -fno-math-errno -fno-trapping-math -fno-stack-protector -pipe -Wl,-O2 -Wl,--as-needed,-z,now -Wl,--hash-style=gnu" LDFLAGS="-Wl,-O2 -Wl,--as-needed,-z,now -Wl,--hash-style=gnu -march=native -mfpmath=both -funroll-loops -falign-functions=32 -fuse-ld=bfd -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=3 -fuse-linker-plugin -fno-plt -fno-math-errno -fno-trapping-math -fno-stack-protector -pipe"

elsandosgrande commented 5 years ago

I personally had no issues with the following:

COMMON_FLAGS="-O3 -march=bdver4 -pipe -pthread -fopenmp -fira-hoist-pressure -fira-loop-pressure -fbranch-target-load-optimize -ftracer ${GRAPHITE} ${DEVIRTLTO} ${IPAPTA} ${SEMINTERPOS} ${FLTO} -fuse-linker-plugin -fuse-ld=bfd -Wall -Wextra"

Side note

I built systemd with LTO and systemd-boot (gnuefi USE flag), ran bootctl update and am still booting just as well as before.

InBetweenNames commented 5 years ago

@FireBurn we actually switched back to ld.bfd earlier this year here due to issues like this cropping up.