Summary: | sys-devel/binutils-2.40: build failure with =sys-devel/gcc-13.0.1_pre20230205-r1 (string_fortified.h:29:10: error: first argument of '__builtin___memcpy_chk' must be a pointer, second integer constant) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Sam James <sam> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | CC: | neddyseagoon |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106099 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107300 https://bugs.gentoo.org/show_bug.cgi?id=834720 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 865117 | ||
Attachments: |
build.log.xz
opcodes/.libs/cris-desc.i |
Description
Sam James
2023-02-06 23:09:32 UTC
Created attachment 850020 [details]
build.log.xz
=sys-devel/gcc-13.0.1_pre20230129-r1 seems to work? Bisected to https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d2423144eb36a68fd0da9224857ce807714874a7: ``` d2423144eb36a68fd0da9224857ce807714874a7 is the first bad commit commit d2423144eb36a68fd0da9224857ce807714874a7 Author: Jakub Jelinek <jakub@redhat.com> Date: Thu Feb 2 10:54:54 2023 +0100 Replace IFN_TRAP with BUILT_IN_UNREACHABLE_TRAP [PR107300] For PR106099 I've added IFN_TRAP as an alternative to __builtin_trap meant for __builtin_unreachable purposes (e.g. with -funreachable-traps or some sanitizers) which doesn't need vops because __builtin_unreachable doesn't need them either. This works in various cases, but unfortunately IPA likes to decide on the redirection to unreachable just by tweaking the cgraph edge to point to a different FUNCTION_DECL. As internal functions don't have a decl, this causes problems like in the following testcase. The following patch fixes it by removing IFN_TRAP again and replacing it with user inaccessible BUILT_IN_UNREACHABLE_TRAP, so that e.g. builtin_decl_unreachable can return it directly and we don't need to tweak it later in wherever we actually replace the call stmt. 2023-02-02 Jakub Jelinek <jakub@redhat.com> ``` Can reproduce with the following in a clean clone of binutils-gdb: 1. git checkout e7a881b9d49f16bd901dba53006c48a8bfd115df (master at time) 2. ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --docdir=/usr/share/doc/binutils-2.40 --htmldir=/usr/share/doc/binutils-2.40/html --enable-plugins --without-included-gettext --with-system-zlib --enable-targets=all --enable-64-bit-bfd --build=x86_64-pc-linux-gnu --enable-secureplt --enable-default-hash-style=gnu --prefix=/usr --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --datadir=/usr/share/binutils-data/x86_64-pc-linux-gnu/2.40 --datarootdir=/usr/share/binutils-data/x86_64-pc-linux-gnu/2.40 --infodir=/usr/share/binutils-data/x86_64-pc-linux-gnu/2.40/info --mandir=/usr/share/binutils-data/x86_64-pc-linux-gnu/2.40/man --bindir=/usr/x86_64-pc-linux-gnu/binutils-bin/2.40 --libdir=/usr/lib64/binutils/x86_64-pc-linux-gnu/2.40 --libexecdir=/usr/lib64/binutils/x86_64-pc-linux-gnu/2.40 --includedir=/usr/lib64/binutils/x86_64-pc-linux-gnu/2.40/include --enable-obsolete --enable-shared --enable-threads --enable-relro --enable-install-libiberty --enable-textrel-check=warning --enable-new-dtags --disable-jansson --disable-werror --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion=Gentoo 2.40 p1 --disable-static --without-zstd --disable-gdb --disable-libdecnumber --disable-readline --disable-sim --without-stage1-ldflags --with-extra-soversion-suffix=gentoo-sys-devel-binutils-mt --without-debuginfod --without-msgpack --enable-cet --enable-gprofng --disable-pgo-build 3. make -j$(nproc) 4. make install DESTDIR=/tmp/binutils-tmp # this step is needed! Keep in mind when testing that 'make clean' (or distclean, etc) in the top level dir isn't enough and you'll need to either do it in each dir, or just git reset --hard HEAD && git clean -fdx instead. In opcodes/, this is enough to reproduce for me once built: ``` ~/git/binutils-gdb/opcodes $ x86_64-pc-linux-gnu-gcc -shared -fPIC -DPIC .libs/dis-buf.o .libs/disassemble.o .libs/dis-init.o .libs/cris-desc.o -L/usr/lib64/binutils/x86_64-pc-linux-gnu/2.40 -lbfd -L/home/sam/git/binutils-gdb/bfd/../libiberty/pic -lz -lsframe -L/home/sam/git/binutils-gdb/opcodes/../libiberty/ -liberty In function ‘memcpy’, inlined from ‘byte_re_compile_fastmap’ at /var/tmp/portage/sys-devel/binutils-2.40/work/binutils-2.40/libiberty/regex.c:4796:20: /usr/include/bits/string_fortified.h:29:10: error: first argument of ‘__builtin___memcpy_chk’ must be a pointer, second integer constant 29 | return __builtin___memcpy_chk (__dest, __src, __len, | ^ [...] ``` export CFLAGS="-O2 -freport-bug -save-temps" means that ``` x86_64-pc-linux-gnu-gcc -shared -fPIC -DPIC .libs/dis-buf.i .libs/disassemble.i .libs/dis-init.i .libs/cris-desc.i -L/usr/lib64/binutils/x86_64-pc-linux-gnu/2.40 -lbfd -L/home/sam/git/binutils-gdb/bfd/../libiberty/pic -lz -lsframe -L/home/sam/git/binutils-gdb/opcodes/../libiberty/ -liberty ``` works too to reproduce it. ``` x86_64-pc-linux-gnu-gcc -shared -fPIC -DPIC .libs/cris-desc.i -L/usr/lib64/binutils/x86_64-pc-linux-gnu/2.40 -lbfd -lz -lsframe -liberty ``` fails .. but I can't make it happen without using that -L path. Even $(find ../ -type d| grep -i .libs$ | sed -e "s:../:-L../:" | tr '\n' ' ') doesn't work. (In reply to Sam James from comment #7) > ``` > x86_64-pc-linux-gnu-gcc -shared -fPIC -DPIC .libs/cris-desc.i > -L/usr/lib64/binutils/x86_64-pc-linux-gnu/2.40 -lbfd -lz -lsframe -liberty > ``` > fails > > .. but I can't make it happen without using that -L path. Even $(find ../ > -type d| grep -i .libs$ | sed -e "s:../:-L../:" | tr '\n' ' ') doesn't work. I suspect this is just because libiberty hasn't been installed there though by the relinking process. Bleh. Created attachment 850024 [details]
opcodes/.libs/cris-desc.i
I can't reproduce this in a clean chroot though. I think this is again an instance of bug 834720 as moving away the system libiberty.a works around this for me, and the commit I bisected to in gcc must just happen to change the bitcode enough to cause breakage. The real issue is that our binutils package ends up relinking against the system copy. *** Bug 893970 has been marked as a duplicate of this bug. *** |