diff --git a/arch/arm/cpu/arm1136/u-boot-spl.lds b/arch/arm/cpu/arm1136/u-boot-spl.lds index b7af29183a9..22a9302275a 100644 --- a/arch/arm/cpu/arm1136/u-boot-spl.lds +++ b/arch/arm/cpu/arm1136/u-boot-spl.lds @@ -30,8 +30,10 @@ SECTIONS .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram . = ALIGN(4); - .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram - . = ALIGN(4); + .data : { + *(SORT_BY_ALIGNMENT(.data*)) + . = ALIGN(8); + } >.sram __image_copy_end = .; _end = .; @@ -44,3 +46,5 @@ SECTIONS __bss_end = .; } >.sdram } + +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree"); diff --git a/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds index 7c6309246f8..b4adae272eb 100644 --- a/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds +++ b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds @@ -45,7 +45,7 @@ SECTIONS . = ALIGN(4); __bss_start = .; *(.bss*) - . = ALIGN(4); + . = ALIGN(8); __bss_end = .; } @@ -62,3 +62,6 @@ SECTIONS .gnu : { *(.gnu*) } .ARM.exidx : { *(.ARM.exidx*) } } + +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); diff --git a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds index cf65e8c4628..2225985c79c 100644 --- a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds +++ b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds @@ -31,9 +31,9 @@ SECTIONS . = ALIGN(4); __u_boot_list : { KEEP(*(SORT(__u_boot_list*))); + . = ALIGN(8); } > .sram - . = ALIGN(4); __image_copy_end = .; _end = .; _image_binary_end = .; @@ -47,3 +47,6 @@ SECTIONS __bss_end = .; } > .sdram } + +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds index fb7a789b28b..e69291d8be6 100644 --- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds +++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds @@ -40,9 +40,9 @@ SECTIONS . = ALIGN(4); __u_boot_list : { KEEP(*(SORT(__u_boot_list*))); + . = ALIGN(8); } > .sram - . = ALIGN(4); __image_copy_end = .; _end = .; _image_binary_end = .; @@ -56,3 +56,6 @@ SECTIONS __bss_end = .; } > .sdram } + +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); diff --git a/arch/arm/cpu/armv8/u-boot-spl.lds b/arch/arm/cpu/armv8/u-boot-spl.lds index c4f83ec9cfc..d9963846c4f 100644 --- a/arch/arm/cpu/armv8/u-boot-spl.lds +++ b/arch/arm/cpu/armv8/u-boot-spl.lds @@ -52,9 +52,9 @@ SECTIONS __u_boot_list : { . = ALIGN(8); KEEP(*(SORT(__u_boot_list*))); + . = ALIGN(8); } >.sram - . = ALIGN(8); __image_copy_end = .; _end = .; _image_binary_end = .; @@ -89,5 +89,7 @@ SECTIONS #endif } +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); ASSERT(ADDR(.bss) % 8 == 0, \ ".bss must be 8-byte aligned"); diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds index f4ce98c82c8..231ab28b50c 100644 --- a/arch/arm/cpu/armv8/u-boot.lds +++ b/arch/arm/cpu/armv8/u-boot.lds @@ -146,6 +146,7 @@ SECTIONS __rel_dyn_start = .; *(.rela*) __rel_dyn_end = .; + . = ALIGN(8); } _end = .; @@ -175,3 +176,5 @@ SECTIONS #include "linux-kernel-image-header-vars.h" #endif } + +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree"); diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds index 5aecb61ce90..d780a506077 100644 --- a/arch/arm/cpu/u-boot-spl.lds +++ b/arch/arm/cpu/u-boot-spl.lds @@ -51,9 +51,9 @@ SECTIONS __rel_dyn_start = .; *(.rel*) __rel_dyn_end = .; + . = ALIGN(8); } - . = ALIGN(8); _image_binary_end = .; _end = .; @@ -80,6 +80,9 @@ ASSERT(__image_copy_end - __image_copy_start <= (IMAGE_MAX_SIZE), \ "SPL image too big"); #endif +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); + #if defined(CONFIG_SPL_BSS_MAX_SIZE) ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \ "SPL image BSS too big"); diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index 78aad093d3b..8e2266a90fe 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -164,6 +164,7 @@ SECTIONS __rel_dyn_start = .; *(.rel*) __rel_dyn_end = .; + . = ALIGN(8); } _end = .; @@ -192,3 +193,6 @@ SECTIONS /DISCARD/ : { *(.ARM.exidx*) } /DISCARD/ : { *(.gnu.linkonce.armexidx.*) } } + +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); diff --git a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds index 9502a7384b5..c9664a6ce56 100644 --- a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds +++ b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds @@ -59,6 +59,7 @@ SECTIONS __rel_dyn_start = .; *(.rel*) __rel_dyn_end = .; + . = ALIGN(8); } > .nor _end = .; @@ -79,6 +80,9 @@ ASSERT(__image_copy_end - __image_copy_start <= (IMAGE_MAX_SIZE), \ "SPL image too big"); #endif +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); + #if defined(CONFIG_SPL_BSS_MAX_SIZE) ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \ "SPL image BSS too big"); diff --git a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds index 09cf838cf96..1af4f7b6524 100644 --- a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds +++ b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds @@ -29,9 +29,11 @@ SECTIONS .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram . = ALIGN(4); - __u_boot_list : { KEEP(*(SORT(__u_boot_list*))) } > .sram + __u_boot_list : { + KEEP(*(SORT(__u_boot_list*))) + . = ALIGN(8); + } > .sram - . = ALIGN(4); __image_copy_end = .; _end = .; _image_binary_end = .; @@ -51,6 +53,9 @@ ASSERT(__image_copy_end - __start <= (IMAGE_MAX_SIZE), \ "SPL image too big"); #endif +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); + #if defined(CONFIG_SPL_BSS_MAX_SIZE) ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \ "SPL image BSS too big"); diff --git a/arch/arm/mach-at91/armv7/u-boot-spl.lds b/arch/arm/mach-at91/armv7/u-boot-spl.lds index 460a91d93ec..287764df48f 100644 --- a/arch/arm/mach-at91/armv7/u-boot-spl.lds +++ b/arch/arm/mach-at91/armv7/u-boot-spl.lds @@ -36,9 +36,11 @@ SECTIONS .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram . = ALIGN(4); - __u_boot_list : { KEEP(*(SORT(__u_boot_list*))) } > .sram + __u_boot_list : { + KEEP(*(SORT(__u_boot_list*))) + . = ALIGN(8); + } > .sram - . = ALIGN(4); __image_copy_end = .; _end = .; _image_binary_end = .; @@ -52,3 +54,6 @@ SECTIONS __bss_end = .; } >.sdram } + +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); diff --git a/arch/arm/mach-omap2/u-boot-spl.lds b/arch/arm/mach-omap2/u-boot-spl.lds index 3bb759d8a1c..b61e657900a 100644 --- a/arch/arm/mach-omap2/u-boot-spl.lds +++ b/arch/arm/mach-omap2/u-boot-spl.lds @@ -51,3 +51,6 @@ SECTIONS __bss_end = .; } >.sdram } + +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); diff --git a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds index 958a1b70aef..2c0f5c3e5f3 100644 --- a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds +++ b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds @@ -42,9 +42,9 @@ SECTIONS __u_boot_list : { . = ALIGN(8); KEEP(*(SORT(__u_boot_list*))); + . = ALIGN(8); } - . = ALIGN(8); __image_copy_end = .; _end = .; _image_binary_end = .; @@ -69,6 +69,9 @@ ASSERT(__image_copy_end - __image_copy_start < (CONFIG_TPL_MAX_SIZE), \ "TPL image too big"); #endif +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); + #if defined(CONFIG_TPL_BSS_MAX_SIZE) ASSERT(__bss_end - __bss_start < (CONFIG_TPL_BSS_MAX_SIZE), \ "TPL image BSS too big"); diff --git a/arch/arm/mach-zynq/u-boot-spl.lds b/arch/arm/mach-zynq/u-boot-spl.lds index d96a5770288..17f0d7c9b72 100644 --- a/arch/arm/mach-zynq/u-boot-spl.lds +++ b/arch/arm/mach-zynq/u-boot-spl.lds @@ -39,10 +39,9 @@ SECTIONS . = ALIGN(4); __u_boot_list : { KEEP(*(SORT(__u_boot_list*))); + . = ALIGN(8); } > .sram - . = ALIGN(4); - _image_binary_end = .; _end = .; @@ -62,3 +61,6 @@ SECTIONS /DISCARD/ : { *(.interp*) } /DISCARD/ : { *(.gnu*) } } + +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds index f52523edf49..2a8e3399e0b 100644 --- a/arch/arm/mach-zynq/u-boot.lds +++ b/arch/arm/mach-zynq/u-boot.lds @@ -66,6 +66,7 @@ SECTIONS __rel_dyn_start = .; *(.rel*) __rel_dyn_end = .; + . = ALIGN(8); } _end = .; @@ -98,3 +99,5 @@ SECTIONS /DISCARD/ : { *(.ARM.exidx*) } /DISCARD/ : { *(.gnu.linkonce.armexidx.*) } } + +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree"); diff --git a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds index 56d6f4f114b..d1a82e118af 100644 --- a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds +++ b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds @@ -43,6 +43,7 @@ SECTIONS __rel_dyn_start = .; *(.rel*) __rel_dyn_end = .; + . = ALIGN(8); } >.sram __image_copy_end = .; @@ -58,3 +59,6 @@ SECTIONS __bss_end = .; } >.sdram } + +ASSERT(_image_binary_end % 8 == 0, \ + "_image_binary_end must be 8-byte aligned for device tree"); diff --git a/board/samsung/common/exynos-uboot-spl.lds b/board/samsung/common/exynos-uboot-spl.lds index 9d3b57e98db..62e150bcf33 100644 --- a/board/samsung/common/exynos-uboot-spl.lds +++ b/board/samsung/common/exynos-uboot-spl.lds @@ -48,7 +48,10 @@ SECTIONS . = ALIGN(4); __bss_start = .; *(.bss*) - . = ALIGN(4); + . = ALIGN(8); __bss_end = .; } >.sram } + +ASSERT(__bss_end % 8 == 0, \ + "__bss_end must be 8-byte aligned for device tree");