Skip to content

systemd-boot fails to build on binutils-2.39 due to -Wl,--fatal-warnings #24226

@trofi

Description

@trofi

systemd version the issue has been seen with

251.3

Used distribution

NixOS-22.05

Linux kernel version used

5.19.0

CPU architectures issue was seen on

No response

Component

No response

Expected behaviour you didn't see

systemd-boot should build successfully against binutils-2.39

Unexpected behaviour you saw

systemd-boot fails to build on binutils-2.39

Steps to reproduce the problem

Install binutils-2.39, try to build systemd.

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

Snippet of build failure log:


FAILED: src/boot/efi/systemd-bootia32.elf
/<<NIX>>/gcc-wrapper-13.0.0/bin/gcc -o src/boot/efi/systemd-bootia32.elf -Wno-format-signedness -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wno-unused-result -fno-stack-protector -fno-strict-aliasing -fpic -fwide-exec-charset=UCS2 -Wall -Wextra -Wsign-compare -nostdlib -std=gnu11 -ffreestanding -fshort-wchar -fvisibility=hidden -isystem /<<NIX>>/gnu-efi-3.0.14/include/efi -isystem /<<NIX>>/gnu-efi-3.0.14/include/efi/ia32 -I /build/source/src/fundamental -DSD_BOOT -DGNU_EFI_USE_MS_ABI -include src/boot/efi/efi_config.h -include version.h -mno-sse -mno-mmx -fuse-ld=bfd -L /<<NIX>>/gnu-efi-3.0.14/lib -nostdlib -T /<<NIX>>/gnu-efi-3.0.14/lib/elf_ia32_efi.lds -Wl,--build-id=sha1 -Wl,--fatal-warnings -Wl,--no-undefined -Wl,--warn-common -Wl,-Bsymbolic -z nocombreloc /<<NIX>>/gnu-efi-3.0.14/lib/crt0-efi-ia32.o -pie -Wl,--no-dynamic-linker src/boot/efi/bootspec-fundamental.c.o src/boot/efi/efivars-fundamental.c.o src/boot/efi/sha256.c.o src/boot/efi/string-util-fundamental.c.o src/boot/efi/assert.c.o src/boot/efi/devicetree.c.o src/boot/efi/disk.c.o src/boot/efi/graphics.c.o src/boot/efi/measure.c.o src/boot/efi/pe.c.o src/boot/efi/secure-boot.c.o src/boot/efi/ticks.c.o src/boot/efi/util.c.o src/boot/efi/boot.c.o src/boot/efi/console.c.o src/boot/efi/drivers.c.o src/boot/efi/random-seed.c.o src/boot/efi/shim.c.o src/boot/efi/xbootldr.c.o src/boot/efi/bcd.c.o -lefi -lgnuefi -lgcc
/<<NIX>>/binutils-2.39/bin/ld.bfd: warning: /<<NIX>>/gnu-efi-3.0.14/lib/crt0-efi-ia32.o: missing .note.GNU-stack section implies executable stack
/<<NIX>>/binutils-2.39/bin/ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker

Why it happens:

binutils-2.39 enabed a few warning by default (https://sourceware.org/pipermail/binutils/2022-August/122246.html):

The ELF linker will now generate a warning message if the stack is made executable.

gnu-efi explicitly strips all EFI-unrelated sections via linker script: https://sourceforge.net/p/gnu-efi/code/ci/master/tree/gnuefi/elf_x86_64_efi.lds

  .ignored.reloc :
  {
    *(.rela.reloc)
    *(.eh_frame)
    *(.note.GNU-stack)
  }

systemd probably sets -Wl,--fatal-warnings at https://github.com/systemd/systemd/blob/main/src/boot/efi/meson.build#L255

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Programming errors, that need preferential fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions