Summary: | sys-apps/systemd-utils-254.3 - clang-16: error: invalid linker name in argument '-fuse-ld=bfd' | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Stuart Meya <stuartmeya> |
Component: | Current packages | Assignee: | Gentoo systemd Team <systemd> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | CC: | immoloism, kocelfc, stuartmeya |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | ARM64 | ||
OS: | Linux | ||
See Also: |
https://github.com/systemd/systemd/issues/29165 https://bugs.gentoo.org/show_bug.cgi?id=832019 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
emerge --info '=sys-apps/systemd-utils-254.3::gentoo'
emerge -pqv '=sys-apps/systemd-utils-254.3::gentoo' /var/tmp/portage/sys-apps/systemd-utils-254.3/temp/build.log Patch to force off the bfd linker and gcc libs from systems-boot |
Description
Stuart Meya
2023-09-11 17:13:21 UTC
Created attachment 870321 [details]
emerge -pqv '=sys-apps/systemd-utils-254.3::gentoo'
Created attachment 870322 [details]
/var/tmp/portage/sys-apps/systemd-utils-254.3/temp/build.log
FAILED: src/boot/efi/linuxaa64.elf.stub clang -o src/boot/efi/linuxaa64.elf.stub src/boot/efi/linuxaa64.elf.stub.p/cpio.c.o src/boot/efi/linuxaa64.elf.stub.p/linux.c.o src/boot/efi/linuxaa64.elf.stub.p/splash.c.o src/boot/efi/linuxaa64.elf.stub.p/stub.c.o -Wl,--as-needed -Wl,--no-undefined -pie -fstack-protector -O2 -pipe -march=native -Wl,-O1 -Wl,--as-needed -Wl,--as-needed -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed -Wl,--start-group src/boot/efi/libefiaa64.a -fuse-ld=bfd -lgcc -Wl,--end-group -nostdlib -static-pie -Wl,--entry=efi_main -Wl,--fatal-warnings -Wl,--no-dynamic-linker -z text -z common-page-size=4096 -z max-page-size=4096 -z noexecstack -z norelro -T/var/tmp/portage/sys-apps/systemd-utils-254.3/work/systemd-stable-254.3/tools/elf2efi.lds -Wl,-z,nopack-relative-relocs -fcf-protection=none -fno-asynchronous-unwind-tables -fno-exceptions -fno-unwind-tables -fno-sanitize=all -Wno-unused-command-line-argument clang-16: error: invalid linker name in argument '-fuse-ld=bfd' The bfd linker is forced in /src/boot/efi/meson.build ``` efi_c_ld_args = [ # We only support bfd. gold is going away, lld has issues with LTO on x86 # and mold does not support linker scripts. '-fuse-ld=bfd', ... Stuart and I have tested a simple patch that removes this line, it builds fine with LLD and -flto=thin, however we haven't done any more actual testing beyond building and more discussion would be needed to actually disable this restriction. (On top of finding out what the issue with LLD was that made them place it in the first place) In regards to the musl issue, it seems my last reply was a bit hasty, as there are further gcc library dependencies, which is relevant as the user was attempting to build the package on a pure musl/llvm system. I'm sorry. (In reply to Mia Neufeld from comment #4) > The bfd linker is forced in /src/boot/efi/meson.build > > ``` > efi_c_ld_args = [ > # We only support bfd. gold is going away, lld has issues with LTO > on x86 > # and mold does not support linker scripts. > '-fuse-ld=bfd', > ... > > Stuart and I have tested a simple patch that removes this line, it builds > fine with LLD and -flto=thin, however we haven't done any more actual > testing beyond building and more discussion would be needed to actually > disable this restriction. (On top of finding out what the issue with LLD was > that made them place it in the first place) You need to make sure it actually works at runtime. Building EFI binaries is painful if doing it without a real toolchain. In any case, it's an issue which needs to go upstream. (In reply to Sam James from comment #6) > (In reply to Mia Neufeld from comment #4) > > The bfd linker is forced in /src/boot/efi/meson.build > > > > ``` > > efi_c_ld_args = [ > > # We only support bfd. gold is going away, lld has issues with LTO > > on x86 > > # and mold does not support linker scripts. > > '-fuse-ld=bfd', > > ... > > > > Stuart and I have tested a simple patch that removes this line, it builds > > fine with LLD and -flto=thin, however we haven't done any more actual > > testing beyond building and more discussion would be needed to actually > > disable this restriction. (On top of finding out what the issue with LLD was > > that made them place it in the first place) > > You need to make sure it actually works at runtime. Building EFI binaries is > painful if doing it without a real toolchain. In any case, it's an issue > which needs to go upstream. Good evening Sam, we tested Mias patch with QEMU 7.2 ~arm64 VM based on LLVM16 musl. It's running on a MacBook Pro 14" M2 Pro 2023 with macOS Sonoma 14.0, latest Beta - utilising the UTM app as a frontend for QEMU. I added Mia's disable_forced_bfd.patch to /etc/portage/patches/sys-apps/systemd-utils/ and compiled systemd-utils with the USE flag "boot". After doing "bootctl --esp-path=/boot/efi install" if went well, just had to do a "emerge --config sys-kernel/gentoo-kernel-bin" for getting the whole configs running. It booted without problems afterwards. I see this as a great breakthrough for the following Asahi Kernel Gentoo compatibility. Greetings, Stuart Created attachment 870325 [details, diff]
Patch to force off the bfd linker and gcc libs from systems-boot
Thanks for the testing. I at least (although I can't speak for floppym) don't feel comfortable dropping the check here though, given the long tail of bugs we've had here in the past and how brittle it is to build EFI binaries without a proper toolchain (systemd switched from one hack w/ gnu-efi to another one). The check seems to have been added around https://github.com/systemd/systemd/issues/19005 and https://github.com/systemd/systemd/pull/19037, although the systemd-boot machinery got rewritten a lot since then. In any case, please file a bug upstream and work with them on allowing LLD if you can identify which changes allow it to now work (presumably LLD gained some support) or perhaps some flags need to be passed with LLD. |