Skip to contentSkip to conversation

build/x86: suppress GNU ld 2.39 warning about RWX load segments

PATCH In review Jan Beulich 2 participants 2 messages Aug 11, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build/x86: suppress GNU ld 2.39 warning about RWX load segments

Commit 68f5aac012b9 ("build: suppress future GNU ld warning about RWX load segments") didn't quite cover all the cases: Apparently I missed ones in the building of 32-bit helper objects because of only looking at incremental builds (where those wouldn't normally be re-built). Clone the workaround there to the specific Makefile in question.

---
Because of the use of LDFLAGS_DIRECT (coming directly from the Config.mk helpers in config/) having a central place to set this once isn't very
easy: An option might be to introduce XEN_LDFLAGS_DIRECT and export that from where the other XEN_*FLAGS are also exported. The way it's done here is the less intrusive variant, though.

xen/arch/x86/boot/Makefile +3 -0
@@ -24,6 +24,9 @@ CFLAGS_x86_32 += -I$(srctree)/include
 $(head-srcs:.S=.o): CFLAGS_stack_boundary :=
 $(head-srcs:.S=.o): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
 
+LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
+LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
+
 $(head-srcs): %.S: %.bin
 	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
 	sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jan Beulich

Commit 68f5aac012b9 ("build: suppress future GNU ld warning about RWX load segments") didn't quite cover all the cases: Apparently I missed ones in the building of 32-bit helper objects because of only looking at incremental builds (where those wouldn't normally be re-built). Clone the workaround there to the specific Makefile in question.

Quoted 6 lines

---
Because of the use of LDFLAGS_DIRECT (coming directly from the Config.mk helpers in config/) having a central place to set this once isn't very
easy: An option might be to introduce XEN_LDFLAGS_DIRECT and export that from where the other XEN_*FLAGS are also exported. The way it's done here is the less intrusive variant, though.

I think this is good enough for now.  This makefile is full of magic anyway.