Summary: | sys-devel/binutils: ld segfault on linking dev-libs/wayland-protocols-1.25 on loong (in tests/test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | WANG Xuerui <xen0n> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED OBSOLETE | ||
Severity: | normal | CC: | loong, x11 |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | Loong | ||
OS: | Linux | ||
See Also: |
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/48 https://github.com/loongson/binutils-gdb/issues/135 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
build.log
emerge --info environment minimized reproducing example |
Created attachment 777632 [details]
emerge --info
Created attachment 777635 [details]
environment
Oh, I guess there's two bugs here then. Binutils should error out properly but UB in protos? Offending assertion in bfd/elfnn-loongarch.c, inside loongarch_elf_relocate_section: > BFD_ASSERT (!resolved_dynly || (h && h->dynindx != -1)); According to the upstream issue about the "linker error", it's delibrately specified to ignore unresolved symbols for the test, and the problem goes away if one removes the -Wl,--unresolved-symbols=ignore-all switch. > $ gcc foo.o foo-code.o -Wl,--unresolved-symbols=ignore-all > /usr/lib/gcc/loongarch64-unknown-linux-gnu/12.1.0/../../../../loongarch64-unknown-linux-gnu/bin/ld: BFD (Gentoo 2.38 p4) 2.38 assertion fail elfnn-loongarch.c:2055 > collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped > compilation terminated. > > $ gcc foo.o foo-code.o > /usr/lib/gcc/loongarch64-unknown-linux-gnu/12.1.0/../../../../loongarch64-unknown-linux-gnu/bin/ld: foo-code.o:(.data.rel+0x10): undefined reference to `xdg_toplevel_interface' > collect2: error: ld returned 1 exit status So it's solely binutils' fault after all. Created attachment 777638 [details]
minimized reproducing example
This seems to be already fixed in binutils master branch, I'll check which commit(s) to backport. Confirmed upstream commit 3024b63f9f022432790c2992ae3f743c4293d12e fixes the bug, but from a quick look all subsequent commits to the LoongArch backend after the 2.38 release seem good enough to carry. Sorry; pasted local cherry-picked commit hash. It should be commit d218dba3f491191322e50df74376faa11c4a9f6b. Actually the cherry-picked commit only fixes the bare ld invocation with the two object files, but not the segfault. Opened an issue on vendor bug tracker. I've packed all files for reproducing the segfault and uploaded to my devspace, due to the tarball being larger than 1M: https://dev.gentoo.org/~xen0n/bugz/bug843371-segfault-repro.tar.xz Untar and check "repro.sh" for seeing the segfault yourself. I tested on both loong and amd64, with all currently available upstream loong patches applied, and the segfault remains. With binutils-2.39-r3, the segfault was no more, but https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/48 shows up instead. FAILED: tests/test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml loongarch64-unknown-linux-gnu-gcc -o tests/test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml tests/test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml.p/meson-generated_.._test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml.c.o tests/test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml.p/meson-generated_.._xdg-decoration-unstable-v1-code.c.o -Wl,--as-needed -Wl,--no-undefined -O2 -pipe -ggdb -Wl,-O1 -Wl,--as-needed -Wl,--unresolved-symbols=ignore-all -Wl,--start-group -lwayland-client -lwayland-server -Wl,--end-group /usr/lib/gcc/loongarch64-unknown-linux-gnu/13.0.0/../../../../loongarch64-unknown-linux-gnu/bin/ld: tests/test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml.p/meson-generated_.._xdg-decoration-unstable-v1-code.c.o:(.data.rel+0x10): undefined reference to `xdg_toplevel_interface' collect2: error: ld returned 1 exit status Marking this bug as obsolete as the problematic version of wayland-protocols is no longer in ::gentoo. The other build failure (building with FEATURES=test) is to be tracked in another bug. |
Created attachment 777629 [details] build.log FAILED: tests/test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml loongarch64-unknown-linux-gnu-gcc -o tests/test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml tests/test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml.p/meson-generated_.._test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml.c.o tests/test-build-pedantic-unstable_xdg_decoration_xdg_decoration_unstable_v1_xml.p/meson-generated_.._xdg-decoration-unstable-v1-code.c.o -Wl,--as-needed -Wl,--no-undefined -O2 -pipe -ggdb -Wl,-O1 -Wl,--as-needed -Wl,--unresolved-symbols=ignore-all -Wl,--start-group -lwayland-client -lwayland-server -Wl,--end-group /usr/lib/gcc/loongarch64-unknown-linux-gnu/12.1.0/../../../../loongarch64-unknown-linux-gnu/bin/ld: BFD (Gentoo 2.38 p4) 2.38 assertion fail elfnn-loongarch.c:2055 collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped compilation terminated. [ebuild N ] dev-libs/wayland-protocols-1.25::gentoo USE="test" 0 KiB Portage 3.0.30 (python 3.9.12-final-0, !/home/xenon/src/gentoo/profiles/default/linux/loong/22.0/la64v100/lp64d/systemd, gcc-12.1.0, glibc-2.35-r4, 5.17.0-rc6-00063-gceb10fb62d28 loongarch64) ================================================================= System uname: Linux-5.17.0-rc6-00063-gceb10fb62d28-loongarch64-with-glibc2.35 KiB Mem: 33269168 total, 10714992 free KiB Swap: 33554416 total, 33461232 free Timestamp of repository gentoo: Sun, 08 May 2022 21:15:01 +0000 Head commit of repository gentoo: 758a5f0dcbd5ff618e8733066603a05548583299 sh bash 5.1_p16 ld GNU ld (Gentoo 2.38 p4) 2.38 app-misc/pax-utils: 1.3.4::gentoo app-shells/bash: 5.1_p16::gentoo dev-lang/perl: 5.34.1-r3::gentoo dev-lang/python: 3.9.12::gentoo, 3.10.4::gentoo, 3.11.0_beta1::gentoo dev-util/cmake: 3.23.1::gentoo dev-util/meson: 0.61.4-r2::gentoo sys-apps/baselayout: 2.8::gentoo sys-apps/sandbox: 2.29::gentoo sys-apps/systemd: 250.5-r1::gentoo sys-devel/autoconf: 2.71-r1::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.38-r2::gentoo sys-devel/binutils-config: 5.4.1::gentoo sys-devel/gcc: 12.1.0::gentoo sys-devel/gcc-config: 2.5-r1::gentoo sys-devel/libtool: 2.4.7::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.17-r1::gentoo (virtual/os-headers) sys-libs/glibc: 2.35-r4::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://mirrors.tuna.tsinghua.edu.cn/gentoo-portage/ priority: -1000 sync-rsync-verify-jobs: 1 sync-rsync-verify-max-age: 24 sync-rsync-extra-opts: sync-rsync-verify-metamanifest: yes loongson location: /var/gentoo/repos/loongson-overlay masters: gentoo priority: 50