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

chibios: disable RWX segment warning on newer GNU lds #22007

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions builddefs/common_rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))))))
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions platforms/avr/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature
EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT)
BIN =

ifeq ("$(shell echo "int main(){}" | $(CC) --param=min-pagesize=0 -x c - -o /dev/null 2>&1)", "")
COMPILEFLAGS += --param=min-pagesize=0
endif
COMPILEFLAGS += $(call cc-option, --param=min-pagesize=0)

COMPILEFLAGS += -funsigned-char
COMPILEFLAGS += -funsigned-bitfields
Expand Down
3 changes: 3 additions & 0 deletions platforms/chibios/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ HEX = $(OBJCOPY) -O $(FORMAT)
EEP =
BIN = $(OBJCOPY) -O binary

# disable warning about RWX triggered by ChibiOS linker scripts
SHARED_LDFLAGS += $(call cc-option, -Wl$(,)--no-warn-rwx-segments)

##############################################################################
# Make targets
#
Expand Down