* [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings
@ 2022-09-29 10:03 Jan Beulich
2022-09-29 10:04 ` [PATCH 1/2][XTF] build: suppress GNU ld 2.39 warning about RWX load segments Jan Beulich
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jan Beulich @ 2022-09-29 10:03 UTC (permalink / raw)
To: Andrew Cooper; +Cc: xen-devel
Like done previously for the hypervisor and elsewhere.
1: suppress GNU ld 2.39 warning about RWX load segments
2: silence GNU ld 2.39 warning about executable stacks
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2][XTF] build: suppress GNU ld 2.39 warning about RWX load segments
2022-09-29 10:03 [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings Jan Beulich
@ 2022-09-29 10:04 ` Jan Beulich
2022-09-29 10:04 ` [PATCH 2/2][XTF] build: silence GNU ld 2.39 warning about executable stacks Jan Beulich
2022-10-03 13:44 ` [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings Andrew Cooper
2 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2022-09-29 10:04 UTC (permalink / raw)
To: Andrew Cooper; +Cc: xen-devel
We cannot really avoid such and we're also not really at risk because of
them, as we control page table permissions ourselves rather than relying
on a loader of some sort.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/build/common.mk
+++ b/build/common.mk
@@ -20,9 +20,15 @@ COMMON_FLAGS := -pipe -I$(ROOT)/include
cc-option = $(shell if [ -z "`echo 'int p=1;' | $(CC) $(1) -S -o /dev/null -x c - 2>&1`" ]; \
then echo y; else echo n; fi)
+ld-option = $(shell if $(LD) -v $(1) >/dev/null 2>&1; then echo y; else echo n; fi)
+
# Disable PIE, but need to check if compiler supports it
COMMON_CFLAGS-$(call cc-option,-no-pie) += -no-pie
+# Suppress warnings about LOAD segments with RWX permissions, as what we build
+# aren't normal user-mode executables.
+LDFLAGS-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
+
COMMON_AFLAGS := $(COMMON_FLAGS) -D__ASSEMBLY__
COMMON_CFLAGS := $(COMMON_FLAGS) $(COMMON_CFLAGS-y)
COMMON_CFLAGS += -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2][XTF] build: silence GNU ld 2.39 warning about executable stacks
2022-09-29 10:03 [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings Jan Beulich
2022-09-29 10:04 ` [PATCH 1/2][XTF] build: suppress GNU ld 2.39 warning about RWX load segments Jan Beulich
@ 2022-09-29 10:04 ` Jan Beulich
2022-10-03 13:44 ` [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings Andrew Cooper
2 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2022-09-29 10:04 UTC (permalink / raw)
To: Andrew Cooper; +Cc: xen-devel
While for C files the compiler is supposed to arrange for emitting
respective information, for assembly sources we're responsible ourselves.
For the new use of cc-option to work we cannot pass -S to the compiler
anymore. We need the compiler to actually invoke the assembler, so switch
to using -c.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/build/common.mk
+++ b/build/common.mk
@@ -15,9 +15,11 @@ $(foreach env,$(HVM_ENVIRONMENTS),$(eval
$(foreach env,$(32BIT_ENVIRONMENTS),$(eval $(env)_arch := x86_32))
$(foreach env,$(64BIT_ENVIRONMENTS),$(eval $(env)_arch := x86_64))
+comma := ,
+
COMMON_FLAGS := -pipe -I$(ROOT)/include -I$(ROOT)/arch/x86/include -MMD -MP
-cc-option = $(shell if [ -z "`echo 'int p=1;' | $(CC) $(1) -S -o /dev/null -x c - 2>&1`" ]; \
+cc-option = $(shell if [ -z "`echo 'int p=1;' | $(CC) $(1) -c -o /dev/null -x c - 2>&1`" ]; \
then echo y; else echo n; fi)
ld-option = $(shell if $(LD) -v $(1) >/dev/null 2>&1; then echo y; else echo n; fi)
@@ -25,11 +27,15 @@ ld-option = $(shell if $(LD) -v $(1) >/d
# Disable PIE, but need to check if compiler supports it
COMMON_CFLAGS-$(call cc-option,-no-pie) += -no-pie
+# Arrange for assembly files to have a proper .note.GNU-stack section added,
+# to silence warnings otherwise issued by GNU ld 2.39 and newer.
+COMMON_AFLAGS-$(call cc-option,-Wa$(comma)--noexecstack) += -Wa,--noexecstack
+
# Suppress warnings about LOAD segments with RWX permissions, as what we build
# aren't normal user-mode executables.
LDFLAGS-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
-COMMON_AFLAGS := $(COMMON_FLAGS) -D__ASSEMBLY__
+COMMON_AFLAGS := $(COMMON_FLAGS) -D__ASSEMBLY__ $(COMMON_AFLAGS-y)
COMMON_CFLAGS := $(COMMON_FLAGS) $(COMMON_CFLAGS-y)
COMMON_CFLAGS += -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g
COMMON_CFLAGS += -fno-common -fno-asynchronous-unwind-tables -fno-strict-aliasing
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings
2022-09-29 10:03 [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings Jan Beulich
2022-09-29 10:04 ` [PATCH 1/2][XTF] build: suppress GNU ld 2.39 warning about RWX load segments Jan Beulich
2022-09-29 10:04 ` [PATCH 2/2][XTF] build: silence GNU ld 2.39 warning about executable stacks Jan Beulich
@ 2022-10-03 13:44 ` Andrew Cooper
2022-10-04 7:01 ` Jan Beulich
2 siblings, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2022-10-03 13:44 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel
On 29/09/2022 11:03, Jan Beulich wrote:
> Like done previously for the hypervisor and elsewhere.
>
> 1: suppress GNU ld 2.39 warning about RWX load segments
> 2: silence GNU ld 2.39 warning about executable stacks
I've taken these, and dropped the `-no-pie`, but there's something else too.
$readelf -Wa tests/example/test-hvm64-example
...
No version information found in this file.
Displaying notes found in: .note
Owner Data size Description
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
Properties: x86 feature used: x86, <corrupt type (0) datasz: 0xc0010002>
readelf: Warning: note with invalid namesz and/or descsz found at offset
0x30
readelf: Warning: type: 0x12, namesize: 0x00000004, descsize:
0x00000004, alignment: 8
It's only hvm64 which reads as corrupt, so I think there's some
collateral damage with the conversion between ELF64 and ELF32.
~Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings
2022-10-03 13:44 ` [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings Andrew Cooper
@ 2022-10-04 7:01 ` Jan Beulich
0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2022-10-04 7:01 UTC (permalink / raw)
To: Andrew Cooper; +Cc: xen-devel
On 03.10.2022 15:44, Andrew Cooper wrote:
> On 29/09/2022 11:03, Jan Beulich wrote:
>> Like done previously for the hypervisor and elsewhere.
>>
>> 1: suppress GNU ld 2.39 warning about RWX load segments
>> 2: silence GNU ld 2.39 warning about executable stacks
>
> I've taken these, and dropped the `-no-pie`, but there's something else too.
>
> $readelf -Wa tests/example/test-hvm64-example
> ...
>
> No version information found in this file.
>
> Displaying notes found in: .note
> Owner Data size Description
> GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
> Properties: x86 feature used: x86, <corrupt type (0) datasz: 0xc0010002>
>
> readelf: Warning: note with invalid namesz and/or descsz found at offset
> 0x30
> readelf: Warning: type: 0x12, namesize: 0x00000004, descsize:
> 0x00000004, alignment: 8
>
>
> It's only hvm64 which reads as corrupt, so I think there's some
> collateral damage with the conversion between ELF64 and ELF32.
Iirc there was a binary-incompatible change (accompanying an
incompatible change to the ELF spec) to how notes are generated /
processed for 64-bit objects (some hand waving involved here, as
this did happen quite a while back). I assume the .note section(s)
will need converting (to insert / remove padding) in the course of
converting between ELF32 and ELF64.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-04 7:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29 10:03 [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings Jan Beulich
2022-09-29 10:04 ` [PATCH 1/2][XTF] build: suppress GNU ld 2.39 warning about RWX load segments Jan Beulich
2022-09-29 10:04 ` [PATCH 2/2][XTF] build: silence GNU ld 2.39 warning about executable stacks Jan Beulich
2022-10-03 13:44 ` [PATCH 0/2][XTF] build: suppress GNU ld 2.39 warnings Andrew Cooper
2022-10-04 7:01 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.