1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/makefiles/libc/picolibc.mk
Marian Buschsieweke c9f16f1194
build sytem: add --no-warn-rwx-segments to linker
Before we disabled the warning about RWX segments only for picolibc,
but this issue is popping up on more and more toolchains (looking
at MSP430 and RISC-V). Other than on `native`/`native64`, there is no
MMU to enforce whatever permissions the segments contain anyway.
(And writing to ROM with regular store instructions will not be possible
even without the need for an MMU.)

So let's just globally disable this warning, unless building for
`native` and `native64`.
2024-02-12 20:55:58 +01:00

33 lines
1.2 KiB
Makefile

ifneq (,$(filter picolibc,$(USEMODULE)))
# Test if picolibc.specs is available
ifeq ($(shell $(LINK) -specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
USE_PICOLIBC = 1
ifeq (LC_ALL=C $(LINK) $(RIOTTOOLS)/testprogs/minimal_linkable.c -o /dev/null -lc -specs=picolibc.specs -Wall -Wextra -pedantic 2>&1 | grep -q "use of wchar_t values across objects may fail" ; echo $$?),0)
CFLAGS += -fshort-wchar
LINKFLAGS += -Wl,--no-wchar-size-warning
endif
else
BUILDDEPS += _missing-picolibc
endif
endif
.PHONY: _missing-picolibc
_missing-picolibc:
@$(Q)echo "picolibc was selected to be build but no picolibc.specs could be found"
@$(Q)echo "you might want to install "picolibc" for "$(TARGET_ARCH)""
@$(Q)echo "or add "FEATURES_BLACKLIST += picolibc" to Makefile)"
@$(COLOR_ECHO) "$(COLOR_RED)check your installation or build configuration.$(COLOR_RESET)"
@$(Q)exit 1
ifeq (1,$(USE_PICOLIBC))
LINKFLAGS += -specs=picolibc.specs
CFLAGS += -specs=picolibc.specs
ifeq (,$(filter printf_float scanf_float,$(USEMODULE)))
CFLAGS += -DPICOLIBC_INTEGER_PRINTF_SCANF
LINKFLAGS += -DPICOLIBC_INTEGER_PRINTF_SCANF
endif
endif
LINKFLAGS += -lc