[PATCH] hvmloader: suppress GNU ld 2.39 warning about RWX load segments

Jan Beulich posted 1 patch 2 weeks, 4 days ago
Failed in applying to current master (apply log)
[PATCH] hvmloader: suppress GNU ld 2.39 warning about RWX load segments
Posted by Jan Beulich 2 weeks, 4 days ago
This aspect is simply meaningless for this component.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -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 */" > $@.new
Re: [PATCH] hvmloader: suppress GNU ld 2.39 warning about RWX load segments
Posted by Andrew Cooper 2 weeks, 4 days ago
On 07/02/2024 2:03 pm, Jan Beulich wrote:
> This aspect is simply meaningless for this component.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

In principle Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>, but

>
> --- a/tools/firmware/hvmloader/Makefile
> +++ b/tools/firmware/hvmloader/Makefile
> @@ -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
Re: [PATCH] hvmloader: suppress GNU ld 2.39 warning about RWX load segments
Posted by Jan Beulich 2 weeks, 4 days ago
On 07.02.2024 15:31, Andrew Cooper wrote:
> On 07/02/2024 2:03 pm, Jan Beulich wrote:
>> This aspect is simply meaningless for this component.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> In principle Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>, but
> 
>>
>> --- a/tools/firmware/hvmloader/Makefile
>> +++ b/tools/firmware/hvmloader/Makefile
>> @@ -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.

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