> On Jul 8, 2015, at 11:18 AM, Ard Biesheuvel <ard.biesheu...@linaro.org> wrote:
> 
> Indeed. But unlike ELF, PE/COFF does not allow the header to overlap
> with the .text section, so using 4 KB alignment for a XIP modules
> .text section always wastes 3.5 KB in the FV.
> 
> Olivier's patch allows code to be generated that breaks if loaded at
> an incorrect alignment, since adding the alignment required to prevent
> such breakage results in the wasted space for XIP modules. Then it
> fixes GenFv by making it aware that AARCH64 can only be adjusted
> (relocated) by multiples of 4 KB even if the PE/COFF metadata
> indicates nothing of the sort.
> 
> I would rather change GenFv so it can place the PE/COFF image in such
> a way that the .text section meets its minimum alignment without
> necessarily aligning the start of the image to the same value, either
> by omitting the PE/COFF header entirely in the FV (if that is allowed
> by the spec) or by moving the header closer to the .text section and
> loading the image SIZEOF_HEADERS bytes before the alignment boundary.
> That way, the section alignment correctly reflects the 4 KB value
> required to support the small C model for AArch64.
> 

Well the TE image format kind of does this today. It replaces the PE/COFF 
headers with a smaller structure to save space, and contains information about 
where the PE/COFF header (image) would normally start, for the debugger. 

Seems like you could add some code to pack the TE header down to the start of 
the .text section and get that space back.

Thanks,

Andrew Fish

> -- 
> Ard.

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to