build: Update linker and compiler flags
This commit is contained in:
parent
c528068ac7
commit
44df23c81a
|
@ -34,85 +34,83 @@ override S2CFLAGS := -Os
|
||||||
|
|
||||||
override CROSS_CFLAGS += \
|
override CROSS_CFLAGS += \
|
||||||
-g \
|
-g \
|
||||||
$(WERROR) \
|
|
||||||
-std=gnu11 \
|
-std=gnu11 \
|
||||||
|
-nostdinc \
|
||||||
-ffreestanding \
|
-ffreestanding \
|
||||||
-fno-stack-protector \
|
-fno-stack-protector \
|
||||||
-fno-stack-check \
|
-fno-stack-check \
|
||||||
-fno-omit-frame-pointer \
|
-fno-omit-frame-pointer \
|
||||||
-fno-strict-aliasing \
|
-fno-strict-aliasing \
|
||||||
-fno-lto \
|
-fno-lto \
|
||||||
-nostdinc \
|
|
||||||
-Wshadow \
|
-Wshadow \
|
||||||
-Wvla \
|
-Wvla \
|
||||||
|
$(WERROR) \
|
||||||
-MMD \
|
-MMD \
|
||||||
-DCOM_OUTPUT=$(COM_OUTPUT) \
|
-DCOM_OUTPUT=$(COM_OUTPUT) \
|
||||||
-DE9_OUTPUT=$(E9_OUTPUT) \
|
-DE9_OUTPUT=$(E9_OUTPUT) \
|
||||||
-I../freestanding-headers \
|
-I../freestanding-headers \
|
||||||
|
-I'$(call SHESCAPE,$(BUILDDIR))/tinf' \
|
||||||
-I'$(call SHESCAPE,$(BUILDDIR))/..' \
|
-I'$(call SHESCAPE,$(BUILDDIR))/..' \
|
||||||
-I. \
|
-I. \
|
||||||
-I.. \
|
-I..
|
||||||
-I'$(call SHESCAPE,$(BUILDDIR))/tinf'
|
|
||||||
|
|
||||||
ifeq ($(TARGET),bios)
|
ifeq ($(TARGET),bios)
|
||||||
override CROSS_CFLAGS += \
|
override CROSS_CFLAGS += \
|
||||||
-Dbios=1 \
|
-fno-pie \
|
||||||
-Duefi=0 \
|
-fno-pic \
|
||||||
-m32 \
|
-m32 \
|
||||||
-march=i686 \
|
-march=i686 \
|
||||||
-mtune=generic \
|
-mtune=generic \
|
||||||
-mabi=sysv \
|
-mabi=sysv \
|
||||||
-fno-pie \
|
|
||||||
-fno-pic
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(TARGET),$(filter $(TARGET),bios uefi-ia32 uefi-x86_64))
|
|
||||||
override CROSS_CFLAGS += \
|
|
||||||
-mno-80387 \
|
-mno-80387 \
|
||||||
-mno-mmx \
|
-Dbios=1 \
|
||||||
-mno-sse \
|
-Duefi=0
|
||||||
-mno-sse2
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET),uefi-x86-64)
|
ifeq ($(TARGET),uefi-x86-64)
|
||||||
override CROSS_CFLAGS += \
|
override CROSS_CFLAGS += \
|
||||||
-Dbios=0 \
|
-fpie \
|
||||||
-Duefi=1 \
|
|
||||||
-m64 \
|
-m64 \
|
||||||
-march=x86-64 \
|
-march=x86-64 \
|
||||||
-mtune=generic \
|
-mtune=generic \
|
||||||
-mabi=sysv \
|
-mabi=sysv \
|
||||||
|
-mno-80387 \
|
||||||
|
-mno-mmx \
|
||||||
|
-mno-sse \
|
||||||
|
-mno-sse2 \
|
||||||
|
-mno-red-zone \
|
||||||
|
-Dbios=0 \
|
||||||
|
-Duefi=1 \
|
||||||
-DGNU_EFI_USE_MS_ABI \
|
-DGNU_EFI_USE_MS_ABI \
|
||||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
||||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/x86_64' \
|
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/x86_64'
|
||||||
-fpie \
|
|
||||||
-mno-red-zone
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET),uefi-ia32)
|
ifeq ($(TARGET),uefi-ia32)
|
||||||
override CROSS_CFLAGS += \
|
override CROSS_CFLAGS += \
|
||||||
-Dbios=0 \
|
-fpie \
|
||||||
-Duefi=1 \
|
|
||||||
-m32 \
|
-m32 \
|
||||||
-march=i686 \
|
-march=i686 \
|
||||||
-mtune=generic \
|
-mtune=generic \
|
||||||
-mabi=sysv \
|
-mabi=sysv \
|
||||||
|
-mno-80387 \
|
||||||
|
-Dbios=0 \
|
||||||
|
-Duefi=1 \
|
||||||
-DGNU_EFI_USE_MS_ABI \
|
-DGNU_EFI_USE_MS_ABI \
|
||||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
||||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/ia32' \
|
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/ia32'
|
||||||
-fpie
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET),uefi-aarch64)
|
ifeq ($(TARGET),uefi-aarch64)
|
||||||
override CROSS_CFLAGS += \
|
override CROSS_CFLAGS += \
|
||||||
|
-fpie \
|
||||||
|
-mtune=generic \
|
||||||
|
-mgeneral-regs-only \
|
||||||
-Dbios=0 \
|
-Dbios=0 \
|
||||||
-Duefi=1 \
|
-Duefi=1 \
|
||||||
-mtune=generic \
|
|
||||||
-DGNU_EFI_USE_MS_ABI \
|
-DGNU_EFI_USE_MS_ABI \
|
||||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
||||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/aarch64' \
|
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/aarch64'
|
||||||
-fpie \
|
|
||||||
-mgeneral-regs-only
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
override CROSS_LDFLAGS += \
|
override CROSS_LDFLAGS += \
|
||||||
|
@ -121,7 +119,7 @@ override CROSS_LDFLAGS += \
|
||||||
|
|
||||||
ifeq ($(TARGET),bios)
|
ifeq ($(TARGET),bios)
|
||||||
override CROSS_LDFLAGS += \
|
override CROSS_LDFLAGS += \
|
||||||
-melf_i386 \
|
-m elf_i386 \
|
||||||
-static \
|
-static \
|
||||||
--build-id=sha1
|
--build-id=sha1
|
||||||
|
|
||||||
|
@ -132,29 +130,29 @@ endif
|
||||||
|
|
||||||
ifeq ($(TARGET),uefi-x86-64)
|
ifeq ($(TARGET),uefi-x86-64)
|
||||||
override CROSS_LDFLAGS += \
|
override CROSS_LDFLAGS += \
|
||||||
-melf_x86_64 \
|
-m elf_x86_64 \
|
||||||
-static \
|
-static \
|
||||||
-pie \
|
-pie \
|
||||||
--no-dynamic-linker \
|
--no-dynamic-linker \
|
||||||
-ztext
|
-z text
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET),uefi-ia32)
|
ifeq ($(TARGET),uefi-ia32)
|
||||||
override CROSS_LDFLAGS += \
|
override CROSS_LDFLAGS += \
|
||||||
-melf_i386 \
|
-m elf_i386 \
|
||||||
-static \
|
-static \
|
||||||
-pie \
|
-pie \
|
||||||
--no-dynamic-linker \
|
--no-dynamic-linker \
|
||||||
-ztext
|
-z text
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET),uefi-aarch64)
|
ifeq ($(TARGET),uefi-aarch64)
|
||||||
override CROSS_LDFLAGS += \
|
override CROSS_LDFLAGS += \
|
||||||
-maarch64elf \
|
-m aarch64elf \
|
||||||
-static \
|
-static \
|
||||||
-pie \
|
-pie \
|
||||||
--no-dynamic-linker \
|
--no-dynamic-linker \
|
||||||
-ztext
|
-z text
|
||||||
endif
|
endif
|
||||||
|
|
||||||
override C_FILES := $(shell find . -type f -name '*.c')
|
override C_FILES := $(shell find . -type f -name '*.c')
|
||||||
|
|
|
@ -15,37 +15,34 @@ endif
|
||||||
override CROSS_CFLAGS += \
|
override CROSS_CFLAGS += \
|
||||||
$(WERROR) \
|
$(WERROR) \
|
||||||
-Os \
|
-Os \
|
||||||
|
-std=gnu11 \
|
||||||
|
-nostdinc \
|
||||||
-m32 \
|
-m32 \
|
||||||
-march=i686 \
|
-march=i686 \
|
||||||
-mtune=generic \
|
-mtune=generic \
|
||||||
-mabi=sysv \
|
-mabi=sysv \
|
||||||
-std=gnu11 \
|
-mno-80387 \
|
||||||
-ffreestanding \
|
-ffreestanding \
|
||||||
-fno-stack-protector \
|
-fno-stack-protector \
|
||||||
-fno-stack-check \
|
-fno-stack-check \
|
||||||
|
-fomit-frame-pointer \
|
||||||
-fno-strict-aliasing \
|
-fno-strict-aliasing \
|
||||||
-fno-lto \
|
-fno-lto \
|
||||||
-fno-pie \
|
-fno-pie \
|
||||||
-fno-pic \
|
-fno-pic \
|
||||||
-fomit-frame-pointer \
|
|
||||||
-nostdinc \
|
|
||||||
-Wshadow \
|
-Wshadow \
|
||||||
-Wvla \
|
-Wvla \
|
||||||
-mno-80387 \
|
|
||||||
-mno-mmx \
|
|
||||||
-mno-sse \
|
|
||||||
-mno-sse2 \
|
|
||||||
-MMD \
|
-MMD \
|
||||||
-I../freestanding-headers \
|
-I../freestanding-headers \
|
||||||
-I. \
|
-I'$(call SHESCAPE,$(BUILDDIR))/tinf' \
|
||||||
-I'$(call SHESCAPE,$(BUILDDIR))/tinf'
|
-I.
|
||||||
|
|
||||||
override CROSS_LDFLAGS += \
|
override CROSS_LDFLAGS += \
|
||||||
-melf_i386 \
|
-m elf_i386 \
|
||||||
-nostdlib \
|
-nostdlib \
|
||||||
-z max-page-size=0x1000 \
|
-z max-page-size=0x1000 \
|
||||||
-static \
|
-static \
|
||||||
-Tlinker.ld
|
-T linker.ld
|
||||||
|
|
||||||
ifneq ($(CROSS_LD_NO_PIE_BUG),1)
|
ifneq ($(CROSS_LD_NO_PIE_BUG),1)
|
||||||
override CROSS_LDFLAGS += -no-pie
|
override CROSS_LDFLAGS += -no-pie
|
||||||
|
|
Loading…
Reference in New Issue