u-boot/arch/microblaze/cpu/u-boot.lds
Tom Rini 2e52030584 microblaze: Update linker scripts to ensure appended device tree is aligned
With commit 0535e46d55d7 ("scripts/dtc: Update to upstream version
v1.7.2-35-g52f07dcca47c") it is now a fatal error to U-Boot if our
device tree is not 8-byte aligned. In commit 85f586035d75 ("ARM: OMAP2+:
Pad SPL binary to 8-byte alignment before DTB") Beleswar Padhi explains
that we must have ALIGN(x) statements inside of a section to ensure that
padding is included and not simply that the linker address counter is
incremented. To that end, this patch:
- Aligns the final section before _end (for U-Boot) or _image_binary_end
  (for xPL phases) by 8-bytes by adjusting the ALIGN(4) statement to be
  ALIGN(8) in the final section before the symbol.
- Ensure that we do have alignment by adding an ASSERT so that when not
  aligned we fail to link (and explain why).

Tested-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2026-01-20 12:07:15 -06:00

77 lines
1.0 KiB
Plaintext

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* (C) Copyright 2004 Atmark Techno, Inc.
*
* Yasushi SHOJI <yashi@atmark-techno.com>
*/
OUTPUT_ARCH(microblaze)
ENTRY(_start)
SECTIONS
{
.text ALIGN(0x4):
{
__text_start = .;
arch/microblaze/cpu/start.o (.text)
*(.text*)
__text_end = .;
}
.rodata ALIGN(0x4):
{
__rodata_start = .;
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
__rodata_end = .;
}
.data ALIGN(0x4):
{
__data_start = .;
*(.data*)
__data_end = .;
}
.got ALIGN(4):
{
_got_start = .;
*(.got*)
. = ALIGN(4);
_got_end = .;
}
. = ALIGN(4);
__u_boot_list : {
KEEP(*(SORT(__u_boot_list*)));
}
__init_end = . ;
. = ALIGN(4);
__rel_dyn_start = .;
.rela.dyn : {
*(.rela.dyn)
}
__rel_dyn_end = .;
. = ALIGN(4);
__dyn_sym_start = .;
.dynsym : {
*(.dynsym)
}
__dyn_sym_end = .;
.bss ALIGN(0x4):
{
__bss_start = .;
*(.sbss)
*(.scommon)
*(.bss*)
*(COMMON)
. = ALIGN(8);
__bss_end = .;
}
_end = . ;
}
ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");