x86/darwin: two extra fixes to placate build warnings
cover x86/darwin: two extra fixes to placate build warnings
Hello,
Following two patches fix the remaining two warnings seen on the x86 Darwin build of Xen.
Thanks, Roger.
Roger Pau Monne (2):
xen/x86: fix usage of [[:blank:]] with BSD grep
xen: add non-executable stack note uniformly
xen/Makefile | 2 +- xen/arch/x86/arch.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.51.0
PATCH 1/2 xen/x86: fix usage of [[:blank:]] with BSD grep
BSD grep only recognizes [[:blank:]] as a valid expression when using extended (modern) regular expressions. Pass -E to the grep call used in efi-nr-fixups.
Additionally, the return from wc -l is space padded on BSD, and hence
the content of efi-nr-fixups is " 2", not plain "2". Strip the
spaces in the Makefile using $(strip ...).
--- xen/arch/x86/arch.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/arch.mk +1 -1
@@ -100,7 +100,7 @@ endif ifeq ($(XEN_BUILD_PE),y) # Check if the linker produces fixups in PE by default -efi-nr-fixups := $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l) +efi-nr-fixups := $(strip $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep -E '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)) ifeq ($(efi-nr-fixups),2) MKRELOC := :
Signature · 1 line
2.51.0
PATCH 2/2 xen: add non-executable stack note uniformly
In reply to Roger Pau MonneCurrently the -Wa,--noexecstack parameter is only passed to the compiler when building assembly files, as the assembler doesn't add such note for stack attributes.
However, the default addition of the .note.GNU-stack section is dependent on the ELF target used. Adjust the passing of -Wa,--noexecstack so it's added to CFLAGS instead of AFLAGS, and hence such section is also added to object files generated from .c sources. This fixes the complains from the linker about missing .note.GNU-stack section when building x86-64 Xen on Darwin platforms.
Note we could instead pass -z noexecstack to the linker, but that however would mask any possible errors or unintended mismatches from previous steps.
--- xen/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/Makefile +1 -1
@@ -413,7 +413,7 @@ ifneq ($(CONFIG_CC_IS_CLANG),y) CFLAGS += -Wa,--strip-local-absolute endif -$(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack) +$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--noexecstack) LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments
Signature · 1 line
2.51.0
Quoted 10 lines · Roger Pau Monne
Hello,
Following two patches fix the remaining two warnings seen on the x86 Darwin build of Xen.
Thanks, Roger.
Roger Pau Monne (2):
xen/x86: fix usage of [[:blank:]] with BSD grep
xen: add non-executable stack note uniformly