Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 937446 - sys-devel/gcc-14.2.0, undefined referece to _Unwind_GetIP, on ARM MUSL
Summary: sys-devel/gcc-14.2.0, undefined referece to _Unwind_GetIP, on ARM MUSL
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-06 09:02 UTC by Marius Dinu
Modified: 2025-03-03 19:46 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.txt,7.07 KB, text/plain)
2024-08-06 09:03 UTC, Marius Dinu
Details
build log (gcc-14.2.0.log.tar.gz,61.69 KB, application/gzip)
2024-08-06 09:07 UTC, Marius Dinu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marius Dinu 2024-08-06 09:02:48 UTC
emerge sys-devel/gcc-14.2.0 fails with this error:

/usr/lib/gcc/armv7a-unknown-linux-musleabihf/14/../../../../armv7a-unknown-linux-musleabihf/bin/ld: ../libbacktrace/.libs/libbacktrace.a(backtrace.o): in function `unwind':
backtrace.c:(.text+0x1c): undefined reference to `_Unwind_GetIP'
collect2: error: ld returned 1 exit status

Thank you.

Reproducible: Always
Comment 1 Marius Dinu 2024-08-06 09:03:29 UTC
Created attachment 899274 [details]
emerge --info
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-08-06 09:05:10 UTC
Please include gcc-build-logs.tar.xz.
Comment 3 Marius Dinu 2024-08-06 09:07:49 UTC
Created attachment 899275 [details]
build log
Comment 4 Marius Dinu 2024-08-06 18:56:34 UTC
I did more tests:
- emerge sys-devel/gcc:13 fails with the same error
- after installing gcc:13 binpkg and activating it in eselect gcc, emerge sys-devel/gcc:14 fails with the same error.

I don't know if it's important or not, but I'm using kernel v6.10 from github/torvalds and linux-headers v6.9 from portage. I couldn't find a guide how to install headers from an external kernel source. Running make headers_install in the kernel source dir made a mess in /usr/include.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-02 02:32:12 UTC
(In reply to Marius Dinu from comment #4)
> Running make headers_install in the kernel source dir made a mess in /usr/include.

Yeah, definitely DO NOT run make headers_install.

I've seen this error before but I can't remember what my conclusion was...
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-11 08:01:25 UTC
Adelie does https://git.adelielinux.org/adelie/packages/-/blob/93cf7fc8b05fe3003b6f16b766622544cdf3830b/system/gcc/206-arm-unwind-functionise.patch but I'd like to better understand when it's needed and why.
Comment 7 A. Wilcox (awilfox) 2024-12-11 08:31:35 UTC
The original reason we made the _Unwind_{Get,Set}IP macros into functions in the Adélie toolchain was to solve a build error in BIND with GCC 8.5.0 on armv7: https://git.adelielinux.org/adelie/packages/-/issues/866

This is because libgcc_s provides those functions, via libgcc/unwind-dw2.c, on every platform - except Arm!  Arm systems get the implementation at libgcc/config/arm/unwind-arm.c.

The upstream issue (not filed by us) was originally https://gitlab.isc.org/isc-projects/bind9/-/issues/2828 and they just gave up and went with --disable-backtrace.

The Ada bits of that patch is because the first gnat1 would break since it is (correctly) assuming that those functions won't exist on Arm and therefore isn't linking to the object on Arm in stage1.  By using the #defines, stage1 can build without that undeclared dependency, and then stage2 builds against the normal _Unwind_Foo symbols since it pulls in all of libgcc_s.

This is only necessary because musl doesn't have its own backtrace stuff and relies on GCC's built-in one, afaik.

Never seen GCC need this patch itself, but then we've had this patch since GCC 8, so I guess I wouldn't have.  Still, the 32-bit Arm stuff I've done *outside* of Adélie hasn't run into this particular issue either, but I can't say I regularly test 32-bit Arm with bleeding-edge GCC of which 14 only recently stopped being.