From: Marek Vasut Date: Sun, 16 Nov 2025 00:14:32 +0000 (+0100) Subject: xtensa: Assure end of U-Boot is at 8-byte aligned offset X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c0d78ddc4989fe95337b20e392a76e796001eb6;p=thirdparty%2Fu-boot.git xtensa: Assure end of U-Boot is at 8-byte aligned offset Make sure the end of U-Boot is at 8-byte aligned offset, not 4-byte aligned offset. This allows safely appending DT at the end of U-Boot with the guarantee that the DT will be at 8-byte aligned offset. This 8-byte alignment is now checked by newer libfdt 1.7.2 . Signed-off-by: Marek Vasut --- diff --git a/arch/xtensa/cpu/u-boot.lds b/arch/xtensa/cpu/u-boot.lds index 72e4b9a706e..6894d4c327b 100644 --- a/arch/xtensa/cpu/u-boot.lds +++ b/arch/xtensa/cpu/u-boot.lds @@ -78,7 +78,7 @@ SECTIONS SECTION_text(XTENSA_SYS_TEXT_ADDR, FOLLOWING(.DoubleExceptionVector.text)) SECTION_rodata(ALIGN(16), FOLLOWING(.text)) SECTION_u_boot_list(ALIGN(16), FOLLOWING(.rodata)) - SECTION_data(ALIGN(16), FOLLOWING(__u_boot_list)) + SECTION_data(ALIGN(16), FOLLOWINGDT(__u_boot_list)) __reloc_end = .; __init_end = .; diff --git a/arch/xtensa/include/asm/ldscript.h b/arch/xtensa/include/asm/ldscript.h index bcf0fd5a744..50d3b390405 100644 --- a/arch/xtensa/include/asm/ldscript.h +++ b/arch/xtensa/include/asm/ldscript.h @@ -21,6 +21,9 @@ #define FORCE_OUTPUT . = . #define FOLLOWING(sec) \ AT(((LOADADDR(sec) + SIZEOF(sec) + ALIGN_LMA-1)) & ~(ALIGN_LMA-1)) +#define ALIGN_LMA_DT 8 +#define FOLLOWINGDT(sec) \ + AT(((LOADADDR(sec) + SIZEOF(sec) + ALIGN_LMA_DT-1)) & ~(ALIGN_LMA_DT-1)) /* * Specify an output section that will be added to the ROM store table @@ -110,6 +113,7 @@ ___u_boot_list_start = ABSOLUTE(.); \ KEEP(*(SORT(__u_boot_list*))); \ ___u_boot_list_end = ABSOLUTE(.); \ + . = ALIGN(ALIGN_LMA_DT); \ } #define SECTION_data(_vma_, _lma_) \ @@ -130,6 +134,7 @@ *(.eh_frame) \ *(.dynamic) \ *(.gnu.version_d) \ + . = ALIGN(ALIGN_LMA_DT); \ _data_end = ABSOLUTE(.); \ }