mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-27 22:56:49 +08:00
c1094987d1
Add plumbing for building U-Boot with Link Time Optimizations. When building with LTO, $(PLATFORM_LIBS) has to be in --whole-archive / --no-whole-archive group, otherwise some functions declared in assembly may not be resolved and linking may fail. Note: clang may throw away linker list symbols it thinks are unused when compiling with LTO. To force these symbols to be included, we refer to them via the __ADDRESSABLE macro in a C file generated from compiled built-in.o files before linking. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
32 lines
783 B
Makefile
32 lines
783 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Kbuild for top-level directory of U-Boot
|
|
|
|
#####
|
|
# Generate generic-asm-offsets.h
|
|
|
|
generic-offsets-file := include/generated/generic-asm-offsets.h
|
|
|
|
always := $(generic-offsets-file)
|
|
targets := lib/asm-offsets.s
|
|
|
|
CFLAGS_REMOVE_asm-offsets.o := $(LTO_CFLAGS)
|
|
|
|
$(obj)/$(generic-offsets-file): $(obj)/lib/asm-offsets.s FORCE
|
|
$(call filechk,offsets,__GENERIC_ASM_OFFSETS_H__)
|
|
|
|
#####
|
|
# Generate asm-offsets.h
|
|
|
|
ifneq ($(wildcard $(srctree)/arch/$(ARCH)/lib/asm-offsets.c),)
|
|
offsets-file := include/generated/asm-offsets.h
|
|
endif
|
|
|
|
always += $(offsets-file)
|
|
targets += arch/$(ARCH)/lib/asm-offsets.s
|
|
|
|
CFLAGS_asm-offsets.o := -DDO_DEPS_ONLY
|
|
|
|
$(obj)/$(offsets-file): $(obj)/arch/$(ARCH)/lib/asm-offsets.s FORCE
|
|
$(call filechk,offsets,__ASM_OFFSETS_H__)
|