[U-Boot] [PATCH V2 1/3] arm: discard relocation entry for secure section

Albert ARIBAUD albert.u.boot at aribaud.net
Wed Oct 21 13:42:27 CEST 2015


Hello Peng,

On Wed, 21 Oct 2015 17:42:20 +0800, Peng Fan <b51431 at freescale.com>
wrote:
> Hello Albert,

> I do not know how to generate non-relocatable code only for the secure text.
> Since -mword-relocations and -pie are global flags, I do not know how to disable
> mword-relocations when compiling PSCI and other secure text.

Actually, I haven't even found a compiler or gcc option to entirely
remove relocations altogether.

> Is this ok for you?
> 
> diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
> index 65986e8..fb2128a 100644
> --- a/arch/arm/cpu/u-boot.lds
> +++ b/arch/arm/cpu/u-boot.lds
> @@ -14,6 +14,7 @@ OUTPUT_ARCH(arm)
> ENTRY(_start)
> SECTIONS
> {
> +       /DISCARD/ : { *(.rel._secure*) }
>         . = 0x00000000;
>    
>         . = ALIGN(4);

Functionally, it works -- I've just checked it by comparing u-boot.map
files of a mx7dsabresd build with and without the DISCARD. Not a single
symbol from the text and data section gets changed.

The only missing thing left is a comment before the DISCARD line,
explaining both why .rel._secure* input sections have to be discarded,
and also explaining why this is done it right at the start of the output
sections.

Thanks for your patience. :)

> Regards,
> Peng.

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list