https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114115
Bug ID: 114115 Summary: xz-utils segfaults when built with -fprofile-generate (bad interaction between IFUNC and binding?) Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: sjames at gcc dot gnu.org Target Milestone: --- This was first reported downstream in Gentoo at https://bugs.gentoo.org/925415. xz-utils-5.6.0 (it started to use IFUNC recently for crc32) started to segfault, but only when built with -march=x86-64-v3 & -fprofile-generate. For convenience, a broken builddir is available at http://dev.gentoo.org/~sam/bugs/xz/pgo/xz-5.6.0-abi_x86_64.amd64.tar.xz. ``` Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00000000000041b6 in ?? () (gdb) bt #0 0x00000000000041b6 in ?? () #1 0x00007f861b2fcc75 in crc32_resolve () at /var/tmp/portage/app-arch/xz-utils-5.6.0/work/xz-5.6.0/src/liblzma/check/crc32_fast.c:140 #2 0x00007f861b3541e4 in elf_machine_rela (map=<optimized out>, scope=<optimized out>, reloc=0x7f861b2e05c8, sym=0x7f861b2ddfd8, version=<optimized out>, reloc_addr_arg=0x7f861b32ab10 <lzma_crc32@got[plt]>, skip_ifunc=<optimized out>) at ../sysdeps/x86_64/dl-machine.h:314 #3 elf_dynamic_do_Rela (map=0x7f861b343160, scope=<optimized out>, reladdr=<optimized out>, relsize=<optimized out>, nrelative=<optimized out>, lazy=<optimized out>, skip_ifunc=<optimized out>) at /var/tmp/portage/sys-libs/glibc-2.39-r1/work/glibc-2.39/elf/do-rel.h:147 #4 _dl_relocate_object (l=l@entry=0x7f861b343160, scope=<optimized out>, reloc_mode=<optimized out>, consider_profiling=<optimized out>, consider_profiling@entry=0) at dl-reloc.c:301 #5 0x00007f861b363d61 in dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:2311 #6 0x00007f861b36059f in _dl_sysdep_start (start_argptr=start_argptr@entry=0x7ffdeae5bd20, dl_main=dl_main@entry=0x7f861b362060 <dl_main>) at ../sysdeps/unix/sysv/linux/dl-sysdep.c:140 #7 0x00007f861b361da2 in _dl_start_final (arg=0x7ffdeae5bd20) at rtld.c:494 #8 _dl_start (arg=0x7ffdeae5bd20) at rtld.c:581 #9 0x00007f861b360b88 in _start () from /lib64/ld-linux-x86-64.so.2 #10 0x0000000000000006 in ?? () #11 0x00007ffdeae5cfc9 in ?? () #12 0x00007ffdeae5d021 in ?? () #13 0x00007ffdeae5d026 in ?? () #14 0x00007ffdeae5d034 in ?? () #15 0x00007ffdeae5d03a in ?? () #16 0x00007ffdeae5d04b in ?? () #17 0x0000000000000000 in ?? () (gdb) ``` ``` (gdb) frame 1 #1 0x00007f861b2fcc75 in crc32_resolve () at /var/tmp/portage/app-arch/xz-utils-5.6.0/work/xz-5.6.0/src/liblzma/check/crc32_fast.c:140 140 { (gdb) list 135 // This resolver is shared between all three dispatch methods. It serves as 136 // the ifunc resolver if ifunc is supported, otherwise it is called as a 137 // regular function by the constructor or first call resolution methods. 138 static crc32_func_type 139 crc32_resolve(void) 140 { 141 return is_arch_extension_supported() 142 ? &crc32_arch_optimized : &crc32_generic; 143 } 144 (gdb) ```