]> git.ipfire.org Git - thirdparty/u-boot.git/blob - arch/x86/config.mk
Merge https://source.denx.de/u-boot/custodians/u-boot-samsung
[thirdparty/u-boot.git] / arch / x86 / config.mk
1 # SPDX-License-Identifier: GPL-2.0+
2 #
3 # (C) Copyright 2000-2002
4 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5
6 CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
7
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))
11
12 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86)
13 PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
14
15 ifdef CONFIG_SPL_BUILD
16 IS_32BIT := y
17 else
18 ifndef CONFIG_X86_64
19 IS_32BIT := y
20 endif
21 endif
22
23 EFI_IS_32BIT := $(IS_32BIT)
24 ifdef CONFIG_EFI_STUB_64BIT
25 EFI_IS_32BIT :=
26 endif
27
28 ifeq ($(IS_32BIT),y)
29 PLATFORM_CPPFLAGS += -march=i386 -m32
30 else
31 PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -march=core2 -m64
32 PLATFORM_CPPFLAGS += -mno-mmx -mno-sse
33 endif
34
35 PLATFORM_RELFLAGS += -fdata-sections -ffunction-sections -fvisibility=hidden
36
37 KBUILD_LDFLAGS += -Bsymbolic -Bsymbolic-functions
38 KBUILD_LDFLAGS += -m $(if $(IS_32BIT),elf_i386,elf_x86_64)
39
40 # This is used in the top-level Makefile which does not include
41 # KBUILD_LDFLAGS
42 LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined -s
43
44 OBJCOPYFLAGS_EFI := -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
45 -j .rel -j .rela -j .reloc --strip-all
46
47 # Compiler flags to be added when building UEFI applications
48 CFLAGS_EFI := -fpic -fshort-wchar
49 # Compiler flags to be removed when building UEFI applications
50 CFLAGS_NON_EFI := -mregparm=3 -fstack-protector-strong
51
52 ifeq ($(IS_32BIT),y)
53 EFIPAYLOAD_BFDARCH = i386
54 else
55 CFLAGS_EFI += $(call cc-option, -mno-red-zone)
56 EFIPAYLOAD_BFDARCH = x86_64
57 endif
58
59 ifeq ($(EFI_IS_32BIT),y)
60 EFIARCH = ia32
61 EFIPAYLOAD_BFDTARGET = elf32-i386
62 else
63 EFIARCH = x86_64
64 EFIPAYLOAD_BFDTARGET = elf64-x86-64
65 endif
66
67 LDSCRIPT_EFI := $(srctree)/arch/x86/lib/elf_$(EFIARCH)_efi.lds
68 EFISTUB := crt0_$(EFIARCH)_efi.o reloc_$(EFIARCH)_efi.o
69 OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH)
70
71 CPPFLAGS_REMOVE_crt0-efi-$(EFIARCH).o += $(CFLAGS_NON_EFI)
72 CPPFLAGS_crt0-efi-$(EFIARCH).o += $(CFLAGS_EFI)
73
74 ifeq ($(CONFIG_EFI_APP),y)
75
76 PLATFORM_CPPFLAGS += $(CFLAGS_EFI)
77 LDFLAGS_FINAL += -znocombreloc -shared
78 LDSCRIPT := $(LDSCRIPT_EFI)
79
80 else
81
82 ifeq ($(IS_32BIT),y)
83 PLATFORM_CPPFLAGS += -mregparm=3
84 endif
85 KBUILD_LDFLAGS += --emit-relocs
86 LDFLAGS_FINAL += --gc-sections $(if $(CONFIG_SPL_BUILD),,-pie)
87
88 endif
89
90 ifdef CONFIG_X86_64
91 ifndef CONFIG_SPL_BUILD
92 PLATFORM_CPPFLAGS += -D__x86_64__
93 else
94 PLATFORM_CPPFLAGS += -D__I386__
95 endif
96 else
97 PLATFORM_CPPFLAGS += -D__I386__
98 endif
99
100 ifdef CONFIG_EFI_STUB
101
102 ifdef CONFIG_EFI_STUB_64BIT
103 EFI_LDS := elf_x86_64_efi.lds
104 EFI_CRT0 := crt0_x86_64_efi.o
105 EFI_RELOC := reloc_x86_64_efi.o
106 else
107 EFI_LDS := elf_ia32_efi.lds
108 EFI_CRT0 := crt0_ia32_efi.o
109 EFI_RELOC := reloc_ia32_efi.o
110 endif
111
112 else
113
114 ifdef CONFIG_X86_64
115 EFI_LDS := elf_x86_64_efi.lds
116 EFI_CRT0 := crt0_x86_64_efi.o
117 EFI_RELOC := reloc_x86_64_efi.o
118 else
119 EFI_LDS := elf_ia32_efi.lds
120 EFI_CRT0 := crt0_ia32_efi.o
121 EFI_RELOC := reloc_ia32_efi.o
122 endif
123
124 endif
125
126 ifdef CONFIG_X86_64
127 EFI_TARGET := --target=efi-app-x86_64
128 else
129 EFI_TARGET := --target=efi-app-ia32
130 endif