arm-trusted-firmware/plat/arm/board/arm_fpga/build_axf.ld.S
Andre Przywara a67ac7648c fix(arm_fpga): avoid re-linking from executable ELF file
When we build the convenience firmware package file for the Arm FPGA
boards (bl31.axf), we combine trampolines, the DTB and the actual BL31
code into one ELF file, which is more a "container with load addresses"
than an actual executable. So far ld was fine with us using bl31.elf as
an input file, but binutils 2.35 changed that and complains about
taking an *executable* ELF file as in *input* to the linker:
-----------------
aarch64-none-elf-ld.bfd: cannot use executable file 'build/arm_fpga/debug/./bl31/bl31.elf' as input to a link
-----------------

Fortunately we don't need the actual BL31 ELF file for *that* part of
the linking, so can use the just created bl31.bin binary version of it.
Actually that shrinks the file, as we needlessly included the .BSS
section in the final file before.

Using the binary works with both older and newer toolchains versions, so
let's do this unconditionally.

Change-Id: Ib7e697f8363499123f7cb860f118f182d0830768
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2021-11-04 15:58:34 +00:00

54 lines
1.1 KiB
ArmAsm

/*
* Copyright (c) 2020, ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
* Linker script for the Arm Ltd. FPGA boards to generate an ELF file that
* contains the ROM trampoline, BL31 and the DTB.
*
* This allows to pass just one file to the uploader tool, and automatically
* provides the correct load addresses.
*/
#include <platform_def.h>
OUTPUT_FORMAT("elf64-littleaarch64")
OUTPUT_ARCH(aarch64)
INPUT(./rom_trampoline.o)
INPUT(./kernel_trampoline.o)
TARGET(binary)
INPUT(./bl31.bin)
INPUT(./fdts/arm_fpga.dtb)
ENTRY(_start)
SECTIONS
{
.rom (0x0): {
*rom_trampoline.o(.text*)
KEEP(*(.rom))
}
.bl31 (BL31_BASE): {
ASSERT(. == ALIGN(PAGE_SIZE), "BL31_BASE is not page aligned");
*bl31.bin
}
.dtb (FPGA_PRELOADED_DTB_BASE): {
ASSERT(. == ALIGN(8), "DTB address is not 8-byte aligned");
*arm_fpga.dtb
}
.kern_tramp (PRELOADED_BL33_BASE): {
*kernel_trampoline.o(.text*)
KEEP(*(.kern_tramp))
}
/DISCARD/ : { *(stacks) }
/DISCARD/ : { *(.debug_*) }
/DISCARD/ : { *(.note*) }
/DISCARD/ : { *(.comment*) }
}