build: Prefer -static-pie to -shared for linking PIE executables
diff --git a/stage23/Makefile b/stage23/Makefile
index edce122e..58f588be 100644
--- a/stage23/Makefile
+++ b/stage23/Makefile
@@ -96,7 +96,7 @@ ifeq ($(TARGET), uefi)
-m64 \
-march=x86-64 \
-Wl,-melf_x86_64 \
- -shared \
+ -static-pie \
-Wl,-Bsymbolic \
-Wl,--noinhibit-exec \
-pie \
diff --git a/test/Makefile b/test/Makefile
index 87974731..9a2ad96d 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -3,7 +3,7 @@ CFLAGS = -O2
LD = cc
QEMU = qemu-system-x86_64
QEMUFLAGS = -m 1G -enable-kvm -cpu host
-LDINTERNALFLAGS := -Tlinker.ld -nostdlib -shared -pie -fno-pic -fpie -z max-page-size=0x1000
+LDINTERNALFLAGS := -Tlinker.ld -nostdlib -static-pie -fno-pic -fpie -z max-page-size=0x1000
INTERNALCFLAGS := -I../stivale -I. -ffreestanding -fno-stack-protector \
-fno-pic -fpie -fomit-frame-pointer -mno-red-zone -mno-80387 -mno-mmx -mno-3dnow -mno-sse \
-mno-sse2 -masm=intel
