xref: /openbmc/u-boot/arch/x86/config.mk (revision ad5b5801)
1#
2# (C) Copyright 2000-2002
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
5# SPDX-License-Identifier:	GPL-2.0+
6#
7
8CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
9
10PLATFORM_CPPFLAGS += -fno-strict-aliasing
11PLATFORM_CPPFLAGS += -fomit-frame-pointer
12PF_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)
15
16PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86)
17PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
18PLATFORM_CPPFLAGS += -march=i386 -m32
19
20PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
21
22PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions -m elf_i386
23
24LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
25LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
26
27# This is used in the top-level Makefile which does not include
28# PLATFORM_LDFLAGS
29LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined
30
31OBJCOPYFLAGS_EFI := -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
32	-j .rel -j .rela -j .reloc
33
34CFLAGS_NON_EFI := -mregparm=3
35CFLAGS_EFI := -fpic -fshort-wchar
36
37ifeq ($(CONFIG_EFI_STUB_64BIT),)
38CFLAGS_EFI += $(call cc-option, -mno-red-zone)
39EFIARCH = ia32
40EFIPAYLOAD_BFDTARGET = elf32-i386
41else
42EFIARCH = x86_64
43EFIPAYLOAD_BFDTARGET = elf64-x86-64
44endif
45
46EFIPAYLOAD_BFDARCH = i386
47
48LDSCRIPT_EFI := $(srctree)/$(CPUDIR)/efi/elf_$(EFIARCH)_efi.lds
49EFISTUB := crt0-efi-$(EFIARCH).o reloc_$(EFIARCH).o
50OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH)
51
52CPPFLAGS_REMOVE_crt0-efi-$(EFIARCH).o += $(CFLAGS_NON_EFI)
53CPPFLAGS_crt0-efi-$(EFIARCH).o += $(CFLAGS_EFI)
54
55ifeq ($(CONFIG_EFI_APP),y)
56
57PLATFORM_CPPFLAGS += $(CFLAGS_EFI)
58LDFLAGS_FINAL += -znocombreloc -shared
59LDSCRIPT := $(LDSCRIPT_EFI)
60
61else
62
63PLATFORM_CPPFLAGS += $(CFLAGS_NON_EFI)
64PLATFORM_LDFLAGS += --emit-relocs
65LDFLAGS_FINAL += --gc-sections -pie
66
67endif
68