xref: /openbmc/u-boot/arch/x86/config.mk (revision d9b23e26)
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
15PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86)
16PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
17
18ifdef CONFIG_SPL_BUILD
19IS_32BIT := y
20else
21ifndef CONFIG_X86_64
22IS_32BIT := y
23endif
24endif
25
26ifeq ($(IS_32BIT),y)
27PLATFORM_CPPFLAGS += -march=i386 -m32
28else
29PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -m64
30endif
31
32PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
33
34PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions
35PLATFORM_LDFLAGS += -m $(if $(IS_32BIT),elf_i386,elf_x86_64)
36
37LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
38LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
39
40# This is used in the top-level Makefile which does not include
41# PLATFORM_LDFLAGS
42LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined
43
44OBJCOPYFLAGS_EFI := -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
45	-j .rel -j .rela -j .reloc
46
47ifeq ($(IS_32BIT),y)
48CFLAGS_NON_EFI := -mregparm=3
49endif
50CFLAGS_EFI := -fpic -fshort-wchar
51
52ifeq ($(CONFIG_EFI_STUB_64BIT),)
53CFLAGS_EFI += $(call cc-option, -mno-red-zone)
54EFIARCH = ia32
55EFIPAYLOAD_BFDTARGET = elf32-i386
56else
57EFIARCH = x86_64
58EFIPAYLOAD_BFDTARGET = elf64-x86-64
59endif
60
61EFIPAYLOAD_BFDARCH = i386
62
63LDSCRIPT_EFI := $(srctree)/arch/x86/lib/elf_$(EFIARCH)_efi.lds
64EFISTUB := crt0_$(EFIARCH)_efi.o reloc_$(EFIARCH)_efi.o
65OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH)
66
67CPPFLAGS_REMOVE_crt0-efi-$(EFIARCH).o += $(CFLAGS_NON_EFI)
68CPPFLAGS_crt0-efi-$(EFIARCH).o += $(CFLAGS_EFI)
69
70ifeq ($(CONFIG_EFI_APP),y)
71
72PLATFORM_CPPFLAGS += $(CFLAGS_EFI)
73LDFLAGS_FINAL += -znocombreloc -shared
74LDSCRIPT := $(LDSCRIPT_EFI)
75
76else
77
78PLATFORM_CPPFLAGS += $(CFLAGS_NON_EFI)
79PLATFORM_LDFLAGS += --emit-relocs
80LDFLAGS_FINAL += --gc-sections $(if $(CONFIG_SPL_BUILD),,-pie)
81
82endif
83
84ifdef CONFIG_X86_64
85ifndef CONFIG_SPL_BUILD
86PLATFORM_CPPFLAGS += -D__x86_64__
87else
88PLATFORM_CPPFLAGS += -D__I386__
89endif
90else
91PLATFORM_CPPFLAGS += -D__I386__
92endif
93
94ifneq ($(CONFIG_EFI_STUB)$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
95
96ifneq ($(CONFIG_EFI_STUB_64BIT),)
97EFI_LDS := elf_x86_64_efi.lds
98EFI_CRT0 := crt0_x86_64_efi.o
99EFI_RELOC := reloc_x86_64_efi.o
100EFI_TARGET := --target=efi-app-ia32
101else
102EFI_LDS := elf_ia32_efi.lds
103EFI_CRT0 := crt0_ia32_efi.o
104EFI_RELOC := reloc_ia32_efi.o
105EFI_TARGET := --target=efi-app-x86_64
106endif
107
108endif
109