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

Build fails with LDFLAGS=-fuse-ld=mold and binutils 2.39 #24241

Closed
jpalus opened this issue Aug 8, 2022 · 1 comment · Fixed by #24253
Closed

Build fails with LDFLAGS=-fuse-ld=mold and binutils 2.39 #24241

jpalus opened this issue Aug 8, 2022 · 1 comment · Fixed by #24253
Labels
bug 🐛 Programming errors, that need preferential fixing meson sd-boot/sd-stub/bootctl

Comments

@jpalus
Copy link
Contributor

jpalus commented Aug 8, 2022

systemd version the issue has been seen with

251.4

Used distribution

PLD 3.0

Linux kernel version used

5.19.0

CPU architectures issue was seen on

aarch64

Component

other

Expected behaviour you didn't see

systemd builds successfully.

Unexpected behaviour you saw

Build fails with:

/usr/bin/ld.bfd: warning: src/boot/efi/systemd-bootaa64.elf has a LOAD segment with RWX permissions
collect2: error: ld returned 1 exit status

Fix for binutils 2.39 was already provided in #23996 however the issue with the fix is that it assumes default cc linker is the same as linker used for efi stub. That may not be true though -- for the most parts of systemd I'm using mold linker, while efi stub forces bfd in efi_ldflags:

efi_ldflags = [
'-fuse-ld=' + efi_ld,

Test for --no-warn-rwx-segments does not take efi_ldflags into account though:

possible_link_flags = [
'-Wl,--no-warn-execstack',
'-Wl,--no-warn-rwx-segments',
]
efi_ldflags += cc.get_supported_link_arguments(possible_link_flags)

and tests mold instead. In the end bfd fails linking because mold does not support --no-warn-rwx-segments.

Steps to reproduce the problem

Build systemd with LDFLAGS="-fuse-ld=mold" on a system that supports efi stub and has binutils 2.39 installed

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

No response

@jpalus jpalus added the bug 🐛 Programming errors, that need preferential fixing label Aug 8, 2022
@medhefgo
Copy link
Contributor

medhefgo commented Aug 8, 2022

You should be able to work around this with "-Defi-cflags=['-Wl,--no-warn-execstack','-Wl,--no-warn-rwx-segments']".

pld-gitsync pushed a commit to pld-linux/systemd that referenced this issue Sep 14, 2022
issue occurs if linker different than bfd is used but binutils 2.39 is
present

see systemd/systemd#24241
bluca pushed a commit to bluca/systemd that referenced this issue Jan 27, 2023
Fixes: systemd#24241
(cherry picked from commit 6a941db)
Closes systemd/systemd-stable#216
(cherry picked from commit b3dd66f)
valentindavid pushed a commit to valentindavid/systemd that referenced this issue Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Programming errors, that need preferential fixing meson sd-boot/sd-stub/bootctl
Development

Successfully merging a pull request may close this issue.

2 participants