mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-26 23:04:50 +00:00
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>
This commit is contained in:
parent
885e93f907
commit
e5e9ccdb0c
3 changed files with 24 additions and 25 deletions
plat/rockchip/rk3399
21
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S
Normal file
21
plat/rockchip/rk3399/drivers/pmu/pmu_fw.S
Normal file
|
@ -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"
|
|
@ -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");
|
|
@ -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…
Add table
Reference in a new issue