1 # SPDX-License-Identifier: GPL-2.0+
3 # (C) Copyright 2000-2002
4 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
8 PLATFORM_CPPFLAGS += -fomit-frame-pointer
9 PF_CPPFLAGS_X86 := $(call cc-option, -fno-toplevel-reorder, \
10 $(call cc-option, -fno-unit-at-a-time))
12 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86)
13 PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
15 ifdef CONFIG_SPL_BUILD
24 PLATFORM_CPPFLAGS += -march=i386 -m32
26 PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -march=core2 -m64
27 PLATFORM_CPPFLAGS += -mno-mmx -mno-sse
30 PLATFORM_RELFLAGS += -fdata-sections -ffunction-sections -fvisibility=hidden
32 PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions
33 PLATFORM_LDFLAGS += -m $(if $(IS_32BIT),elf_i386,elf_x86_64)
35 # This is used in the top-level Makefile which does not include
37 LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined -s
39 OBJCOPYFLAGS_EFI := -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
40 -j .rel -j .rela -j .reloc
43 CFLAGS_NON_EFI := -mregparm=3
45 CFLAGS_EFI := -fpic -fshort-wchar
47 ifeq ($(CONFIG_EFI_STUB_64BIT),)
48 CFLAGS_EFI += $(call cc-option, -mno-red-zone)
50 EFIPAYLOAD_BFDTARGET = elf32-i386
53 EFIPAYLOAD_BFDTARGET = elf64-x86-64
56 EFIPAYLOAD_BFDARCH = i386
58 LDSCRIPT_EFI := $(srctree)/arch/x86/lib/elf_$(EFIARCH)_efi.lds
59 EFISTUB := crt0_$(EFIARCH)_efi.o reloc_$(EFIARCH)_efi.o
60 OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH)
62 CPPFLAGS_REMOVE_crt0-efi-$(EFIARCH).o += $(CFLAGS_NON_EFI)
63 CPPFLAGS_crt0-efi-$(EFIARCH).o += $(CFLAGS_EFI)
65 ifeq ($(CONFIG_EFI_APP),y)
67 PLATFORM_CPPFLAGS += $(CFLAGS_EFI)
68 LDFLAGS_FINAL += -znocombreloc -shared -s
69 LDSCRIPT := $(LDSCRIPT_EFI)
73 PLATFORM_CPPFLAGS += $(CFLAGS_NON_EFI)
74 PLATFORM_LDFLAGS += --emit-relocs
75 LDFLAGS_FINAL += --gc-sections $(if $(CONFIG_SPL_BUILD),,-pie)
80 ifndef CONFIG_SPL_BUILD
81 PLATFORM_CPPFLAGS += -D__x86_64__
83 PLATFORM_CPPFLAGS += -D__I386__
86 PLATFORM_CPPFLAGS += -D__I386__
91 ifdef CONFIG_EFI_STUB_64BIT
92 EFI_LDS := elf_x86_64_efi.lds
93 EFI_CRT0 := crt0_x86_64_efi.o
94 EFI_RELOC := reloc_x86_64_efi.o
96 EFI_LDS := elf_ia32_efi.lds
97 EFI_CRT0 := crt0_ia32_efi.o
98 EFI_RELOC := reloc_ia32_efi.o
104 EFI_LDS := elf_x86_64_efi.lds
105 EFI_CRT0 := crt0_x86_64_efi.o
106 EFI_RELOC := reloc_x86_64_efi.o
108 EFI_LDS := elf_ia32_efi.lds
109 EFI_CRT0 := crt0_ia32_efi.o
110 EFI_RELOC := reloc_ia32_efi.o
116 EFI_TARGET := --target=efi-app-x86_64
118 EFI_TARGET := --target=efi-app-ia32