2 # (C) Copyright 2000-2002
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 # SPDX-License-Identifier: GPL-2.0+
8 CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
10 PLATFORM_CPPFLAGS += -fno-strict-aliasing
11 PLATFORM_CPPFLAGS += -fomit-frame-pointer
12 PF_CPPFLAGS_X86 := $(call cc-option, -fno-toplevel-reorder, \
13 $(call cc-option, -fno-unit-at-a-time)) \
14 $(call cc-option, -mpreferred-stack-boundary=2)
16 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86)
17 PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
18 PLATFORM_CPPFLAGS += -march=i386 -m32
20 PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
22 PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions -m elf_i386
24 LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
25 LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
27 # This is used in the top-level Makefile which does not include
29 LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined
31 OBJCOPYFLAGS_EFI := -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
32 -j .rel -j .rela -j .reloc
34 CFLAGS_NON_EFI := -mregparm=3
35 CFLAGS_EFI := -fpic -fshort-wchar
37 ifeq ($(CONFIG_EFI_STUB_64BIT),)
38 CFLAGS_EFI += $(call cc-option, -mno-red-zone)
40 EFIPAYLOAD_BFDTARGET = elf32-i386
43 EFIPAYLOAD_BFDTARGET = elf64-x86-64
46 EFIPAYLOAD_BFDARCH = i386
48 LDSCRIPT_EFI := $(srctree)/$(CPUDIR)/efi/elf_$(EFIARCH)_efi.lds
49 EFISTUB := crt0-efi-$(EFIARCH).o reloc_$(EFIARCH).o
50 OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH)
52 CPPFLAGS_REMOVE_crt0-efi-$(EFIARCH).o += $(CFLAGS_NON_EFI)
53 CPPFLAGS_crt0-efi-$(EFIARCH).o += $(CFLAGS_EFI)
55 ifeq ($(CONFIG_EFI_APP),y)
57 PLATFORM_CPPFLAGS += $(CFLAGS_EFI)
58 LDFLAGS_FINAL += -znocombreloc -shared
59 LDSCRIPT := $(LDSCRIPT_EFI)
63 PLATFORM_CPPFLAGS += $(CFLAGS_NON_EFI)
64 PLATFORM_LDFLAGS += --emit-relocs
65 LDFLAGS_FINAL += --gc-sections -pie