tests/tcg: Fix new cross-compiler warnings
cover tests/tcg: Fix new cross-compiler warnings
Recent updates to debian cross-compilers have enabled some new warnings by default, which encourage good behaviour for userland binaries.
Neither are applicable for our system mode kernel images, but we do have a few userland tests that are affected.
The --noexecstack assembler flag takes care of adding the appropriate .note.GNU-stack elf note for us, rather than writing a dozen lines of assembly template, and so is a true fix rather than merely disabling the linker warning.
r~
Richard Henderson (2):
tests/tcg: Use --noexecstack with assembler files tests/tcg/loongarch64: Use --no-warn-rwx-segments to link system tests
tests/tcg/Makefile.target | 2 +- tests/tcg/aarch64/Makefile.softmmu-target | 2 +- tests/tcg/alpha/Makefile.softmmu-target | 2 +- tests/tcg/arm/Makefile.softmmu-target | 2 +- tests/tcg/arm/Makefile.target | 2 +- tests/tcg/i386/Makefile.softmmu-target | 2 +- tests/tcg/loongarch64/Makefile.softmmu-target | 4 ++-- tests/tcg/riscv64/Makefile.softmmu-target | 2 +- tests/tcg/s390x/Makefile.softmmu-target | 2 +- tests/tcg/x86_64/Makefile.softmmu-target | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 tests/tcg: Use --noexecstack with assembler files
Add the --noexecstack assembler command-line option to avoid:
/usr/bin/ld: warning: boot.o: missing .note.GNU-stack section implies executable stack /usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
which is enabled by default with current debian cross toolchains.
--- tests/tcg/Makefile.target | 2 +- tests/tcg/aarch64/Makefile.softmmu-target | 2 +- tests/tcg/alpha/Makefile.softmmu-target | 2 +- tests/tcg/arm/Makefile.softmmu-target | 2 +- tests/tcg/arm/Makefile.target | 2 +- tests/tcg/i386/Makefile.softmmu-target | 2 +- tests/tcg/loongarch64/Makefile.softmmu-target | 2 +- tests/tcg/riscv64/Makefile.softmmu-target | 2 +- tests/tcg/s390x/Makefile.softmmu-target | 2 +- tests/tcg/x86_64/Makefile.softmmu-target | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-)
tests/tcg/Makefile.target +1 -1
@@ -115,7 +115,7 @@ endif %: %.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) %: %.S - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -Wa,--noexecstack $< -o $@ $(LDFLAGS) else # For system targets we include a different Makefile fragment as the # build options for bare programs are usually pretty different. They
tests/tcg/aarch64/Makefile.softmmu-target +1 -1
@@ -28,7 +28,7 @@ config-cc.mak: Makefile .PRECIOUS: $(CRT_OBJS) %.o: $(CRT_PATH)/%.S - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -Wa,--noexecstack -c $< -o $@ # Build and link the tests %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
tests/tcg/alpha/Makefile.softmmu-target +1 -1
@@ -22,7 +22,7 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc .PRECIOUS: $(CRT_OBJS) %.o: $(CRT_PATH)/%.S - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -Wa,--noexecstack -c $< -o $@ # Build and link the tests %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
tests/tcg/arm/Makefile.softmmu-target +1 -1
@@ -36,7 +36,7 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc .PRECIOUS: $(CRT_OBJS) %.o: $(ARM_SRC)/%.S - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -Wa,--noexecstack -c $< -o $@ # Build and link the tests %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
tests/tcg/arm/Makefile.target +1 -1
@@ -25,7 +25,7 @@ ARM_TESTS += test-arm-iwmmxt # Clang assembler does not support IWMXT, so use the external assembler. test-arm-iwmmxt: CFLAGS += -marm -march=iwmmxt -mabi=aapcs -mfpu=fpv4-sp-d16 $(CROSS_CC_HAS_FNIA) test-arm-iwmmxt: test-arm-iwmmxt.S - $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) -Wa,--noexecstack $< -o $@ $(LDFLAGS) # Float-convert Tests ARM_TESTS += fcvt
tests/tcg/i386/Makefile.softmmu-target +1 -1
@@ -25,7 +25,7 @@ EXTRA_RUNS+=$(MULTIARCH_RUNS) .PRECIOUS: $(CRT_OBJS) %.o: $(CRT_PATH)/%.S - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -Wa,--noexecstack -c $< -o $@ # Build and link the tests %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
tests/tcg/loongarch64/Makefile.softmmu-target +1 -1
@@ -22,7 +22,7 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc .PRECIOUS: $(CRT_OBJS) %.o: $(CRT_PATH)/%.S - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -Wa,--noexecstack -c $< -o $@ # Build and link the tests %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
tests/tcg/riscv64/Makefile.softmmu-target +1 -1
@@ -10,7 +10,7 @@ LDFLAGS = -T $(LINK_SCRIPT) CFLAGS += -g -Og %.o: %.S - $(CC) $(CFLAGS) $< -c -o $@ + $(CC) $(CFLAGS) $< -Wa,--noexecstack -c -o $@ %: %.o $(LINK_SCRIPT) $(LD) $(LDFLAGS) $< -o $@
tests/tcg/s390x/Makefile.softmmu-target +1 -1
@@ -6,7 +6,7 @@ CFLAGS+=-ggdb -O0 LDFLAGS=-nostdlib -static %.o: %.S - $(CC) -march=z13 -m64 -c $< -o $@ + $(CC) -march=z13 -m64 -Wa,--noexecstack -c $< -o $@ %.o: %.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -march=z13 -m64 -c $< -o $@
tests/tcg/x86_64/Makefile.softmmu-target +1 -1
@@ -25,7 +25,7 @@ EXTRA_RUNS+=$(MULTIARCH_RUNS) .PRECIOUS: $(CRT_OBJS) %.o: $(CRT_PATH)/%.S - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -Wa,--noexecstack -c $< -o $@ # Build and link the tests %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
Signature · 1 line
2.43.0
Re: [PATCH 1/2] tests/tcg: Use --noexecstack with assembler files
Quoted 8 lines · Richard Henderson
Add the --noexecstack assembler command-line option to avoid:
/usr/bin/ld: warning: boot.o: missing .note.GNU-stack section implies executable stack/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linkerwhich is enabled by default with current debian cross toolchains.
Signed-off-by Richard Henderson <[email protected]>
Quoted 12 lines
--- tests/tcg/Makefile.target | 2 +- tests/tcg/aarch64/Makefile.softmmu-target | 2 +- tests/tcg/alpha/Makefile.softmmu-target | 2 +- tests/tcg/arm/Makefile.softmmu-target | 2 +- tests/tcg/arm/Makefile.target | 2 +- tests/tcg/i386/Makefile.softmmu-target | 2 +- tests/tcg/loongarch64/Makefile.softmmu-target | 2 +- tests/tcg/riscv64/Makefile.softmmu-target | 2 +- tests/tcg/s390x/Makefile.softmmu-target | 2 +- tests/tcg/x86_64/Makefile.softmmu-target | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-)
PATCH 2/2 tests/tcg/loongarch64: Use --no-warn-rwx-segments to link system tests
In reply to Richard HendersonRecent debian cross-linker for loongarch issues
ld: warning: hello has a LOAD segment with RWX permissions
This is partially related to tests/tcg/loongarch64/system/kernel.ld, but is not fixed by explicitly adding a single LOAD PHDR. Disable the warning, since it does not apply to kernel images.
--- tests/tcg/loongarch64/Makefile.softmmu-target | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/tcg/loongarch64/Makefile.softmmu-target +1 -1
@@ -16,7 +16,7 @@ LINK_SCRIPT=$(LOONGARCH64_SYSTEM_SRC)/kernel.ld LDFLAGS=-Wl,-T$(LINK_SCRIPT) TESTS+=$(LOONGARCH64_TESTS) $(MULTIARCH_TESTS) CFLAGS+=-nostdlib -g -O1 -march=loongarch64 -mabi=lp64d $(MINILIB_INC) -LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc +LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc -Wl,--no-warn-rwx-segments # building head blobs .PRECIOUS: $(CRT_OBJS)
Signature · 1 line
2.43.0
Alex Bennée
AppliedQuoted 11 lines · Richard Henderson
Recent updates to debian cross-compilers have enabled some new warnings by default, which encourage good behaviour for userland binaries.
Neither are applicable for our system mode kernel images, but we do have a few userland tests that are affected.
The --noexecstack assembler flag takes care of adding the appropriate .note.GNU-stack elf note for us, rather than writing a dozen lines of assembly template, and so is a true fix rather than merely disabling the linker warning.
Queued to maintainer/for-9.1, thanks.
Quoted 1 line
10 files changed, 11 insertions(+), 11 deletions(-)
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Alex Bennée
AppliedQuoted 11 lines · Richard Henderson
Recent updates to debian cross-compilers have enabled some new warnings by default, which encourage good behaviour for userland binaries.
Neither are applicable for our system mode kernel images, but we do have a few userland tests that are affected.
The --noexecstack assembler flag takes care of adding the appropriate .note.GNU-stack elf note for us, rather than writing a dozen lines of assembly template, and so is a true fix rather than merely disabling the linker warning.
Queued to maintainer/for-9.1, thanks.
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro