fix(rockchip): add support for building with LTO enabled
Using the asm .incbin statement in C sources breaks gcc wrapper.
Build fails with a following errors:
/tmp/ccRXHTU4.s: Assembler messages:
/tmp/ccRXHTU4.s:34: Warning: dwarf line number information for .pmusram.incbin ignored
...
/tmp/ccRXHTU4.s:2119: Warning: dwarf line number information for .pmusram.incbin ignored
/tmp/ccRXHTU4.s:112497: Error: leb128 operand is an undefined symbol: .LVU5
/tmp/ccRXHTU4.s:112498: Error: leb128 operand is an undefined symbol: .LVU6
/tmp/ccRXHTU4.s:112507: Error: leb128 operand is an undefined symbol: .LVU9
...
/tmp/ccRXHTU4.s:115407: Error: leb128 operand is an undefined symbol: .LVU668
/tmp/ccRXHTU4.s:115408: Error: leb128 operand is an undefined symbol: .LVU710
/tmp/ccRXHTU4.s:115409: Error: leb128 operand is an undefined symbol: .LVU713
lto-wrapper: fatal error: aarch64-none-elf-gcc returned 1 exit status
compilation terminated.
aarch64-none-elf/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Fix it in a similar way to what the Linux kernel does, see commit
919aa45e43a84d40c27c83f6117cfa6542cee14e (MODSIGN: Avoid using .incbin
in C source). [1]
1. https://lkml.org/lkml/2012/12/4/136
Change-Id: Iecc19729ce59e8c3b3c30fa37b1fddef95e83c96
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
diff --git a/plat/rockchip/rk3399/platform.mk b/plat/rockchip/rk3399/platform.mk
index aba67c2..2394dce 100644
--- a/plat/rockchip/rk3399/platform.mk
+++ b/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 @@
${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 @@
# 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)