build: Work around GCC issue where -static-pie does not seem to work with -elf cross compilers

This commit is contained in:
mintsuki 2021-05-03 01:08:31 +02:00
parent b7e98a9e4c
commit b401d07f8f

View File

@ -71,6 +71,12 @@ ifeq ($(TARGET), bios)
endif
ifeq ($(TARGET), uefi)
INTERNAL_CFLAGS32 := \
$(INTERNAL_CFLAGS) \
-m32 \
-march=i386 \
-fpie
INTERNAL_CFLAGS += \
-m64 \
-march=x86-64 \
@ -78,12 +84,6 @@ ifeq ($(TARGET), uefi)
-I../gnu-efi/inc/x86_64 \
-fpie \
-mno-red-zone
INTERNAL_CFLAGS32 := \
$(INTERNAL_CFLAGS) \
-m32 \
-march=i386 \
-fpie
endif
LDFLAGS = -O3 -g
@ -98,19 +98,23 @@ ifeq ($(TARGET), bios)
INTERNAL_LDFLAGS += \
-m32 \
-march=i386 \
-fno-pie \
-Wl,-melf_i386 \
-static \
-no-pie \
-fno-pie
-no-pie
endif
ifeq ($(TARGET), uefi)
INTERNAL_LDFLAGS += \
-m64 \
-march=x86-64 \
-fpie \
-Wl,-melf_x86_64 \
-static-pie \
-fpie
-Wl,-static \
-Wl,-pie \
-Wl,--no-dynamic-linker \
-z text \
-static-pie
endif
.PHONY: all clean builddir