From e1bbf6be9049319fefa0d30267433d4921e4f5a1 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sat, 22 Jun 2013 20:06:58 +0200 Subject: [PATCH] ARM: Add image end section In the upcoming multi image build process we will cat images together. To find the concatenated image we need to reliably find the end of the current binary. This adds a dummy section at the end of a pbl binary. Its only purpose is to mark the end of the image. The multi image patches will add something to this section so that it doesn't get discarded by the linker. Signed-off-by: Sascha Hauer --- arch/arm/lib/pbl.lds.S | 8 +++++++- arch/arm/lib/runtime-offset.S | 3 +++ include/asm-generic/sections.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S index d3ec2f86a..1eae8298e 100644 --- a/arch/arm/lib/pbl.lds.S +++ b/arch/arm/lib/pbl.lds.S @@ -86,6 +86,12 @@ SECTIONS } __piggydata_end = .; - _barebox_image_size = __piggydata_end - (TEXT_BASE - SZ_2M); + . = ALIGN(4); + .image_end : { + KEEP(*(.image_end)) + } + __image_end = .; + + _barebox_image_size = __image_end - (TEXT_BASE - SZ_2M); _barebox_pbl_size = __bss_start - (TEXT_BASE - SZ_2M); } diff --git a/arch/arm/lib/runtime-offset.S b/arch/arm/lib/runtime-offset.S index 15bf4149b..f10c4c846 100644 --- a/arch/arm/lib/runtime-offset.S +++ b/arch/arm/lib/runtime-offset.S @@ -42,6 +42,9 @@ ld_var_entry __dynsym_end ld_var_entry _barebox_image_size ld_var_entry __bss_start ld_var_entry __bss_stop +#ifdef __PBL__ +ld_var_entry __image_end +#endif 1: ldr r1, =__ld_var_base diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 5492aa4d9..984f8b606 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -6,6 +6,7 @@ extern char __bss_start[], __bss_stop[]; extern char _sdata[], _edata[]; extern char __bare_init_start[], __bare_init_end[]; extern char _end[]; +extern char __image_end[]; extern void *_barebox_image_size; extern void *_barebox_bare_init_size; extern void *_barebox_pbl_size;