Merge branch '2021-05-24-add-lto-support'

- Add LTO (link time optimization) support to the build system and
  enable it on a few boards.  This is an alternative to using
  -ffunction-sections/-fdata-sections and --gc-sections at link time to
  remove unused code.  This can result in notable savings, but needs
  testing on each platform before use as it can expose problems by
  optimizing away various functionally necessary calls.
This commit is contained in:
Tom Rini 2021-05-24 16:12:31 -04:00
commit 27c6d9663c
110 changed files with 523 additions and 187 deletions

2
Kbuild
View file

@ -10,6 +10,8 @@ generic-offsets-file := include/generated/generic-asm-offsets.h
always := $(generic-offsets-file) always := $(generic-offsets-file)
targets := lib/asm-offsets.s targets := lib/asm-offsets.s
CFLAGS_REMOVE_asm-offsets.o := $(LTO_CFLAGS)
$(obj)/$(generic-offsets-file): $(obj)/lib/asm-offsets.s FORCE $(obj)/$(generic-offsets-file): $(obj)/lib/asm-offsets.s FORCE
$(call filechk,offsets,__GENERIC_ASM_OFFSETS_H__) $(call filechk,offsets,__GENERIC_ASM_OFFSETS_H__)

24
Kconfig
View file

@ -85,6 +85,30 @@ config SPL_OPTIMIZE_INLINING
do what it thinks is best, which is desirable in some cases for size do what it thinks is best, which is desirable in some cases for size
reasons. reasons.
config ARCH_SUPPORTS_LTO
bool
config LTO
bool "Enable Link Time Optimizations"
depends on ARCH_SUPPORTS_LTO
default n
help
This option enables Link Time Optimization (LTO), a mechanism which
allows the compiler to optimize between different compilation units.
This can optimize away dead code paths, resulting in smaller binary
size (if CC_OPTIMIZE_FOR_SIZE is enabled).
This option is not available for every architecture and may
introduce bugs.
Currently, when compiling with GCC, due to a weird bug regarding
jobserver, the final linking will not respect make's --jobs argument.
Instead all available processors will be used (as reported by the
nproc command).
If unsure, say n.
config TPL_OPTIMIZE_INLINING config TPL_OPTIMIZE_INLINING
bool "Allow compiler to uninline functions marked 'inline' in TPL" bool "Allow compiler to uninline functions marked 'inline' in TPL"
depends on TPL depends on TPL

View file

@ -676,6 +676,31 @@ else
KBUILD_CFLAGS += -O2 KBUILD_CFLAGS += -O2
endif endif
LTO_CFLAGS :=
LTO_FINAL_LDFLAGS :=
export LTO_CFLAGS LTO_FINAL_LDFLAGS
ifdef CONFIG_LTO
ifeq ($(cc-name),clang)
LTO_CFLAGS += -flto
LTO_FINAL_LDFLAGS += -flto
AR = $(shell $(CC) -print-prog-name=llvm-ar)
NM = $(shell $(CC) -print-prog-name=llvm-nm)
else
NPROC := $(shell nproc 2>/dev/null || echo 1)
LTO_CFLAGS += -flto=$(NPROC)
LTO_FINAL_LDFLAGS += -fuse-linker-plugin -flto=$(NPROC)
# use plugin aware tools
AR = $(CROSS_COMPILE)gcc-ar
NM = $(CROSS_COMPILE)gcc-nm
endif
CFLAGS_NON_EFI += $(LTO_CFLAGS)
KBUILD_CFLAGS += $(LTO_CFLAGS)
endif
ifeq ($(CONFIG_STACKPROTECTOR),y) ifeq ($(CONFIG_STACKPROTECTOR),y)
KBUILD_CFLAGS += $(call cc-option,-fstack-protector-strong) KBUILD_CFLAGS += $(call cc-option,-fstack-protector-strong)
CFLAGS_EFI += $(call cc-option,-fno-stack-protector) CFLAGS_EFI += $(call cc-option,-fno-stack-protector)
@ -972,6 +997,8 @@ LDFLAGS_u-boot += $(LDFLAGS_FINAL)
# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker) LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker)
LDFLAGS_u-boot += --build-id=none
ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),) ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),)
LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
endif endif
@ -1708,14 +1735,54 @@ u-boot-swap.bin: u-boot.bin FORCE
ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(ARCH)/Makefile.postlink) ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(ARCH)/Makefile.postlink)
# Generate linker list symbols references to force compiler to not optimize
# them away when compiling with LTO
ifdef CONFIG_LTO
u-boot-keep-syms-lto := keep-syms-lto.o
u-boot-keep-syms-lto_c := $(patsubst %.o,%.c,$(u-boot-keep-syms-lto))
quiet_cmd_keep_syms_lto = KSL $@
cmd_keep_syms_lto = \
NM=$(NM) $(srctree)/scripts/gen_ll_addressable_symbols.sh $^ >$@
quiet_cmd_keep_syms_lto_cc = KSLCC $@
cmd_keep_syms_lto_cc = \
$(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o $@ $<
$(u-boot-keep-syms-lto_c): $(u-boot-main)
$(call if_changed,keep_syms_lto)
$(u-boot-keep-syms-lto): $(u-boot-keep-syms-lto_c)
$(call if_changed,keep_syms_lto_cc)
else
u-boot-keep-syms-lto :=
endif
# Rule to link u-boot # Rule to link u-boot
# May be overridden by arch/$(ARCH)/config.mk # May be overridden by arch/$(ARCH)/config.mk
ifdef CONFIG_LTO
quiet_cmd_u-boot__ ?= LTO $@
cmd_u-boot__ ?= \
$(CC) -nostdlib -nostartfiles \
$(LTO_FINAL_LDFLAGS) $(c_flags) \
$(KBUILD_LDFLAGS:%=-Wl,%) $(LDFLAGS_u-boot:%=-Wl,%) -o $@ \
-T u-boot.lds $(u-boot-init) \
-Wl,--whole-archive \
$(u-boot-main) \
$(u-boot-keep-syms-lto) \
$(PLATFORM_LIBS) \
-Wl,--no-whole-archive \
-Wl,-Map,u-boot.map; \
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
else
quiet_cmd_u-boot__ ?= LD $@ quiet_cmd_u-boot__ ?= LD $@
cmd_u-boot__ ?= $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ cmd_u-boot__ ?= $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_u-boot) -o $@ \
-T u-boot.lds $(u-boot-init) \ -T u-boot.lds $(u-boot-init) \
--start-group $(u-boot-main) --end-group \ --whole-archive \
$(u-boot-main) \
--no-whole-archive \
$(PLATFORM_LIBS) -Map u-boot.map; \ $(PLATFORM_LIBS) -Map u-boot.map; \
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
endif
quiet_cmd_smap = GEN common/system_map.o quiet_cmd_smap = GEN common/system_map.o
cmd_smap = \ cmd_smap = \
@ -1724,7 +1791,7 @@ cmd_smap = \
$(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \ $(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \
-c $(srctree)/common/system_map.c -o common/system_map.o -c $(srctree)/common/system_map.c -o common/system_map.o
u-boot: $(u-boot-init) $(u-boot-main) u-boot.lds FORCE u-boot: $(u-boot-init) $(u-boot-main) $(u-boot-keep-syms-lto) u-boot.lds FORCE
+$(call if_changed,u-boot__) +$(call if_changed,u-boot__)
ifeq ($(CONFIG_KALLSYMS),y) ifeq ($(CONFIG_KALLSYMS),y)
$(call cmd,smap) $(call cmd,smap)
@ -2007,7 +2074,7 @@ CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \
boot* u-boot* MLO* SPL System.map fit-dtb.blob* \ boot* u-boot* MLO* SPL System.map fit-dtb.blob* \
u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \ u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \
lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \ lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \
idbloader.img flash.bin flash.log defconfig idbloader.img flash.bin flash.log defconfig keep-syms-lto.c
# Directories & files removed with 'make mrproper' # Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config include/generated spl tpl \ MRPROPER_DIRS += include/config include/generated spl tpl \

View file

@ -33,6 +33,7 @@ config ARC
config ARM config ARM
bool "ARM architecture" bool "ARM architecture"
select ARCH_SUPPORTS_LTO
select CREATE_ARCH_SYMLINK select CREATE_ARCH_SYMLINK
select HAVE_PRIVATE_LIBGCC if !ARM64 select HAVE_PRIVATE_LIBGCC if !ARM64
select SUPPORT_OF_CONTROL select SUPPORT_OF_CONTROL
@ -101,6 +102,7 @@ config RISCV
config SANDBOX config SANDBOX
bool "Sandbox" bool "Sandbox"
select ARCH_SUPPORTS_LTO
select BOARD_LATE_INIT select BOARD_LATE_INIT
select BZIP2 select BZIP2
select CMD_POWEROFF select CMD_POWEROFF
@ -124,6 +126,7 @@ config SANDBOX
select SUPPORT_EXTENSION_SCAN select SUPPORT_EXTENSION_SCAN
imply BITREVERSE imply BITREVERSE
select BLOBLIST select BLOBLIST
imply LTO
imply CMD_DM imply CMD_DM
imply CMD_EXCEPTION imply CMD_EXCEPTION
imply CMD_GETTIME imply CMD_GETTIME

View file

@ -15,9 +15,15 @@ CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections \
-fstack-protector-strong -fstack-protector-strong
CFLAGS_EFI := -fpic -fshort-wchar CFLAGS_EFI := -fpic -fshort-wchar
ifneq ($(CONFIG_LTO)$(CONFIG_USE_PRIVATE_LIBGCC),yy)
LDFLAGS_FINAL += --gc-sections LDFLAGS_FINAL += --gc-sections
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \ endif
-fno-common -ffixed-r9
ifndef CONFIG_LTO
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
endif
PLATFORM_RELFLAGS += -fno-common -ffixed-r9
PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \ PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \
$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))

