diff options
author | Thomas Weißschuh <[email protected]> | 2023-11-13 23:29:12 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2023-11-13 22:29:12 +0000 |
commit | de3c42125b661f62757f8ee4f6184c089340d3a0 (patch) | |
tree | fbc0efa64628c2bee01e5d8f00661ff9a48fa546 /builddefs | |
parent | 970e0b18a2c6bb96783422533004ffefecddb476 (diff) | |
download | qmk_firmware-de3c42125b661f62757f8ee4f6184c089340d3a0.tar.gz qmk_firmware-de3c42125b661f62757f8ee4f6184c089340d3a0.zip |
chibios: disable RWX segment warning on newer GNU lds (#22007)
Diffstat (limited to 'builddefs')
-rw-r--r-- | builddefs/common_rules.mk | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/builddefs/common_rules.mk b/builddefs/common_rules.mk index 52dccbe475..ddd36409a7 100644 --- a/builddefs/common_rules.mk +++ b/builddefs/common_rules.mk @@ -15,6 +15,13 @@ VPATH := # Helper to return the distinct elements of a list uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))) +cc-option = $(shell \ + if $(CC) $(1) -shared -o /dev/null -xc /dev/null > /dev/null 2>&1; \ + then echo "$(1)"; else echo "$(2)"; fi) + +# helper to pass comma character to make functions +, := , + # Convert all SRC to OBJ define OBJ_FROM_SRC $(patsubst %.c,$1/%.o,$(patsubst %.cpp,$1/%.o,$(patsubst %.cc,$1/%.o,$(patsubst %.S,$1/%.o,$(patsubst %.clib,$1/%.a,$($1_SRC)))))) @@ -66,9 +73,7 @@ CFLAGS += $(CDEFS) CFLAGS += -O$(OPT) # add color ifeq ($(COLOR),true) -ifeq ("$(shell echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "") - CFLAGS+= -fdiagnostics-color -endif + CFLAGS+= $(call cc-option, -fdiagnostics-color) endif CFLAGS += -Wall CFLAGS += -Wstrict-prototypes |