Re: [kvm-unit-tests PATCH] x86: Link with "-z noexecstack" to suppress irrelevant linker warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/04/2023 00.08, Sean Christopherson wrote:
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)

Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux