Skip to contentSkip to conversation

hvmloader: suppress GNU ld 2.39 warning about RWX load segments

PATCH In review Jan Beulich 2 participants 3 messages Feb 7, 2024

lore
Share & tools
lore
#0 lore raw

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

This aspect is simply meaningless for this component.

tools/firmware/hvmloader/Makefile +7 -1
@@ -20,6 +20,8 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
+ld-option = $(shell if $(LD) -v $(1) >/dev/null 2>&1; then echo y; else echo n; fi)
+
 # SMBIOS spec requires format mm/dd/yyyy
 SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y)
 
@@ -59,6 +61,10 @@ ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs
 ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM)
 endif
 
+# Suppress the warning about LOAD segments with RWX permissions, as what we
+# build isn't a normal user-mode executable.
+LDFLAGS-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
+
 .PHONY: all
 all: hvmloader
 
@@ -85,7 +91,7 @@ $(DSDT_FILES): acpi
 build.o: $(DSDT_FILES)
 
 hvmloader: $(OBJS) hvmloader.lds
-	$(LD) $(LDFLAGS_DIRECT) -N -T hvmloader.lds -o $@ $(OBJS)
+	$(LD) $(LDFLAGS_DIRECT) $(LDFLAGS-y) -N -T hvmloader.lds -o $@ $(OBJS)
 
 roms.inc: $(ROMS)
 	echo "/* Autogenerated file. DO NOT EDIT */" > [email protected]
#1 lore raw
Quoted 3 lines · Jan Beulich

This aspect is simply meaningless for this component.

In principle Acked-by: Andrew Cooper <[email protected]>, but

tools/firmware/hvmloader/Makefile line 23

Quoted 8 lines
tools/firmware/hvmloader/Makefile +1 -0
@@ -20,6 +20,8 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
+ld-option = $(shell if $(LD) -v $(1) >/dev/null 2>&1; then echo y; else echo n; fi)

The root config.mk has cc-option, and one opencoded ld-option for handling build-id's.

This ought to live there, and ideally clean up the opencoded use while at at.

~Andrew

#2 lore raw
Quoted 14 lines · Andrew Cooper
Quoted 3 lines · Jan Beulich

This aspect is simply meaningless for this component.

In principle Acked-by: Andrew Cooper <[email protected]>, but

Quoted 7 lines
tools/firmware/hvmloader/Makefile +0 -0
@@ -20,6 +20,8 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
Quoted 7 lines

tools/firmware/hvmloader/Makefile line 23

Quoted 1 line
tools/firmware/hvmloader/Makefile +1 -0
+ld-option = $(shell if $(LD) -v $(1) >/dev/null 2>&1; then echo y; else echo n; fi)

The root config.mk has cc-option, and one opencoded ld-option for handling build-id's.

This ought to live there, and ideally clean up the opencoded use while at at.

Well, that's what I first meant to do. But: xen/scripts/Kconfig.include has a different ld-option, and I didn't want to get into the business of having two fight each other.

Jan