Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd-boot clang-16: error: invalid linker name in argument '-fuse-ld=bfd' #29165

Closed
sm-moshi opened this issue Sep 11, 2023 · 3 comments
Closed
Labels
RFE 🎁 Request for Enhancement, i.e. a feature request sd-boot/sd-stub/bootctl

Comments

@sm-moshi
Copy link

sm-moshi commented Sep 11, 2023

systemd version the issue has been seen with

254.3

Used distribution

Gentoo

Linux kernel version used

6.4.14-gentoo-dist

CPU architectures issue was seen on

aarch64

Component

No response

Expected behaviour you didn't see

I wanted to compile the Gentoo package sys-apps/systemd-utils-254.3 with the USE-Flag boot which allows me to install systemd-boot aka. bootctl onto my openRC system. I'll attach our discussion on the Gentoo Bugs website also and attach our logs. https://bugs.gentoo.org/914008

The system looks like this:

  • MacBook Pro 14" M2 Pro 2023 running UTM as a front-end for QEMU 7.2
  • the VM is running the latest musl llvm profile from Gentoo, so no glibc is included
  • VM: 12 Threads, 14 GB RAM, 128GB /dev/vda containing boot, swap and ext4 as root
  • command to install: USE="boot" emerge sys-apps/systemd-utils

Greetings,
Stuart Meya

Unexpected behaviour you saw

When I compiled it with Clang 16.0.6 on aarch64-gentoo-linux-musl the following error appeared in the log:
clang-16: error: invalid linker name in argument '-fuse-ld=bfd'

Detailed:

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'

Steps to reproduce the problem

  • start a Gentoo install ISO (https://www.gentoo.org/downloads/)
  • go through the stage3 process picking a musl clang/llvm profile
  • try to install sys-apps/systemd-utils with the USE flag boot via:
  • cat "sys-apps/systemd-utils boot" >> /etc/portage/package.use/boot
  • emerge sys-apps/systemd-utils

Additional program output to the terminal or log subsystem illustrating the issue

emerge --info '=sys-apps/systemd-utils-254.3::gentoo': https://914008.bugs.gentoo.org/attachment.cgi?id=870320
emerge -pqv '=sys-apps/systemd-utils-254.3::gentoo': https://914008.bugs.gentoo.org/attachment.cgi?id=870321
/var/tmp/portage/sys-apps/systemd-utils-254.3/temp/build.log: https://914008.bugs.gentoo.org/attachment.cgi?id=870322

@sm-moshi sm-moshi added the bug 🐛 Programming errors, that need preferential fixing label Sep 11, 2023
@sm-moshi
Copy link
Author

@Fuchskaute (https://github.com/Fuchskaute) proposed a quick fix after some testing, but I and I also we from the Gentoo community do think this topic should be addressed with the rising Linux support in Apple Silicon. Hopefully, we can use systemd-boot on bare metal then.

The following would be the gentoo based quick patch:

disable_forced_bfd.patch

@medhefgo
Copy link
Contributor

We currently, do not support linking sd-boot without bfd, mostly because of llvm/llvm-project#61101.

@medhefgo medhefgo added sd-boot/sd-stub/bootctl RFE 🎁 Request for Enhancement, i.e. a feature request and removed bug 🐛 Programming errors, that need preferential fixing labels Sep 12, 2023
@sm-moshi sm-moshi changed the title system-boot clang-16: error: invalid linker name in argument '-fuse-ld=bfd' systemd-boot clang-16: error: invalid linker name in argument '-fuse-ld=bfd' Sep 12, 2023
@bluca bluca closed this as completed in 0b042d3 Sep 29, 2023
@medhefgo
Copy link
Contributor

medhefgo commented Sep 30, 2023

Btw, the proper way to not use libgcc is to pass --rtlib=compiler-rt or compiling clang with compiler-rt as default rtlib. Regardless, libgcc is still the correct name for linking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFE 🎁 Request for Enhancement, i.e. a feature request sd-boot/sd-stub/bootctl
Development

No branches or pull requests

2 participants