From: Manfred Schlaegl Date: Wed, 10 May 2017 13:41:32 +0000 (+0200) Subject: ARM: fixed relocation using proper alignment X-Git-Tag: v2017.07-rc2~53 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cdde7de0364ffa505d631b342f1a2fa729e8e67d;p=u-boot ARM: fixed relocation using proper alignment Using u-boot-2017.05 on i.MX6UL we ran into following problem: Initially U-Boot could be started normally. If we added one random command in configuration, the newly generated image hung at startup (last output was DRAM: 256 MiB). We tracked this down to a data abort within relocation (relocated_code). relocated_code in arch/arm/lib/relocate.S copies 8 bytes per loop iteration until the source pointer is equal to __image_copy_end. In a good case __image_copy_end was aligned to 8 bytes, so the loop stopped as suggested, but in an errornous case __image_copy_end was not aligned to 8 bytes, so the loop ran out of bounds and caused a data abort exception. This patches solves the issue by aligning __image_copy_end to 8 byte using the linker script related to arm. I don't know if it's the correct way to solve this, so some review would be very appreciated. --- diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index 37d4c605ac..70bee1a3f8 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -165,7 +165,7 @@ SECTIONS *(.__efi_runtime_rel_stop) } - . = ALIGN(4); + . = ALIGN(8); .image_copy_end : {