1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00

makefiles/libc/picolibc.mk: fix compilation with modern binutils

Modern binutils complain about segments with RWX permissions. While
this is indeed a bad habit, RIOT ignores segments permissions anyway.
(We do have a `mpu_noexec_ram` module to disable execution of all of
RAM, which would do so regardless of the segment permission.) So for
now, we can safely just disable the warning.

This fixes:

    /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: warning: /home/maribu/Repos/software/RIOT/examples/default/bin/nucleo-f767zi/default.elf has a LOAD segment with RWX permissions
    collect2: error: ld returned 1 exit status
This commit is contained in:
Marian Buschsieweke 2022-11-11 23:37:09 +01:00
parent 4e00c0e360
commit c0e997a8e7
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94

View File

@ -27,6 +27,14 @@ ifeq (1,$(USE_PICOLIBC))
CFLAGS += -DPICOLIBC_INTEGER_PRINTF_SCANF
LINKFLAGS += -DPICOLIBC_INTEGER_PRINTF_SCANF
endif
# For some reason segments with RWX permissions will be created with
# picolibc. But since (as of now) RIOT only supports disabling the execute of
# all RAM via the `mpu_noexec_ram` module, permissions of the segments are
# ignored anyway. So for now, we just simply disable the warning.
LINKER_SUPPORTS_NOWARNRWX ?= $(shell echo "int main(){} void _exit(int n) {(void)n;while(1);}" | LC_ALL=C $(LINK) -xc - -o /dev/null -lc -Wall -Wextra -pedantic -Wl,--no-warn-rwx-segments 2> /dev/null && echo 1 || echo 0)
ifeq (1,$(LINKER_SUPPORTS_NOWARNRWX))
LINKFLAGS += -Wl,--no-warn-rwx-segments
endif
endif
LINKFLAGS += -lc