From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Wed, 21 Oct 2015 13:42:27 +0200 Subject: [U-Boot] [PATCH V2 1/3] arm: discard relocation entry for secure section In-Reply-To: <20151021094216.GA29761@shlinux2> References: <1445320795-2235-1-git-send-email-Peng.Fan@freescale.com> <20151020090532.48426615@lilith> <20151020072039.GA26880@shlinux2> <20151020093251.468ebaa0@lilith> <20151020074127.GA31531@shlinux2> <20151020145910.5e40f8cf@lilith> <20151021094216.GA29761@shlinux2> Message-ID: <20151021134227.55a71b8c@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Peng, On Wed, 21 Oct 2015 17:42:20 +0800, Peng Fan 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.