summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/cpu/uncompress.c17
-rw-r--r--arch/arm/lib/pbl.lds.S5
2 files changed, 11 insertions, 11 deletions
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index 2588e84b66..b600c1e7ec 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -37,9 +37,8 @@
unsigned long free_mem_ptr;
unsigned long free_mem_end_ptr;
-static int __attribute__((__used__))
- __attribute__((__section__(".image_end")))
- __image_end_dummy = 0xdeadbeef;
+static int __attribute__((__section__(".image_end")))
+ image_end_marker = 0xdeadbeef;
void __noreturn barebox_multi_pbl_start(unsigned long membase,
unsigned long memsize, void *boarddata)
@@ -52,7 +51,7 @@ void __noreturn barebox_multi_pbl_start(unsigned long membase,
void *pg_start;
unsigned long pc = get_pc();
- image_end = (void *)ld_var(__image_end) + get_runtime_offset();
+ image_end = (void *)&image_end_marker + get_runtime_offset();
if (IS_ENABLED(CONFIG_PBL_RELOCATABLE)) {
/*
@@ -67,11 +66,13 @@ void __noreturn barebox_multi_pbl_start(unsigned long membase,
}
/*
- * image_end is the first location after the executable. It contains
- * the size of the appended compressed binary followed by the binary.
+ * image_end is the image_end_marker defined above. It is the last location
+ * in the executable. Right after the executable the build process adds
+ * the size of the appended compressed binary followed by the compressed
+ * binary itself.
*/
- pg_start = image_end + 1;
- pg_len = *(image_end);
+ pg_start = image_end + 2;
+ pg_len = *(image_end + 1);
uncompressed_len = get_unaligned((const u32 *)(pg_start + pg_len - 4));
if (IS_ENABLED(CONFIG_RELOCATABLE))
diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S
index 73baff0ca5..7de7791b71 100644
--- a/arch/arm/lib/pbl.lds.S
+++ b/arch/arm/lib/pbl.lds.S
@@ -87,10 +87,9 @@ SECTIONS
__piggydata_end = .;
. = ALIGN(4);
- .image_end : {
- KEEP(*(.image_end))
- }
+ .image_end : { *(.image_end) }
__image_end = .;
+
_barebox_image_size = __image_end - BASE;
_barebox_pbl_size = __bss_start - BASE;
}