Browse Source

Merge changes from topic "fix-lto-build-all" into integration

* changes:
  build(fpga): correctly handle gcc as linker for LTO
  fix(build): enforce single partition for LTO build
  fix(rockchip): add support for building with LTO enabled
pull/2000/merge
Bipin Ravi 8 months ago
committed by TrustedFirmware Code Review
parent
commit
9a79c9e431
  1. 1
      Makefile
  2. 8
      plat/arm/board/arm_fpga/platform.mk
  3. 21
      plat/rockchip/rk3399/drivers/pmu/pmu_fw.S
  4. 22
      plat/rockchip/rk3399/drivers/pmu/pmu_fw.c
  5. 6
      plat/rockchip/rk3399/platform.mk

1
Makefile

@ -325,6 +325,7 @@ else ifeq ($($(ARCH)-ld-id),gnu-gcc)
ifeq ($(ENABLE_LTO),1)
ifeq (${ARCH},aarch64)
TF_LDFLAGS += -flto -fuse-linker-plugin
TF_LDFLAGS += -flto-partition=one
endif
endif #(ENABLE_LTO)

8
plat/arm/board/arm_fpga/platform.mk

@ -127,8 +127,14 @@ $(eval $(call MAKE_S,$(BUILD_PLAT),plat/arm/board/arm_fpga/rom_trampoline.S,bl31
$(eval $(call MAKE_S,$(BUILD_PLAT),plat/arm/board/arm_fpga/kernel_trampoline.S,bl31))
$(eval $(call MAKE_LD,$(BUILD_PLAT)/build_axf.ld,plat/arm/board/arm_fpga/build_axf.ld.S,bl31))
ifeq ($($(ARCH)-ld-id),gnu-gcc)
PLAT_LDFLAGS += -Wl,--strip-debug
else
PLAT_LDFLAGS += --strip-debug
endif
bl31.axf: bl31 dtbs ${BUILD_PLAT}/rom_trampoline.o ${BUILD_PLAT}/kernel_trampoline.o ${BUILD_PLAT}/build_axf.ld
$(ECHO) " LD $@"
$(Q)$($(ARCH)-ld) -T ${BUILD_PLAT}/build_axf.ld -L ${BUILD_PLAT} --strip-debug -s -n -o ${BUILD_PLAT}/bl31.axf
$(Q)$($(ARCH)-ld) -T ${BUILD_PLAT}/build_axf.ld -L ${BUILD_PLAT} $(TF_LDFLAGS) $(PLAT_LDFLAGS) -s -n -o ${BUILD_PLAT}/bl31.axf
all: bl31.axf

21
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S

@ -0,0 +1,21 @@
/*
* Copyright (c) 2024, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/* convoluted way to make sure that the define is pasted just the right way */
.macro INCBIN file sym sec
.section \sec
.global \sym
.type \sym, @object
.align 4
\sym :
.incbin \file
.size \sym , .-\sym
.global \sym\()_end
\sym\()_end :
.endm
INCBIN ""RK3399M0FW"", "rk3399m0_bin", ".sram.incbin"
INCBIN ""RK3399M0PMUFW"", "rk3399m0pmu_bin", ".pmusram.incbin"

22
plat/rockchip/rk3399/drivers/pmu/pmu_fw.c

@ -1,22 +0,0 @@
/*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/* convoluted way to make sure that the define is pasted just the right way */
#define INCBIN(file, sym, sec) \
__asm__( \
".section " sec "\n" \
".global " sym "\n" \
".type " sym ", %object\n" \
".align 4\n" \
sym ":\n" \
".incbin \"" file "\"\n" \
".size " sym ", .-" sym "\n" \
".global " sym "_end\n" \
sym "_end:\n" \
)
INCBIN(RK3399M0FW, "rk3399m0_bin", ".sram.incbin");
INCBIN(RK3399M0PMUFW, "rk3399m0pmu_bin", ".pmusram.incbin");

6
plat/rockchip/rk3399/platform.mk

@ -1,5 +1,5 @@
#
# Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved.
# Copyright (c) 2016-2024, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@ -61,7 +61,7 @@ BL31_SOURCES += ${RK_GIC_SOURCES} \
${RK_PLAT_SOC}/plat_sip_calls.c \
${RK_PLAT_SOC}/drivers/gpio/rk3399_gpio.c \
${RK_PLAT_SOC}/drivers/pmu/pmu.c \
${RK_PLAT_SOC}/drivers/pmu/pmu_fw.c \
${RK_PLAT_SOC}/drivers/pmu/pmu_fw.S \
${RK_PLAT_SOC}/drivers/pmu/m0_ctl.c \
${RK_PLAT_SOC}/drivers/pwm/pwm.c \
${RK_PLAT_SOC}/drivers/secure/secure.c \
@ -102,7 +102,7 @@ endif
# CCACHE_EXTRAFILES is needed because ccache doesn't handle .incbin
export CCACHE_EXTRAFILES
${BUILD_PLAT}/bl31/pmu_fw.o: CCACHE_EXTRAFILES=$(RK3399M0FW):$(RK3399M0PMUFW)
${RK_PLAT_SOC}/drivers/pmu/pmu_fw.c: $(RK3399M0FW)
${RK_PLAT_SOC}/drivers/pmu/pmu_fw.S: $(RK3399M0FW)
$(eval $(call MAKE_PREREQ_DIR,${BUILD_M0},${BUILD_PLAT}))
.PHONY: $(RK3399M0FW)

Loading…
Cancel
Save