2018-05-07 05:58:06 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2002-11-18 08:14:45 +08:00
|
|
|
#
|
|
|
|
# (C) Copyright 2000-2002
|
|
|
|
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
|
2011-02-04 21:25:17 +08:00
|
|
|
CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
|
2009-09-04 11:12:47 +08:00
|
|
|
|
2010-10-07 17:03:23 +08:00
|
|
|
PLATFORM_CPPFLAGS += -fomit-frame-pointer
|
2014-02-26 13:51:01 +08:00
|
|
|
PF_CPPFLAGS_X86 := $(call cc-option, -fno-toplevel-reorder, \
|
2017-07-27 21:12:34 +08:00
|
|
|
$(call cc-option, -fno-unit-at-a-time))
|
2015-08-05 02:33:42 +08:00
|
|
|
|
2011-11-02 04:54:02 +08:00
|
|
|
PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86)
|
2011-02-12 12:11:21 +08:00
|
|
|
PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
|
2017-01-16 22:04:26 +08:00
|
|
|
|
|
|
|
ifdef CONFIG_SPL_BUILD
|
|
|
|
IS_32BIT := y
|
|
|
|
else
|
|
|
|
ifndef CONFIG_X86_64
|
|
|
|
IS_32BIT := y
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(IS_32BIT),y)
|
2014-06-10 21:14:56 +08:00
|
|
|
PLATFORM_CPPFLAGS += -march=i386 -m32
|
2017-01-16 22:04:26 +08:00
|
|
|
else
|
2018-10-14 11:52:01 +08:00
|
|
|
PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -march=core2 -m64
|
2018-10-14 11:52:02 +08:00
|
|
|
PLATFORM_CPPFLAGS += -mno-mmx -mno-sse
|
2017-01-16 22:04:26 +08:00
|
|
|
endif
|
2011-02-12 12:11:21 +08:00
|
|
|
|
2018-08-20 20:20:51 +08:00
|
|
|
PLATFORM_RELFLAGS += -fdata-sections -ffunction-sections -fvisibility=hidden
|
2011-02-12 12:11:21 +08:00
|
|
|
|
2020-03-27 23:46:27 +08:00
|
|
|
KBUILD_LDFLAGS += -Bsymbolic -Bsymbolic-functions
|
|
|
|
KBUILD_LDFLAGS += -m $(if $(IS_32BIT),elf_i386,elf_x86_64)
|
2011-02-12 12:11:21 +08:00
|
|
|
|
2015-08-05 02:33:52 +08:00
|
|
|
# This is used in the top-level Makefile which does not include
|
2020-03-27 23:46:27 +08:00
|
|
|
# KBUILD_LDFLAGS
|
2018-10-02 22:39:30 +08:00
|
|
|
LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined -s
|
2015-08-05 02:33:52 +08:00
|
|
|
|
2015-08-05 02:33:42 +08:00
|
|
|
OBJCOPYFLAGS_EFI := -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
|
|
|
|
-j .rel -j .rela -j .reloc
|
|
|
|
|
2017-01-16 22:04:26 +08:00
|
|
|
ifeq ($(IS_32BIT),y)
|
2015-08-05 02:33:42 +08:00
|
|
|
CFLAGS_NON_EFI := -mregparm=3
|
2017-01-16 22:04:26 +08:00
|
|
|
endif
|
2015-08-05 02:33:42 +08:00
|
|
|
CFLAGS_EFI := -fpic -fshort-wchar
|
|
|
|
|
2015-08-05 02:33:56 +08:00
|
|
|
ifeq ($(CONFIG_EFI_STUB_64BIT),)
|
|
|
|
CFLAGS_EFI += $(call cc-option, -mno-red-zone)
|
2015-08-05 02:33:42 +08:00
|
|
|
EFIARCH = ia32
|
2015-08-05 02:33:52 +08:00
|
|
|
EFIPAYLOAD_BFDTARGET = elf32-i386
|
2015-08-05 02:33:56 +08:00
|
|
|
else
|
|
|
|
EFIARCH = x86_64
|
|
|
|
EFIPAYLOAD_BFDTARGET = elf64-x86-64
|
|
|
|
endif
|
2015-08-05 02:33:52 +08:00
|
|
|
|
|
|
|
EFIPAYLOAD_BFDARCH = i386
|
2015-08-05 02:33:42 +08:00
|
|
|
|
2016-11-07 23:47:13 +08:00
|
|
|
LDSCRIPT_EFI := $(srctree)/arch/x86/lib/elf_$(EFIARCH)_efi.lds
|
2016-11-07 23:47:14 +08:00
|
|
|
EFISTUB := crt0_$(EFIARCH)_efi.o reloc_$(EFIARCH)_efi.o
|
2015-08-05 02:33:42 +08:00
|
|
|
OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH)
|
|
|
|
|
2015-08-05 02:33:56 +08:00
|
|
|
CPPFLAGS_REMOVE_crt0-efi-$(EFIARCH).o += $(CFLAGS_NON_EFI)
|
|
|
|
CPPFLAGS_crt0-efi-$(EFIARCH).o += $(CFLAGS_EFI)
|
|
|
|
|
2015-08-05 02:33:42 +08:00
|
|
|
ifeq ($(CONFIG_EFI_APP),y)
|
|
|
|
|
|
|
|
PLATFORM_CPPFLAGS += $(CFLAGS_EFI)
|
2018-10-02 22:39:31 +08:00
|
|
|
LDFLAGS_FINAL += -znocombreloc -shared -s
|
2015-08-05 02:33:42 +08:00
|
|
|
LDSCRIPT := $(LDSCRIPT_EFI)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
PLATFORM_CPPFLAGS += $(CFLAGS_NON_EFI)
|
2020-03-27 23:46:27 +08:00
|
|
|
KBUILD_LDFLAGS += --emit-relocs
|
2017-01-16 22:04:26 +08:00
|
|
|
LDFLAGS_FINAL += --gc-sections $(if $(CONFIG_SPL_BUILD),,-pie)
|
|
|
|
|
|
|
|
endif
|
2015-08-05 02:33:42 +08:00
|
|
|
|
2017-01-16 22:04:26 +08:00
|
|
|
ifdef CONFIG_X86_64
|
|
|
|
ifndef CONFIG_SPL_BUILD
|
|
|
|
PLATFORM_CPPFLAGS += -D__x86_64__
|
|
|
|
else
|
|
|
|
PLATFORM_CPPFLAGS += -D__I386__
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
PLATFORM_CPPFLAGS += -D__I386__
|
2015-08-05 02:33:42 +08:00
|
|
|
endif
|
2016-11-07 23:47:15 +08:00
|
|
|
|
2018-05-19 01:12:19 +08:00
|
|
|
ifdef CONFIG_EFI_STUB
|
2016-11-07 23:47:15 +08:00
|
|
|
|
2018-05-19 01:12:19 +08:00
|
|
|
ifdef CONFIG_EFI_STUB_64BIT
|
2016-11-07 23:47:15 +08:00
|
|
|
EFI_LDS := elf_x86_64_efi.lds
|
|
|
|
EFI_CRT0 := crt0_x86_64_efi.o
|
|
|
|
EFI_RELOC := reloc_x86_64_efi.o
|
|
|
|
else
|
|
|
|
EFI_LDS := elf_ia32_efi.lds
|
|
|
|
EFI_CRT0 := crt0_ia32_efi.o
|
|
|
|
EFI_RELOC := reloc_ia32_efi.o
|
2018-04-06 21:36:31 +08:00
|
|
|
endif
|
|
|
|
|
2018-05-19 01:12:19 +08:00
|
|
|
else
|
|
|
|
|
2018-04-06 21:36:31 +08:00
|
|
|
ifdef CONFIG_X86_64
|
2018-05-19 01:12:19 +08:00
|
|
|
EFI_LDS := elf_x86_64_efi.lds
|
|
|
|
EFI_CRT0 := crt0_x86_64_efi.o
|
|
|
|
EFI_RELOC := reloc_x86_64_efi.o
|
2018-04-06 21:36:31 +08:00
|
|
|
else
|
2018-05-19 01:12:19 +08:00
|
|
|
EFI_LDS := elf_ia32_efi.lds
|
|
|
|
EFI_CRT0 := crt0_ia32_efi.o
|
|
|
|
EFI_RELOC := reloc_ia32_efi.o
|
|
|
|
endif
|
|
|
|
|
2016-11-07 23:47:15 +08:00
|
|
|
endif
|
|
|
|
|
2018-05-19 01:12:19 +08:00
|
|
|
ifdef CONFIG_X86_64
|
|
|
|
EFI_TARGET := --target=efi-app-x86_64
|
|
|
|
else
|
|
|
|
EFI_TARGET := --target=efi-app-ia32
|
2016-11-07 23:47:15 +08:00
|
|
|
endif
|