View file

@ -25,6 +25,8 @@ ifndef CONFIG_HAS_THUMB2
CFLAGS_cpu.o := -marm CFLAGS_cpu.o := -marm
CFLAGS_cache.o := -marm CFLAGS_cache.o := -marm
CFLAGS_REMOVE_cpu.o := $(LTO_CFLAGS)
CFLAGS_REMOVE_cache.o := $(LTO_CFLAGS)
endif endif
endif endif

View file

@ -25,6 +25,7 @@
#include <asm/arch/iomux.h> #include <asm/arch/iomux.h>
#include <asm/arch/imx-regs.h> #include <asm/arch/imx-regs.h>
#include <asm/arch/sys_proto.h> #include <asm/arch/sys_proto.h>
#include <asm/sections.h>
#include <linux/compiler.h> #include <linux/compiler.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
@ -98,7 +99,6 @@ int arch_cpu_init(void)
{ {
struct mxs_clkctrl_regs *clkctrl_regs = struct mxs_clkctrl_regs *clkctrl_regs =
(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE; (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
extern uint32_t _start;
mx28_fixup_vt((uint32_t)&_start); mx28_fixup_vt((uint32_t)&_start);

View file

@ -16,6 +16,7 @@
#include <asm/arch/imx-regs.h> #include <asm/arch/imx-regs.h>
#include <asm/arch/sys_proto.h> #include <asm/arch/sys_proto.h>
#include <asm/gpio.h> #include <asm/gpio.h>
#include <asm/sections.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include "mxs_init.h" #include "mxs_init.h"
@ -100,7 +101,6 @@ static void mxs_spl_fixup_vectors(void)
* thus this fixup. Our vectoring table is PIC, so copying is * thus this fixup. Our vectoring table is PIC, so copying is
* fine. * fine.
*/ */
extern uint32_t _start;
/* cppcheck-suppress nullPointer */ /* cppcheck-suppress nullPointer */
memcpy(0x0, &_start, 0x60); memcpy(0x0, &_start, 0x60);
@ -122,7 +122,7 @@ void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr,
{ {
struct mxs_spl_data *data = MXS_SPL_DATA; struct mxs_spl_data *data = MXS_SPL_DATA;
uint8_t bootmode = mxs_get_bootmode_index(); uint8_t bootmode = mxs_get_bootmode_index();
gd = &gdata; set_gd(&gdata);
mxs_spl_fixup_vectors(); mxs_spl_fixup_vectors();

View file

@ -22,7 +22,7 @@
* The BSS cannot be used for this purpose because it will be zeroed after * The BSS cannot be used for this purpose because it will be zeroed after
* having stored the pointer, so force the location to the data section. * having stored the pointer, so force the location to the data section.
*/ */
u32 bootrom_stash_sp __attribute__((section(".data"))); u32 bootrom_stash_sp __section(".data");
static void ddr_clock_init(void) static void ddr_clock_init(void)
{ {

View file

@ -14,7 +14,7 @@ int __weak clk_sdio_enable(void *base, u32 rate, u32 *actual_ratep)
return 0; return 0;
} }
int __weak clk_bsc_enable(void *base, u32 rate, u32 *actual_ratep) int __weak clk_bsc_enable(void *base)
{ {
return 0; return 0;
} }

View file

@ -13,7 +13,7 @@
#include <fsl_immap.h> #include <fsl_immap.h>
#include "fsl_epu.h" #include "fsl_epu.h"
#define __secure __attribute__((section("._secure.text"))) #define __secure __section("._secure.text")
#define CCSR_GICD_CTLR 0x1000 #define CCSR_GICD_CTLR 0x1000
#define CCSR_GICC_CTLR 0x2000 #define CCSR_GICC_CTLR 0x2000

View file

@ -6,8 +6,8 @@
#include <common.h> #include <common.h>
#include <spl.h> #include <spl.h>
char __data_save_start[0] __section(.__data_save_start); char __data_save_start[0] __section(".__data_save_start");
char __data_save_end[0] __section(.__data_save_end); char __data_save_end[0] __section(".__data_save_end");
u32 cold_reboot_flag = 1; u32 cold_reboot_flag = 1;

View file

@ -77,6 +77,7 @@ SECTIONS
KEEP(*(.__bss_end)); KEEP(*(.__bss_end));
} >.sdram } >.sdram
/DISCARD/ : { *(.rela*) }
/DISCARD/ : { *(.dynsym) } /DISCARD/ : { *(.dynsym) }
/DISCARD/ : { *(.dynstr*) } /DISCARD/ : { *(.dynstr*) }
/DISCARD/ : { *(.dynamic*) } /DISCARD/ : { *(.dynamic*) }

View file

@ -91,7 +91,7 @@ struct arch_global_data {
#include <asm-generic/global_data.h> #include <asm-generic/global_data.h>
#ifdef __clang__ #if defined(__clang__) || defined(CONFIG_LTO)
#define DECLARE_GLOBAL_DATA_PTR #define DECLARE_GLOBAL_DATA_PTR
#define gd get_gd() #define gd get_gd()
@ -122,8 +122,10 @@ static inline void set_gd(volatile gd_t *gd_ptr)
{ {
#ifdef CONFIG_ARM64 #ifdef CONFIG_ARM64
__asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr)); __asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr));
#else #elif __ARM_ARCH >= 7
__asm__ volatile("ldr r9, %0\n" : : "m"(gd_ptr)); __asm__ volatile("ldr r9, %0\n" : : "m"(gd_ptr));
#else
__asm__ volatile("mov r9, %0\n" : : "r"(gd_ptr));
#endif #endif
} }

View file

@ -4,8 +4,8 @@
#include <config.h> #include <config.h>
#include <asm/global_data.h> #include <asm/global_data.h>
#define __secure __attribute__ ((section ("._secure.text"))) #define __secure __section("._secure.text")
#define __secure_data __attribute__ ((section ("._secure.data"))) #define __secure_data __section("._secure.data")
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
@ -22,7 +22,7 @@ typedef struct secure_svc_tbl {
*/ */
#define DECLARE_SECURE_SVC(_name, _id, _fn) \ #define DECLARE_SECURE_SVC(_name, _id, _fn) \
static const secure_svc_tbl_t __secure_svc_ ## _name \ static const secure_svc_tbl_t __secure_svc_ ## _name \
__attribute__((used, section("._secure_svc_tbl_entries"))) \ __used __section("._secure_svc_tbl_entries") \
= { \ = { \
.id = _id, \ .id = _id, \
.func = _fn } .func = _fn }

View file

@ -235,7 +235,7 @@ struct tagtable {
int (*parse)(const struct tag *); int (*parse)(const struct tag *);
}; };
#define __tag __attribute__((unused, __section__(".taglist"))) #define __tag __attribute__((unused)) __section(".taglist")
#define __tagtable(tag, fn) \ #define __tagtable(tag, fn) \
static struct tagtable __tagtable_##fn __tag = { tag, fn } static struct tagtable __tagtable_##fn __tag = { tag, fn }

View file

@ -45,6 +45,8 @@ obj-$(CONFIG_SEMIHOSTING) += semihosting.o
obj-y += bdinfo.o obj-y += bdinfo.o
obj-y += sections.o obj-y += sections.o
CFLAGS_REMOVE_sections.o := $(LTO_CFLAGS)
obj-y += stack.o obj-y += stack.o
ifdef CONFIG_CPU_V7M ifdef CONFIG_CPU_V7M
obj-y += interrupts_m.o obj-y += interrupts_m.o
@ -64,6 +66,7 @@ endif
obj-y += cache.o obj-y += cache.o
obj-$(CONFIG_SYS_ARM_CACHE_CP15) += cache-cp15.o obj-$(CONFIG_SYS_ARM_CACHE_CP15) += cache-cp15.o
CFLAGS_REMOVE_cache-cp15.o := $(LTO_CFLAGS)
obj-y += psci-dt.o obj-y += psci-dt.o

View file

@ -2,6 +2,7 @@
/* /*
* Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net> * Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net>
*/ */
#include <linux/compiler.h>
/** /**
* These two symbols are declared in a C file so that the linker * These two symbols are declared in a C file so that the linker
@ -18,18 +19,18 @@
* aliasing warnings. * aliasing warnings.
*/ */
char __bss_start[0] __attribute__((section(".__bss_start"))); char __bss_start[0] __section(".__bss_start");
char __bss_end[0] __attribute__((section(".__bss_end"))); char __bss_end[0] __section(".__bss_end");
char __image_copy_start[0] __attribute__((section(".__image_copy_start"))); char __image_copy_start[0] __section(".__image_copy_start");
char __image_copy_end[0] __attribute__((section(".__image_copy_end"))); char __image_copy_end[0] __section(".__image_copy_end");
char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start"))); char __rel_dyn_start[0] __section(".__rel_dyn_start");
char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end"))); char __rel_dyn_end[0] __section(".__rel_dyn_end");
char __secure_start[0] __attribute__((section(".__secure_start"))); char __secure_start[0] __section(".__secure_start");
char __secure_end[0] __attribute__((section(".__secure_end"))); char __secure_end[0] __section(".__secure_end");
char __secure_stack_start[0] __attribute__((section(".__secure_stack_start"))); char __secure_stack_start[0] __section(".__secure_stack_start");
char __secure_stack_end[0] __attribute__((section(".__secure_stack_end"))); char __secure_stack_end[0] __section(".__secure_stack_end");
char __efi_runtime_start[0] __attribute__((section(".__efi_runtime_start"))); char __efi_runtime_start[0] __section(".__efi_runtime_start");
char __efi_runtime_stop[0] __attribute__((section(".__efi_runtime_stop"))); char __efi_runtime_stop[0] __section(".__efi_runtime_stop");
char __efi_runtime_rel_start[0] __attribute__((section(".__efi_runtime_rel_start"))); char __efi_runtime_rel_start[0] __section(".__efi_runtime_rel_start");
char __efi_runtime_rel_stop[0] __attribute__((section(".__efi_runtime_rel_stop"))); char __efi_runtime_rel_stop[0] __section(".__efi_runtime_rel_stop");
char _end[0] __attribute__((section(".__end"))); char _end[0] __section(".__end");

View file

@ -26,7 +26,7 @@ DECLARE_GLOBAL_DATA_PTR;
* WARNING: This is going away very soon. Don't use it and don't submit * WARNING: This is going away very soon. Don't use it and don't submit
* pafches that rely on it. The global_data area is set up in crt0.S. * pafches that rely on it. The global_data area is set up in crt0.S.
*/ */
gd_t gdata __attribute__ ((section(".data"))); gd_t gdata __section(".data");
#endif #endif
/* /*

View file

@ -26,7 +26,7 @@ void at91_disable_wdt(void)
#include <asm/arch/sama5_boot.h> #include <asm/arch/sama5_boot.h>
struct { struct {
u32 r4; u32 r4;
} bootrom_stash __attribute__((section(".data"))); } bootrom_stash __section(".data");
u32 spl_boot_device(void) u32 spl_boot_device(void)
{ {

View file

@ -279,7 +279,7 @@ void memzero(void *s, size_t n)
*/ */
static void setup_global_data(gd_t *gdp) static void setup_global_data(gd_t *gdp)
{ {
gd = gdp; set_gd(gdp);
memzero((void *)gd, sizeof(gd_t)); memzero((void *)gd, sizeof(gd_t));
gd->flags |= GD_FLG_RELOC; gd->flags |= GD_FLG_RELOC;
gd->baudrate = CONFIG_BAUDRATE; gd->baudrate = CONFIG_BAUDRATE;

View file

@ -846,7 +846,7 @@ int set_clk_eqos(enum enet_freq type)
return 0; return 0;
} }
int imx_eqos_txclk_set_rate(u32 rate) int imx_eqos_txclk_set_rate(ulong rate)
{ {
u32 val; u32 val;
u32 eqos_post_div; u32 eqos_post_div;

View file

@ -537,7 +537,7 @@ enum boot_device get_boot_device(void)
ret = g_rom_api->query_boot_infor(QUERY_BT_DEV, &boot, ret = g_rom_api->query_boot_infor(QUERY_BT_DEV, &boot,
((uintptr_t)&boot) ^ QUERY_BT_DEV); ((uintptr_t)&boot) ^ QUERY_BT_DEV);
gd = pgd; set_gd(pgd);
if (ret != ROM_API_OKAY) { if (ret != ROM_API_OKAY) {
puts("ROMAPI: failure at query_boot_info\n"); puts("ROMAPI: failure at query_boot_info\n");

View file

@ -45,7 +45,7 @@ static ulong spl_romapi_read_seekable(struct spl_load_info *load,
ret = g_rom_api->download_image(buf, offset, byte, ret = g_rom_api->download_image(buf, offset, byte,
((uintptr_t)buf) ^ offset ^ byte); ((uintptr_t)buf) ^ offset ^ byte);
gd = pgd; set_gd(pgd);
if (ret == ROM_API_OKAY) if (ret == ROM_API_OKAY)
return count; return count;
@ -73,7 +73,7 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image,
ret |= g_rom_api->query_boot_infor(QUERY_IMG_OFF, &image_offset, ret |= g_rom_api->query_boot_infor(QUERY_IMG_OFF, &image_offset,
((uintptr_t)&image_offset) ^ QUERY_IMG_OFF); ((uintptr_t)&image_offset) ^ QUERY_IMG_OFF);
gd = pgd; set_gd(pgd);
if (ret != ROM_API_OKAY) { if (ret != ROM_API_OKAY) {
puts("ROMAPI: Failure query boot infor pagesize/offset\n"); puts("ROMAPI: Failure query boot infor pagesize/offset\n");
@ -94,7 +94,7 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image,
size = ALIGN(sizeof(struct image_header), pagesize); size = ALIGN(sizeof(struct image_header), pagesize);
ret = g_rom_api->download_image((u8 *)header, offset, size, ret = g_rom_api->download_image((u8 *)header, offset, size,
((uintptr_t)header) ^ offset ^ size); ((uintptr_t)header) ^ offset ^ size);
gd = pgd; set_gd(pgd);
if (ret != ROM_API_OKAY) { if (ret != ROM_API_OKAY) {
printf("ROMAPI: download failure offset 0x%x size 0x%x\n", printf("ROMAPI: download failure offset 0x%x size 0x%x\n",
@ -180,7 +180,7 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image,
ret = g_rom_api->query_boot_infor(QUERY_PAGE_SZ, &pagesize, ret = g_rom_api->query_boot_infor(QUERY_PAGE_SZ, &pagesize,
((uintptr_t)&pagesize) ^ QUERY_PAGE_SZ); ((uintptr_t)&pagesize) ^ QUERY_PAGE_SZ);
gd = pgd; set_gd(pgd);
if (ret != ROM_API_OKAY) if (ret != ROM_API_OKAY)
puts("failure at query_boot_info\n"); puts("failure at query_boot_info\n");
@ -192,7 +192,7 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image,
for (i = 0; i < 640; i++) { for (i = 0; i < 640; i++) {
ret = g_rom_api->download_image(p, 0, pg, ret = g_rom_api->download_image(p, 0, pg,
((uintptr_t)p) ^ pg); ((uintptr_t)p) ^ pg);
gd = pgd; set_gd(pgd);
if (ret != ROM_API_OKAY) { if (ret != ROM_API_OKAY) {
puts("Steam(USB) download failure\n"); puts("Steam(USB) download failure\n");
@ -213,7 +213,7 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image,
if (p - pfit < sizeof(struct fdt_header)) { if (p - pfit < sizeof(struct fdt_header)) {
ret = g_rom_api->download_image(p, 0, pg, ((uintptr_t)p) ^ pg); ret = g_rom_api->download_image(p, 0, pg, ((uintptr_t)p) ^ pg);
gd = pgd; set_gd(pgd);
if (ret != ROM_API_OKAY) { if (ret != ROM_API_OKAY) {
puts("Steam(USB) download failure\n"); puts("Steam(USB) download failure\n");
@ -237,7 +237,7 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image,
ret = g_rom_api->download_image(p, 0, imagesize, ret = g_rom_api->download_image(p, 0, imagesize,
((uintptr_t)p) ^ imagesize); ((uintptr_t)p) ^ imagesize);
gd = pgd; set_gd(pgd);
p += imagesize; p += imagesize;
@ -280,7 +280,7 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
ret = g_rom_api->query_boot_infor(QUERY_BT_DEV, &boot, ret = g_rom_api->query_boot_infor(QUERY_BT_DEV, &boot,
((uintptr_t)&boot) ^ QUERY_BT_DEV); ((uintptr_t)&boot) ^ QUERY_BT_DEV);
gd = pgd; set_gd(pgd);
if (ret != ROM_API_OKAY) { if (ret != ROM_API_OKAY) {
puts("ROMAPI: failure at query_boot_info\n"); puts("ROMAPI: failure at query_boot_info\n");

View file

@ -44,7 +44,7 @@ static void ctrl_mmr_unlock(void)
* it to the .data section. * it to the .data section.
*/ */
u32 bootindex __section(".data"); u32 bootindex __section(".data");
static struct rom_extended_boot_data bootdata __section(.data); static struct rom_extended_boot_data bootdata __section(".data");
static void store_boot_info_from_rom(void) static void store_boot_info_from_rom(void)
{ {

View file

@ -77,7 +77,7 @@ static void ctrl_mmr_unlock(void)
* but the .bss is cleared between writing and reading this variable, so move * but the .bss is cleared between writing and reading this variable, so move
* it to the .data section. * it to the .data section.
*/ */
u32 bootindex __attribute__((section(".data"))); u32 bootindex __section(".data");
static void store_boot_index_from_rom(void) static void store_boot_index_from_rom(void)
{ {

View file

@ -125,8 +125,8 @@ void k3_mmc_restart_clock(void)
* but the .bss is cleared between writing and reading this variable, so move * but the .bss is cleared between writing and reading this variable, so move
* it to the .data section. * it to the .data section.
*/ */
u32 bootindex __attribute__((section(".data"))); u32 bootindex __section(".data");
static struct rom_extended_boot_data bootdata __section(.data); static struct rom_extended_boot_data bootdata __section(".data");
static void store_boot_info_from_rom(void) static void store_boot_info_from_rom(void)
{ {

View file

@ -9,6 +9,7 @@ obj-y += init.o
obj-y += psc.o obj-y += psc.o
obj-y += clock.o obj-y += clock.o
obj-y += mon.o obj-y += mon.o
CFLAGS_REMOVE_mon.o := $(LTO_CFLAGS)
ifndef CONFIG_SPL_BUILD ifndef CONFIG_SPL_BUILD
obj-y += cmd_clock.o obj-y += cmd_clock.o
obj-y += cmd_mon.o obj-y += cmd_mon.o

View file

@ -98,9 +98,9 @@ struct mvebu_mbus_soc_data {
}; };
struct mvebu_mbus_state mbus_state struct mvebu_mbus_state mbus_state
__attribute__ ((section(".data"))); __section(".data");
static struct mbus_dram_target_info mbus_dram_info static struct mbus_dram_target_info mbus_dram_info
__attribute__ ((section(".data"))); __section(".data");
/* /*
* Functions to manipulate the address decoding windows * Functions to manipulate the address decoding windows

View file

@ -14,7 +14,7 @@
#define TIMER_LOAD_VAL 0xffffffff #define TIMER_LOAD_VAL 0xffffffff
static int init_done __attribute__((section(".data"))) = 0; static int init_done __section(".data") = 0;
/* /*
* Timer initialization * Timer initialization

View file

@ -99,7 +99,7 @@ static const char * const clk_core[] = {
* in board_init_f(), respectively! I.e. global variables can not be used! * in board_init_f(), respectively! I.e. global variables can not be used!
*/ */
static struct clk_dev_peri clk_periphs[] static struct clk_dev_peri clk_periphs[]
__attribute__((section(".data"))) = { __section(".data") = {
CLK_PERI_1S(DEV_NAME_TIMER, 0, CLK_ID_TIMER_0, CLK_PERI_1S(DEV_NAME_TIMER, 0, CLK_ID_TIMER_0,
PHY_BASEADDR_CLKGEN14, (I_PLL_0_2)), PHY_BASEADDR_CLKGEN14, (I_PLL_0_2)),
CLK_PERI_1S(DEV_NAME_TIMER, 1, CLK_ID_TIMER_1, CLK_PERI_1S(DEV_NAME_TIMER, 1, CLK_ID_TIMER_1,
@ -167,7 +167,7 @@ static struct clk_dev_peri clk_periphs[]
#define MAX_DIVIDER ((1 << 8) - 1) /* 256, align 2 */ #define MAX_DIVIDER ((1 << 8) - 1) /* 256, align 2 */
static struct clk_dev st_clk_devs[CLK_DEVS_NUM] static struct clk_dev st_clk_devs[CLK_DEVS_NUM]
__attribute__((section(".data"))); __section(".data");
#define clk_dev_get(n) ((struct clk_dev *)&st_clk_devs[n]) #define clk_dev_get(n) ((struct clk_dev *)&st_clk_devs[n])
#define clk_container(p) (container_of(p, struct clk_dev, clk)) #define clk_container(p) (container_of(p, struct clk_dev, clk))
@ -196,7 +196,7 @@ struct _core_hz_ {
* in board_init_f(), respectively! I.e. global variables can not be used! * in board_init_f(), respectively! I.e. global variables can not be used!
*/ */
/* core clock */ /* core clock */
static struct _core_hz_ core_hz __attribute__((section(".data"))); static struct _core_hz_ core_hz __section(".data");
#define CORE_HZ_SIZE (sizeof(core_hz) / 4) #define CORE_HZ_SIZE (sizeof(core_hz) / 4)

View file

@ -23,9 +23,9 @@
* Section ".data" must be used because BSS is not available before relocation, * Section ".data" must be used because BSS is not available before relocation,
* in board_init_f(), respectively! I.e. global variables can not be used! * in board_init_f(), respectively! I.e. global variables can not be used!
*/ */
static unsigned long timestamp __attribute__ ((section(".data"))); static unsigned long timestamp __section(".data");
static unsigned long lastdec __attribute__ ((section(".data"))); static unsigned long lastdec __section(".data");
static int timerinit __attribute__ ((section(".data"))); static int timerinit __section(".data");
/* macro to hw timer tick config */ /* macro to hw timer tick config */
static long TIMER_FREQ = 1000000; static long TIMER_FREQ = 1000000;

View file

@ -9,6 +9,7 @@ CFLAGS_clock.o += -marm
obj-y := lowlevel_init.o obj-y := lowlevel_init.o
obj-y += board.o obj-y += board.o
CFLAGS_REMOVE_board.o := $(LTO_CFLAGS)
obj-y += boot.o obj-y += boot.o
obj-y += clock.o obj-y += clock.o
obj-y += sys_info.o obj-y += sys_info.o

View file

@ -139,7 +139,7 @@ static struct dwc3_device dwc3_device_data = {
.hsphy_mode = USBPHY_INTERFACE_MODE_UTMIW, .hsphy_mode = USBPHY_INTERFACE_MODE_UTMIW,
}; };
int usb_gadget_handle_interrupts(void) int usb_gadget_handle_interrupts(int index)
{ {
dwc3_uboot_handle_interrupt(0); dwc3_uboot_handle_interrupt(0);
return 0; return 0;

View file

@ -40,7 +40,7 @@ DECLARE_GLOBAL_DATA_PTR;
SOCFPGA_PHYS_OCRAM_SIZE - \ SOCFPGA_PHYS_OCRAM_SIZE - \
BOOTROM_SHARED_MEM_SIZE) BOOTROM_SHARED_MEM_SIZE)
#define RST_STATUS_SHARED_ADDR (BOOTROM_SHARED_MEM_ADDR + 0x438) #define RST_STATUS_SHARED_ADDR (BOOTROM_SHARED_MEM_ADDR + 0x438)
static u32 rst_mgr_status __section(.data); static u32 rst_mgr_status __section(".data");
/* /*
* Bootrom will clear the status register in reset manager and stores the * Bootrom will clear the status register in reset manager and stores the

View file

@ -39,7 +39,7 @@ struct fel_stash {
uint32_t cr; uint32_t cr;
}; };
struct fel_stash fel_stash __attribute__((section(".data"))); struct fel_stash fel_stash __section(".data");
#ifdef CONFIG_ARM64 #ifdef CONFIG_ARM64
#include <asm/armv8/mmu.h> #include <asm/armv8/mmu.h>

View file

@ -45,7 +45,7 @@ enum {
UART_COUNT = 5, UART_COUNT = 5,
}; };
static bool from_spl __attribute__ ((section(".data"))); static bool from_spl __section(".data");
#ifndef CONFIG_SPL_BUILD #ifndef CONFIG_SPL_BUILD
void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2, void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2,

View file

@ -49,7 +49,7 @@ extern struct mm_region tegra_mem_map[];
*/ */
/* The number of valid entries in ram_banks[] */ /* The number of valid entries in ram_banks[] */
static int ram_bank_count __attribute__((section(".data"))); static int ram_bank_count __section(".data");
/* /*
* The usable top-of-RAM for U-Boot. This is both: * The usable top-of-RAM for U-Boot. This is both:
@ -57,15 +57,15 @@ static int ram_bank_count __attribute__((section(".data")));
* b) At the end of a region that has enough space to hold the relocated U-Boot * b) At the end of a region that has enough space to hold the relocated U-Boot
* and all other allocations made around it (stack, heap, page tables, etc.) * and all other allocations made around it (stack, heap, page tables, etc.)
*/ */
static u64 ram_top __attribute__((section(".data"))); static u64 ram_top __section(".data");
/* The base address of the region of RAM that ends at ram_top */ /* The base address of the region of RAM that ends at ram_top */
static u64 region_base __attribute__((section(".data"))); static u64 region_base __section(".data");
/* /*
* Explicitly put this in the .data section because it is written before the * Explicitly put this in the .data section because it is written before the
* .bss section is zeroed out but it needs to persist. * .bss section is zeroed out but it needs to persist.
*/ */
unsigned long cboot_boot_x0 __attribute__((section(".data"))); unsigned long cboot_boot_x0 __section(".data");
void cboot_save_boot_params(unsigned long x0, unsigned long x1, void cboot_save_boot_params(unsigned long x0, unsigned long x1,
unsigned long x2, unsigned long x3) unsigned long x2, unsigned long x3)

View file

@ -10,6 +10,7 @@ endif
# flags for any startup files it might use. # flags for any startup files it might use.
CFLAGS_warmboot_avp.o = -march=armv4t -U__LINUX_ARM_ARCH__ \ CFLAGS_warmboot_avp.o = -march=armv4t -U__LINUX_ARM_ARCH__ \
-D__LINUX_ARM_ARCH__=4 -D__LINUX_ARM_ARCH__=4
CFLAGS_REMOVE_warmboot_avp.o := $(LTO_CFLAGS)
obj-y += clock.o funcmux.o pinmux.o obj-y += clock.o funcmux.o pinmux.o
obj-$(CONFIG_TEGRA_LP0) += warmboot.o crypto.o warmboot_avp.o obj-$(CONFIG_TEGRA_LP0) += warmboot.o crypto.o warmboot_avp.o

View file

@ -23,7 +23,7 @@
#ifdef CONFIG_SPL_BUILD #ifdef CONFIG_SPL_BUILD
/* Pointer to the global data structure for SPL */ /* Pointer to the global data structure for SPL */
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
gd_t gdata __attribute__ ((section(".bss"))); gd_t gdata __section(".bss");
void board_init_f(ulong dummy) void board_init_f(ulong dummy)
{ {

View file

@ -155,7 +155,7 @@ struct tagtable {
#ifdef __KERNEL__ #ifdef __KERNEL__
#define __tag __used __attribute__((__section__(".taglist"))) #define __tag __used __section(".taglist")
#define __tagtable(tag, fn) \ #define __tagtable(tag, fn) \
static struct tagtable __tagtable_##fn __tag = { tag, fn } static struct tagtable __tagtable_##fn __tag = { tag, fn }
@ -183,7 +183,7 @@ struct early_params {
#define __early_param(name, fn) \ #define __early_param(name, fn) \
static struct early_params __early_##fn __used \ static struct early_params __early_##fn __used \
__attribute__((__section__("__early_param"))) = { name, fn } __section("__early_param") = { name, fn }
#endif #endif
#endif #endif

View file

@ -41,8 +41,8 @@
#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES))) #define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
#else #else
#define __cacheline_aligned \ #define __cacheline_aligned \
__attribute__((__aligned__(L1_CACHE_BYTES), \ __attribute__((__aligned__(L1_CACHE_BYTES))) \
__section__(".data.cacheline_aligned"))) __section(".data.cacheline_aligned")
#endif #endif
#if defined(__KERNEL__) && !defined(__ASSEMBLY__) #if defined(__KERNEL__) && !defined(__ASSEMBLY__)

View file

@ -17,10 +17,10 @@
* before the bss section is available. * before the bss section is available.
*/ */
#ifdef CONFIG_OF_PRIOR_STAGE #ifdef CONFIG_OF_PRIOR_STAGE
phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); phys_addr_t prior_stage_fdt_address __section(".data");
#endif #endif
#ifndef CONFIG_XIP #ifndef CONFIG_XIP
u32 hart_lottery __attribute__((section(".data"))) = 0; u32 hart_lottery __section(".data") = 0;
/* /*
* The main hart running U-Boot has acquired available_harts_lock until it has * The main hart running U-Boot has acquired available_harts_lock until it has

View file

@ -17,13 +17,21 @@ PLATFORM_CPPFLAGS += $(shell $(SDL_CONFIG) --cflags)
endif endif
cmd_u-boot__ = $(CC) -o $@ -Wl,-T u-boot.lds $(u-boot-init) \ cmd_u-boot__ = $(CC) -o $@ -Wl,-T u-boot.lds $(u-boot-init) \
-Wl,--start-group $(u-boot-main) -Wl,--end-group \ $(LTO_FINAL_LDFLAGS) \
-Wl,--whole-archive \
$(u-boot-main) \
$(u-boot-keep-syms-lto) \
-Wl,--no-whole-archive \
$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map
cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \ cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \
$(LTO_FINAL_LDFLAGS) \
$(patsubst $(obj)/%,%,$(u-boot-spl-init)) \ $(patsubst $(obj)/%,%,$(u-boot-spl-init)) \
-Wl,--start-group $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \ -Wl,--whole-archive \
$(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) -Wl,--end-group \ $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \
$(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) \
$(patsubst $(obj)/%,%,$(u-boot-spl-keep-syms-lto)) \
-Wl,--no-whole-archive \
$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot-spl.map -Wl,--gc-sections) $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot-spl.map -Wl,--gc-sections)
CONFIG_ARCH_DEVICE_TREE := sandbox CONFIG_ARCH_DEVICE_TREE := sandbox

View file

@ -375,7 +375,8 @@ static struct option *long_opts;
int os_parse_args(struct sandbox_state *state, int argc, char *argv[]) int os_parse_args(struct sandbox_state *state, int argc, char *argv[])
{ {
struct sandbox_cmdline_option **sb_opt = __u_boot_sandbox_option_start; struct sandbox_cmdline_option **sb_opt =
__u_boot_sandbox_option_start();
size_t num_options = __u_boot_sandbox_option_count(); size_t num_options = __u_boot_sandbox_option_count();
size_t i; size_t i;

View file

@ -58,7 +58,8 @@ static int h_compare_opt(const void *p1, const void *p2)
int sandbox_early_getopt_check(void) int sandbox_early_getopt_check(void)
{ {
struct sandbox_state *state = state_get_current(); struct sandbox_state *state = state_get_current();
struct sandbox_cmdline_option **sb_opt = __u_boot_sandbox_option_start; struct sandbox_cmdline_option **sb_opt =
__u_boot_sandbox_option_start();
size_t num_options = __u_boot_sandbox_option_count(); size_t num_options = __u_boot_sandbox_option_count();
size_t i; size_t i;
int max_arg_len, max_noarg_len; int max_arg_len, max_noarg_len;

View file

@ -21,9 +21,11 @@ SECTIONS
__priv_data_end = .; __priv_data_end = .;
} }
__u_boot_sandbox_option_start = .; _u_boot_sandbox_getopt : {
_u_boot_sandbox_getopt : { KEEP(*(.u_boot_sandbox_getopt)) } *(.u_boot_sandbox_getopt_start)
__u_boot_sandbox_option_end = .; KEEP(*(.u_boot_sandbox_getopt))
*(.u_boot_sandbox_getopt_end)
}
} }
INSERT AFTER .data; INSERT AFTER .data;

View file

@ -13,9 +13,11 @@ SECTIONS
KEEP(*(SORT(.u_boot_list*))); KEEP(*(SORT(.u_boot_list*)));
} }
__u_boot_sandbox_option_start = .; _u_boot_sandbox_getopt : {
_u_boot_sandbox_getopt : { *(.u_boot_sandbox_getopt) } *(.u_boot_sandbox_getopt_start)
__u_boot_sandbox_option_end = .; *(.u_boot_sandbox_getopt)
*(.u_boot_sandbox_getopt_end)
}
.__efi_runtime_start : { .__efi_runtime_start : {
*(.__efi_runtime_start) *(.__efi_runtime_start)

View file

@ -44,7 +44,7 @@ struct sandbox_cmdline_option {
.callback = sandbox_cmdline_cb_##f, \ .callback = sandbox_cmdline_cb_##f, \
}; \ }; \
/* Ppointer to the struct in a special section for the linker script */ \ /* Ppointer to the struct in a special section for the linker script */ \
static __attribute__((section(".u_boot_sandbox_getopt"), used)) \ static __used __section(".u_boot_sandbox_getopt") \
struct sandbox_cmdline_option \ struct sandbox_cmdline_option \
*sandbox_cmdline_option_##f##_ptr = \ *sandbox_cmdline_option_##f##_ptr = \
&sandbox_cmdline_option_##f &sandbox_cmdline_option_##f

View file

@ -13,12 +13,27 @@
struct sandbox_cmdline_option; struct sandbox_cmdline_option;
extern struct sandbox_cmdline_option *__u_boot_sandbox_option_start[], static inline struct sandbox_cmdline_option **
*__u_boot_sandbox_option_end[]; __u_boot_sandbox_option_start(void)
{
static char start[0] __aligned(4) __attribute__((unused))
__section(".u_boot_sandbox_getopt_start");
return (struct sandbox_cmdline_option **)&start;
}
static inline struct sandbox_cmdline_option **
__u_boot_sandbox_option_end(void)
{
static char end[0] __aligned(4) __attribute__((unused))
__section(".u_boot_sandbox_getopt_end");
return (struct sandbox_cmdline_option **)&end;
}
static inline size_t __u_boot_sandbox_option_count(void) static inline size_t __u_boot_sandbox_option_count(void)
{ {
return __u_boot_sandbox_option_end - __u_boot_sandbox_option_start; return __u_boot_sandbox_option_end() - __u_boot_sandbox_option_start();
} }
#endif #endif

View file

@ -3,10 +3,11 @@
* Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net> * Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net>
* *
*/ */
#include <linux/compiler.h>
char __efi_runtime_start[0] __attribute__((section(".__efi_runtime_start"))); char __efi_runtime_start[0] __section(".__efi_runtime_start");
char __efi_runtime_stop[0] __attribute__((section(".__efi_runtime_stop"))); char __efi_runtime_stop[0] __section(".__efi_runtime_stop");
char __efi_runtime_rel_start[0] char __efi_runtime_rel_start[0]
__attribute__((section(".__efi_runtime_rel_start"))); __section(".__efi_runtime_rel_start");
char __efi_runtime_rel_stop[0] char __efi_runtime_rel_stop[0]
__attribute__((section(".__efi_runtime_rel_stop"))); __section(".__efi_runtime_rel_stop");

View file

@ -11,7 +11,7 @@
#include <asm/cb_sysinfo.h> #include <asm/cb_sysinfo.h>
#include <linux/compiler.h> #include <linux/compiler.h>
static struct timestamp_table *ts_table __attribute__((section(".data"))); static struct timestamp_table *ts_table __section(".data");
void timestamp_init(void) void timestamp_init(void)
{ {

View file

@ -21,7 +21,7 @@ DECLARE_GLOBAL_DATA_PTR;
* with zeroes when transitioning from "ROM", which is really RAM, to other * with zeroes when transitioning from "ROM", which is really RAM, to other
* RAM. * RAM.
*/ */
struct sysinfo_t lib_sysinfo __attribute__((section(".data"))); struct sysinfo_t lib_sysinfo __section(".data");
/* /*
* Some of this is x86 specific, and the rest of it is generic. Right now, * Some of this is x86 specific, and the rest of it is generic. Right now,

View file

@ -2,10 +2,11 @@
/* /*
* Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net> * Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net>
*/ */
#include <linux/compiler.h>
char __efi_runtime_start[0] __attribute__((section(".__efi_runtime_start"))); char __efi_runtime_start[0] __section(".__efi_runtime_start");
char __efi_runtime_stop[0] __attribute__((section(".__efi_runtime_stop"))); char __efi_runtime_stop[0] __section(".__efi_runtime_stop");
char __efi_runtime_rel_start[0] char __efi_runtime_rel_start[0]
__attribute__((section(".__efi_runtime_rel_start"))); __section(".__efi_runtime_rel_start");
char __efi_runtime_rel_stop[0] char __efi_runtime_rel_stop[0]
__attribute__((section(".__efi_runtime_rel_stop"))); __section(".__efi_runtime_rel_stop");

View file

@ -20,7 +20,7 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
gd_t *gd __attribute__((section(".data"))); gd_t *gd __section(".data");
#if defined(CONFIG_DISPLAY_CPUINFO) #if defined(CONFIG_DISPLAY_CPUINFO)
/* /*

View file

@ -45,7 +45,7 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
static struct shc_eeprom __attribute__((section(".data"))) header; static struct shc_eeprom __section(".data") header;
static int shc_eeprom_valid; static int shc_eeprom_valid;
/* /*

View file

@ -22,7 +22,7 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
#define BCMSTB_DATA_SECTION __attribute__((section(".data"))) #define BCMSTB_DATA_SECTION __section(".data")
struct bcmstb_boot_parameters bcmstb_boot_parameters BCMSTB_DATA_SECTION; struct bcmstb_boot_parameters bcmstb_boot_parameters BCMSTB_DATA_SECTION;

View file

@ -10,7 +10,7 @@
/* Parameters of early board initialization in SPL */ /* Parameters of early board initialization in SPL */
static struct spl_machine_param machine_param static struct spl_machine_param machine_param
__attribute__((section(".machine_param"))) = { __section(".machine_param") = {
.signature = SIGNATURE, .signature = SIGNATURE,
.version = 1, .version = 1,
.params = "vmubfasirM", .params = "vmubfasirM",

View file

@ -126,7 +126,7 @@ static struct dwc3_device dwc3_device_data = {
.index = 0, .index = 0,
}; };
int usb_gadget_handle_interrupts(void) int usb_gadget_handle_interrupts(int index)
{ {
dwc3_uboot_handle_interrupt(0); dwc3_uboot_handle_interrupt(0);
return 0; return 0;

View file

@ -12,7 +12,7 @@
/* Parameters of early board initialization in SPL */ /* Parameters of early board initialization in SPL */
static struct spl_machine_param machine_param static struct spl_machine_param machine_param
__attribute__((section(".machine_param"))) = { __section(".machine_param") = {
.signature = SIGNATURE, .signature = SIGNATURE,
.version = 1, .version = 1,
.params = "vmubfasirM", .params = "vmubfasirM",

View file

@ -12,7 +12,7 @@
/* Parameters of early board initialization in SPL */ /* Parameters of early board initialization in SPL */
static struct spl_machine_param machine_param static struct spl_machine_param machine_param
__attribute__((section(".machine_param"))) = { __section(".machine_param") = {
.signature = SIGNATURE, .signature = SIGNATURE,
.version = 1, .version = 1,
.params = "vmubfasirM", .params = "vmubfasirM",

View file

@ -41,7 +41,7 @@
#include <nand.h> #include <nand.h>
#ifdef CONFIG_SPL_BUILD #ifdef CONFIG_SPL_BUILD
static struct draco_baseboard_id __attribute__((section(".data"))) settings; static struct draco_baseboard_id __section(".data") settings;
#if DDR_PLL_FREQ == 303 #if DDR_PLL_FREQ == 303
#if !defined(CONFIG_TARGET_ETAMIN) #if !defined(CONFIG_TARGET_ETAMIN)

View file

@ -14,7 +14,7 @@
#include "fru.h" #include "fru.h"
struct fru_table fru_data __section(.data); struct fru_table fru_data __section(".data");
static u16 fru_cal_area_len(u8 len) static u16 fru_cal_area_len(u8 len)
{ {

View file

@ -9,9 +9,16 @@
static int do_test_stackprot_fail(struct cmd_tbl *cmdtp, int flag, int argc, static int do_test_stackprot_fail(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]) char *const argv[])
{ {
/*
* In order to avoid having the compiler optimize away the stack smashing
* we need to do a little something here.
*/
char a[128]; char a[128];
memset(a, 0xa5, 512); memset(a, 0xa5, 512);
printf("We have smashed our stack as this should not exceed 128: sizeof(a) = %ld\n", strlen(a));
return 0; return 0;
} }

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
# CONFIG_SPL_USE_ARCH_MEMCPY is not set # CONFIG_SPL_USE_ARCH_MEMCPY is not set
# CONFIG_SPL_USE_ARCH_MEMSET is not set # CONFIG_SPL_USE_ARCH_MEMSET is not set

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_SYS_THUMB_BUILD=y CONFIG_SYS_THUMB_BUILD=y
CONFIG_ARCH_DAVINCI=y CONFIG_ARCH_DAVINCI=y

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_ARCH_CPU_INIT=y CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_DAVINCI=y CONFIG_ARCH_DAVINCI=y

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_SYS_THUMB_BUILD=y CONFIG_SYS_THUMB_BUILD=y
CONFIG_ARCH_DAVINCI=y CONFIG_ARCH_DAVINCI=y

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_ARCH_MX6=y CONFIG_ARCH_MX6=y
CONFIG_SYS_TEXT_BASE=0x17800000 CONFIG_SYS_TEXT_BASE=0x17800000

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_ARCH_IMX8M=y CONFIG_ARCH_IMX8M=y
CONFIG_SYS_TEXT_BASE=0x40200000 CONFIG_SYS_TEXT_BASE=0x40200000

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_ARCH_IMX8M=y CONFIG_ARCH_IMX8M=y
CONFIG_SYS_TEXT_BASE=0x40200000 CONFIG_SYS_TEXT_BASE=0x40200000

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_ARCH_IMX8M=y CONFIG_ARCH_IMX8M=y
CONFIG_SYS_TEXT_BASE=0x40200000 CONFIG_SYS_TEXT_BASE=0x40200000

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_ARCH_IMX8M=y CONFIG_ARCH_IMX8M=y
CONFIG_SYS_TEXT_BASE=0x40200000 CONFIG_SYS_TEXT_BASE=0x40200000

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
# CONFIG_SYS_THUMB_BUILD is not set # CONFIG_SYS_THUMB_BUILD is not set
CONFIG_ARCH_OMAP2PLUS=y CONFIG_ARCH_OMAP2PLUS=y

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
# CONFIG_SPL_USE_ARCH_MEMCPY is not set # CONFIG_SPL_USE_ARCH_MEMCPY is not set
# CONFIG_SPL_USE_ARCH_MEMSET is not set # CONFIG_SPL_USE_ARCH_MEMSET is not set

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_ARCH_RMOBILE=y CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000 CONFIG_SYS_TEXT_BASE=0x50000000

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_ARCH_RMOBILE=y CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000 CONFIG_SYS_TEXT_BASE=0x50000000

View file

@ -1,3 +1,4 @@
CONFIG_LTO=y
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_ARCH_RMOBILE=y CONFIG_ARCH_RMOBILE=y
CONFIG_SYS_TEXT_BASE=0x50000000 CONFIG_SYS_TEXT_BASE=0x50000000

View file

@ -110,7 +110,7 @@ static int waiting_for_cmd_completed(void __iomem *offset,
return (i < timeout_msec) ? 0 : -1; return (i < timeout_msec) ? 0 : -1;
} }
int __weak ahci_link_up(struct ahci_uc_priv *uc_priv, u8 port) int __weak ahci_link_up(struct ahci_uc_priv *uc_priv, int port)
{ {
u32 tmp; u32 tmp;
int j = 0; int j = 0;

View file

@ -50,7 +50,7 @@
#include "biosemui.h" #include "biosemui.h"
BE_sysEnv _BE_env = {{0}}; BE_sysEnv _BE_env = {{0}};
static X86EMU_memFuncs _BE_mem __attribute__((section(GOT2_TYPE))) = { static X86EMU_memFuncs _BE_mem __section(GOT2_TYPE) = {
BE_rdb, BE_rdb,
BE_rdw, BE_rdw,
BE_rdl, BE_rdl,
@ -59,7 +59,7 @@ static X86EMU_memFuncs _BE_mem __attribute__((section(GOT2_TYPE))) = {
BE_wrl, BE_wrl,
}; };
static X86EMU_pioFuncs _BE_pio __attribute__((section(GOT2_TYPE))) = { static X86EMU_pioFuncs _BE_pio __section(GOT2_TYPE) = {
BE_inb, BE_inb,
BE_inw, BE_inw,
BE_inl, BE_inl,

View file

@ -347,7 +347,7 @@ static const struct k210_comp_params k210_comps[] = {
#undef COMP_NOMUX_ID #undef COMP_NOMUX_ID
#undef COMP_LIST #undef COMP_LIST
static struct clk *k210_bypass_children __section(.data); static struct clk *k210_bypass_children __section(".data");
/* Helper functions to create sub-clocks */ /* Helper functions to create sub-clocks */
static struct clk_mux *k210_create_mux(const struct k210_mux_params *params, static struct clk_mux *k210_create_mux(const struct k210_mux_params *params,
@ -473,7 +473,7 @@ cleanup_mux:
return comp; return comp;
} }
static bool __section(.data) probed; static bool __section(".data") probed;
/* reset probed so we will probe again post-relocation */ /* reset probed so we will probe again post-relocation */
static int k210_clk_bind(struct udevice *dev) static int k210_clk_bind(struct udevice *dev)

View file

@ -435,7 +435,36 @@ int regmap_raw_read(struct regmap *map, uint offset, void *valp, size_t val_len)
int regmap_read(struct regmap *map, uint offset, uint *valp) int regmap_read(struct regmap *map, uint offset, uint *valp)
{ {
return regmap_raw_read(map, offset, valp, map->width); union {
u8 v8;
u16 v16;
u32 v32;
u64 v64;
} u;
int res;
res = regmap_raw_read(map, offset, &u, map->width);
if (res)
return res;
switch (map->width) {
case REGMAP_SIZE_8:
*valp = u.v8;
break;
case REGMAP_SIZE_16:
*valp = u.v16;
break;
case REGMAP_SIZE_32:
*valp = u.v32;
break;
case REGMAP_SIZE_64:
*valp = u.v64;
break;
default:
unreachable();
}
return 0;
} }
static inline void __write_8(u8 *addr, const u8 *val, static inline void __write_8(u8 *addr, const u8 *val,
@ -546,7 +575,33 @@ int regmap_raw_write(struct regmap *map, uint offset, const void *val,
int regmap_write(struct regmap *map, uint offset, uint val) int regmap_write(struct regmap *map, uint offset, uint val)
{ {
return regmap_raw_write(map, offset, &val, map->width); union {
u8 v8;
u16 v16;
u32 v32;
u64 v64;
} u;
switch (map->width) {
case REGMAP_SIZE_8:
u.v8 = val;
break;
case REGMAP_SIZE_16:
u.v16 = val;
break;
case REGMAP_SIZE_32:
u.v32 = val;
break;
case REGMAP_SIZE_64:
u.v64 = val;
break;
default:
debug("%s: regmap size %zu unknown\n", __func__,
(size_t)map->width);
return -EINVAL;
}
return regmap_raw_write(map, offset, &u, map->width);
} }
int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val) int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val)

View file

@ -42,7 +42,7 @@
#if CONFIG_IS_ENABLED(EFI_LOADER) #if CONFIG_IS_ENABLED(EFI_LOADER)
int __efi_runtime_data psci_method; int __efi_runtime_data psci_method;
#else #else
int psci_method __attribute__ ((section(".data"))); int psci_method __section(".data");
#endif #endif
unsigned long __efi_runtime invoke_psci_fn unsigned long __efi_runtime invoke_psci_fn

View file

@ -326,7 +326,7 @@ int nand_spl_load_image(uint32_t from, unsigned int size, void *buf)
* configured and available since this code loads the main U-Boot image * configured and available since this code loads the main U-Boot image
* from NAND into SDRAM and starts it from there. * from NAND into SDRAM and starts it from there.
*/ */
void nand_boot(void) __used void nand_boot(void)
{ {
__attribute__((noreturn)) void (*uboot)(void); __attribute__((noreturn)) void (*uboot)(void);

View file

@ -10,7 +10,7 @@
#include "pinctrl-imx.h" #include "pinctrl-imx.h"
static struct imx_pinctrl_soc_info imx5_pinctrl_soc_info __attribute__((section(".data"))); static struct imx_pinctrl_soc_info imx5_pinctrl_soc_info __section(".data");
static int imx5_pinctrl_probe(struct udevice *dev) static int imx5_pinctrl_probe(struct udevice *dev)
{ {

View file

@ -9,7 +9,7 @@
#include "pinctrl-imx.h" #include "pinctrl-imx.h"
static struct imx_pinctrl_soc_info imx7_pinctrl_soc_info __attribute__((section(".data"))); static struct imx_pinctrl_soc_info imx7_pinctrl_soc_info __section(".data");
static struct imx_pinctrl_soc_info imx7_lpsr_pinctrl_soc_info = { static struct imx_pinctrl_soc_info imx7_lpsr_pinctrl_soc_info = {
.flags = ZERO_OFFSET_VALID, .flags = ZERO_OFFSET_VALID,

View file

@ -8,7 +8,7 @@
#include "pinctrl-imx.h" #include "pinctrl-imx.h"
static struct imx_pinctrl_soc_info imx8mq_pinctrl_soc_info __attribute__((section(".data"))); static struct imx_pinctrl_soc_info imx8mq_pinctrl_soc_info __section(".data");
static int imx8mq_pinctrl_probe(struct udevice *dev) static int imx8mq_pinctrl_probe(struct udevice *dev)
{ {

View file

@ -11,7 +11,7 @@
#include <power/tps62362.h> #include <power/tps62362.h>
#if CONFIG_IS_ENABLED(DM_I2C) #if CONFIG_IS_ENABLED(DM_I2C)
struct udevice *tps62362_dev __attribute__((section(".data"))) = NULL; struct udevice *tps62362_dev __section(".data") = NULL;
#endif #endif
/** /**

View file

@ -8,7 +8,7 @@
#include <i2c.h> #include <i2c.h>
#include <power/tps65217.h> #include <power/tps65217.h>
struct udevice *tps65217_dev __attribute__((section(".data"))) = NULL; struct udevice *tps65217_dev __section(".data") = NULL;
/** /**
* tps65217_reg_read() - Generic function that can read a TPS65217 register * tps65217_reg_read() - Generic function that can read a TPS65217 register

View file

@ -86,7 +86,7 @@ int tps65218_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val,
return 0; return 0;
} }
#else #else
struct udevice *tps65218_dev __attribute__((section(".data"))) = NULL; struct udevice *tps65218_dev __section(".data") = NULL;
int tps65218_reg_read(uchar dest_reg, uchar *dest_val) int tps65218_reg_read(uchar dest_reg, uchar *dest_val)
{ {

View file

@ -8,7 +8,7 @@
#include <i2c.h> #include <i2c.h>
#include <power/tps65910.h> #include <power/tps65910.h>
struct udevice *tps65910_dev __attribute__((section(".data"))) = NULL; struct udevice *tps65910_dev __section(".data") = NULL;
static inline int tps65910_read_reg(int addr, uchar *buf) static inline int tps65910_read_reg(int addr, uchar *buf)
{ {

View file

@ -30,8 +30,8 @@ DECLARE_GLOBAL_DATA_PTR;
#ifndef CONFIG_DM_SERIAL #ifndef CONFIG_DM_SERIAL
static volatile unsigned char *const port[] = CONFIG_PL01x_PORTS; static volatile unsigned char *const port[] = CONFIG_PL01x_PORTS;
static enum pl01x_type pl01x_type __attribute__ ((section(".data"))); static enum pl01x_type pl01x_type __section(".data");
static struct pl01x_regs *base_regs __attribute__ ((section(".data"))); static struct pl01x_regs *base_regs __section(".data");
#define NUM_PORTS (sizeof(port)/sizeof(port[0])) #define NUM_PORTS (sizeof(port)/sizeof(port[0]))
#endif #endif

View file

@ -217,8 +217,8 @@ extern const efi_guid_t efi_guid_firmware_management_protocol;
/* GUID for the ESRT */ /* GUID for the ESRT */
extern const efi_guid_t efi_esrt_guid; extern const efi_guid_t efi_esrt_guid;
extern unsigned int __efi_runtime_start, __efi_runtime_stop; extern char __efi_runtime_start[], __efi_runtime_stop[];
extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop; extern char __efi_runtime_rel_start[], __efi_runtime_rel_stop[];
/** /**
* struct efi_open_protocol_info_item - open protocol info item * struct efi_open_protocol_info_item - open protocol info item
@ -678,12 +678,51 @@ ssize_t efi_dp_check_length(const struct efi_device_path *dp,
(((_dp)->type == DEVICE_PATH_TYPE_##_type) && \ (((_dp)->type == DEVICE_PATH_TYPE_##_type) && \
((_dp)->sub_type == DEVICE_PATH_SUB_TYPE_##_subtype)) ((_dp)->sub_type == DEVICE_PATH_SUB_TYPE_##_subtype))
/* /**
* Use these to indicate that your code / data should go into the EFI runtime * __efi_runtime_data - declares a non-const variable for EFI runtime section
* section and thus still be available when the OS is running *
* This macro indicates that a variable is non-const and should go into the
* EFI runtime section, and thus still be available when the OS is running.
*
* Only use on variables not declared const.
*
* Example:
*
* ::
*
* static __efi_runtime_data my_computed_table[256];
*/ */
#define __efi_runtime_data __attribute__ ((section (".data.efi_runtime"))) #define __efi_runtime_data __section(".data.efi_runtime")
#define __efi_runtime __attribute__ ((section (".text.efi_runtime")))
/**
* __efi_runtime_rodata - declares a read-only variable for EFI runtime section
*
* This macro indicates that a variable is read-only (const) and should go into
* the EFI runtime section, and thus still be available when the OS is running.
*
* Only use on variables also declared const.
*
* Example:
*
* ::
*
* static const __efi_runtime_rodata my_const_table[] = { 1, 2, 3 };
*/
#define __efi_runtime_rodata __section(".rodata.efi_runtime")
/**
* __efi_runtime - declares a function for EFI runtime section
*
* This macro indicates that a function should go into the EFI runtime section,
* and thus still be available when the OS is running.
*
* Example:
*
* ::
*
* static __efi_runtime compute_my_table(void);
*/
#define __efi_runtime __section(".text.efi_runtime")
/* Indicate supported runtime services */ /* Indicate supported runtime services */
efi_status_t efi_init_runtime_supported(void); efi_status_t efi_init_runtime_supported(void);
@ -888,6 +927,7 @@ efi_status_t efi_launch_capsules(void);
/* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */ /* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */
#define __efi_runtime_data #define __efi_runtime_data
#define __efi_runtime_rodata
#define __efi_runtime #define __efi_runtime
static inline efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len) static inline efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
{ {

View file

@ -8,7 +8,13 @@
#include <linux/errno.h> #include <linux/errno.h>
extern int errno; #ifdef __SANDBOX__
#define __errno_asm_label asm("__u_boot_errno")
#else
#define __errno_asm_label
#endif
extern int errno __errno_asm_label;
#define __set_errno(val) do { errno = val; } while (0) #define __set_errno(val) do { errno = val; } while (0)

View file

@ -69,8 +69,8 @@
*/ */
#define ll_entry_declare(_type, _name, _list) \ #define ll_entry_declare(_type, _name, _list) \
_type _u_boot_list_2_##_list##_2_##_name __aligned(4) \ _type _u_boot_list_2_##_list##_2_##_name __aligned(4) \
__attribute__((unused, \ __attribute__((unused)) \
section(".u_boot_list_2_"#_list"_2_"#_name))) __section(".u_boot_list_2_"#_list"_2_"#_name)
/** /**
* ll_entry_declare_list() - Declare a list of link-generated array entries * ll_entry_declare_list() - Declare a list of link-generated array entries
@ -92,8 +92,8 @@
*/ */
#define ll_entry_declare_list(_type, _name, _list) \ #define ll_entry_declare_list(_type, _name, _list) \
_type _u_boot_list_2_##_list##_2_##_name[] __aligned(4) \ _type _u_boot_list_2_##_list##_2_##_name[] __aligned(4) \
__attribute__((unused, \ __attribute__((unused)) \
section(".u_boot_list_2_"#_list"_2_"#_name))) __section(".u_boot_list_2_"#_list"_2_"#_name)
/* /*
* We need a 0-byte-size type for iterator symbols, and the compiler * We need a 0-byte-size type for iterator symbols, and the compiler
@ -125,8 +125,8 @@
#define ll_entry_start(_type, _list) \ #define ll_entry_start(_type, _list) \
({ \ ({ \
static char start[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \ static char start[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \
__attribute__((unused, \ __attribute__((unused)) \
section(".u_boot_list_2_"#_list"_1"))); \ __section(".u_boot_list_2_"#_list"_1"); \
(_type *)&start; \ (_type *)&start; \
}) })
@ -151,8 +151,8 @@
*/ */
#define ll_entry_end(_type, _list) \ #define ll_entry_end(_type, _list) \
({ \ ({ \
static char end[0] __aligned(4) __attribute__((unused, \ static char end[0] __aligned(4) __attribute__((unused)) \
section(".u_boot_list_2_"#_list"_3"))); \ __section(".u_boot_list_2_"#_list"_3"); \
(_type *)&end; \ (_type *)&end; \
}) })
/** /**
@ -245,8 +245,8 @@
*/ */
#define ll_start(_type) \ #define ll_start(_type) \
({ \ ({ \
static char start[0] __aligned(4) __attribute__((unused, \ static char start[0] __aligned(4) __attribute__((unused)) \
section(".u_boot_list_1"))); \ __section(".u_boot_list_1"); \
(_type *)&start; \ (_type *)&start; \
}) })
@ -268,8 +268,8 @@
*/ */
#define ll_end(_type) \ #define ll_end(_type) \
({ \ ({ \
static char end[0] __aligned(4) __attribute__((unused, \ static char end[0] __aligned(4) __attribute__((unused)) \
section(".u_boot_list_3"))); \ __section(".u_boot_list_3"); \
(_type *)&end; \ (_type *)&end; \
}) })

View file

@ -24,7 +24,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
long ______r; \ long ______r; \
static struct ftrace_likely_data \ static struct ftrace_likely_data \
__aligned(4) \ __aligned(4) \
__section(_ftrace_annotated_branch) \ __section("_ftrace_annotated_branch") \
______f = { \ ______f = { \
.data.func = __func__, \ .data.func = __func__, \
.data.file = __FILE__, \ .data.file = __FILE__, \
@ -60,7 +60,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
#define __trace_if_value(cond) ({ \ #define __trace_if_value(cond) ({ \
static struct ftrace_branch_data \ static struct ftrace_branch_data \
__aligned(4) \ __aligned(4) \
__section(_ftrace_branch) \ __section("_ftrace_branch") \
__if_trace = { \ __if_trace = { \
.func = __func__, \ .func = __func__, \
.file = __FILE__, \ .file = __FILE__, \
@ -118,7 +118,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
".popsection\n\t" ".popsection\n\t"
/* Annotate a C jump table to allow objtool to follow the code flow */ /* Annotate a C jump table to allow objtool to follow the code flow */
#define __annotate_jump_table __section(.rodata..c_jump_table) #define __annotate_jump_table __section(".rodata..c_jump_table")
#else #else
#define annotate_reachable() #define annotate_reachable()
@ -294,8 +294,8 @@ unsigned long read_word_at_a_time(const void *addr)
* visible to the compiler. * visible to the compiler.
*/ */
#define __ADDRESSABLE(sym) \ #define __ADDRESSABLE(sym) \
static void * __section(.discard.addressable) __used \ static void * __section(".discard.addressable") __used \
__PASTE(__addressable_##sym, __LINE__) = (void *)&sym; __UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)&sym;
/** /**
* offset_to_ptr - convert a relative memory offset to an absolute pointer * offset_to_ptr - convert a relative memory offset to an absolute pointer

View file

@ -246,7 +246,7 @@
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-section-variable-attribute * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-section-variable-attribute
* clang: https://clang.llvm.org/docs/AttributeReference.html#section-declspec-allocate * clang: https://clang.llvm.org/docs/AttributeReference.html#section-declspec-allocate
*/ */
#define __section(S) __attribute__((__section__(#S))) #define __section(S) __attribute__((__section__(S)))
/* /*
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute

View file

@ -26,6 +26,7 @@
#ifdef USE_HOSTCC #ifdef USE_HOSTCC
#define __efi_runtime #define __efi_runtime
#define __efi_runtime_data #define __efi_runtime_data
#define __efi_runtime_rodata
#endif #endif
#define tole(x) cpu_to_le32(x) #define tole(x) cpu_to_le32(x)
@ -88,7 +89,7 @@ static void __efi_runtime make_crc_table(void)
* Table of CRC-32's of all single-byte values (made by make_crc_table) * Table of CRC-32's of all single-byte values (made by make_crc_table)
*/ */
static const uint32_t __efi_runtime_data crc_table[256] = { static const uint32_t __efi_runtime_rodata crc_table[256] = {
tole(0x00000000L), tole(0x77073096L), tole(0xee0e612cL), tole(0x990951baL), tole(0x00000000L), tole(0x77073096L), tole(0xee0e612cL), tole(0x990951baL),
tole(0x076dc419L), tole(0x706af48fL), tole(0xe963a535L), tole(0x9e6495a3L), tole(0x076dc419L), tole(0x706af48fL), tole(0xe963a535L), tole(0x9e6495a3L),
tole(0x0edb8832L), tole(0x79dcb8a4L), tole(0xe0d5e91eL), tole(0x97d2d988L), tole(0x0edb8832L), tole(0x79dcb8a4L), tole(0xe0d5e91eL), tole(0x97d2d988L),

View file

@ -10,6 +10,8 @@ ccflags-y += -DHOST_ARCH="$(HOST_ARCH)"
CFLAGS_dtbdump.o := $(CFLAGS_EFI) -Os -ffreestanding CFLAGS_dtbdump.o := $(CFLAGS_EFI) -Os -ffreestanding
CFLAGS_REMOVE_dtbdump.o := $(CFLAGS_NON_EFI) CFLAGS_REMOVE_dtbdump.o := $(CFLAGS_NON_EFI)
CFLAGS_efi_selftest_miniapp_exception.o := $(CFLAGS_EFI) -Os -ffreestanding
CFLAGS_REMOVE_efi_selftest_miniapp_exception.o := $(CFLAGS_NON_EFI)
CFLAGS_efi_selftest_miniapp_exit.o := $(CFLAGS_EFI) -Os -ffreestanding CFLAGS_efi_selftest_miniapp_exit.o := $(CFLAGS_EFI) -Os -ffreestanding
CFLAGS_REMOVE_efi_selftest_miniapp_exit.o := $(CFLAGS_NON_EFI) CFLAGS_REMOVE_efi_selftest_miniapp_exit.o := $(CFLAGS_NON_EFI)
CFLAGS_efi_selftest_miniapp_return.o := $(CFLAGS_EFI) -Os -ffreestanding CFLAGS_efi_selftest_miniapp_return.o := $(CFLAGS_EFI) -Os -ffreestanding

View file

@ -1 +1,3 @@
int errno = 0; #include <errno.h>
int errno __errno_asm_label = 0;

Some files were not shown because too many files have changed in this diff Show more