]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ARM: verify size of zImage
authorRussell King <rmk+kernel@armlinux.org.uk>
Mon, 23 Oct 2017 11:39:32 +0000 (12:39 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Sun, 17 Dec 2017 22:14:05 +0000 (22:14 +0000)
The linker can sometimes add additional sections to the zImage ELF file
which results in the zImage binary being larger than expected.  This
causes appended DT blobs to fail.

Verify that the zImage binary is the expected size, and fail the build
if this is not the case.

We need to include the .data.rel.ro section in the image as the RiscPC
build includes font data that contains a small amount of data in this
section.

Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/boot/compressed/vmlinux.lds.S

index e6bf6774c4bb9903436469ad2ef8a0d97039730a..2b963d8e76ddb28be0cad7de6c631d80a3d24a4b 100644 (file)
@@ -56,6 +56,7 @@ SECTIONS
   .rodata : {
     *(.rodata)
     *(.rodata.*)
+    *(.data.rel.ro)
   }
   .piggydata : {
     *(.piggydata)
@@ -101,6 +102,12 @@ SECTIONS
    * this symbol allows further debug in the near future.
    */
   .image_end (NOLOAD) : {
+    /*
+     * EFI requires that the image is aligned to 512 bytes, and appended
+     * DTB requires that we know where the end of the image is.  Ensure
+     * that both are satisfied by ensuring that there are no additional
+     * sections emitted into the decompressor image.
+     */
     _edata_real = .;
   }
 
@@ -128,3 +135,4 @@ SECTIONS
   .stab.indexstr 0     : { *(.stab.indexstr) }
   .comment 0           : { *(.comment) }
 }
+ASSERT(_edata_real == _edata, "error: zImage file size is incorrect");