Explicitly tell the linker KUT doesn't need an executable stack to suppress gcc-12 warnings about the default behavior of having an executable stack being deprecated. The entire thing is irrelevant for KUT (and other freestanding environments) as KUT creates its own stacks, i.e. there's no loader/libc that consumes the magic ".note.GNU-stack" section. ld -nostdlib -m elf_x86_64 -T /home/seanjc/go/src/kernel.org/kvm-unit-tests/x86/flat.lds -o x86/vmx.elf x86/vmx.o x86/cstart64.o x86/access.o x86/vmx_tests.o lib/libcflat.a ld: warning: setjmp64.o: missing .note.GNU-stack section implies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker Link: https://lkml.kernel.org/r/ZC7%2Bc42p2IRWtHfT%40google.com Cc: Thomas Huth <thuth@xxxxxxxxxx> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> --- x86/Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86/Makefile.common b/x86/Makefile.common index 365e199f..c57d418a 100644 --- a/x86/Makefile.common +++ b/x86/Makefile.common @@ -62,7 +62,7 @@ else # We want to keep intermediate file: %.elf and %.o .PRECIOUS: %.elf %.o -%.elf: LDFLAGS = -nostdlib $(arch_LDFLAGS) +%.elf: LDFLAGS = -nostdlib $(arch_LDFLAGS) -z noexecstack %.elf: %.o $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o) $(LD) $(LDFLAGS) -T $(SRCDIR)/x86/flat.lds -o $@ \ $(filter %.o, $^) $(FLATLIBS) base-commit: 4ba7058c61e8922f9c8397cfa1095fac325f809b -- 2.40.0.577.gac1e443424-goog