> On Jun 23, 2015, at 4:17 AM, Olivier Martin <olivier.mar...@arm.com> wrote:
>
> Actually, we had support for LLVM internally for a while (it is actually not
> confidential as I published the code beginning of this year:
> https://github.com/ARM-software/edk2/tree/armcc6
> <https://github.com/ARM-software/edk2/tree/armcc6>).
> And we also had to force the 4K alignment for the PEI binaries (see
> https://github.com/ARM-software/edk2/commit/55cebbc5bf6fc3770e78b2b3dc706c0a22f2620a
>
> <https://github.com/ARM-software/edk2/commit/55cebbc5bf6fc3770e78b2b3dc706c0a22f2620a>).
> I did not want to push the code into SVM as I have got concerns about the
> size of the UEFI firmware if all the XIP PEI binaries have to be 4K aligned
> in the UEFI firmware.
>
I think this is a generic problem with the edk2 build system. This same problem
exists for Itanium(tm) Processor systems. It would also exist on x86 if PEI ran
in 64-bit mode (at this point I think that is an implementation restriction, no
place to put the page tables).
It would be nice to be able to specify different compiler flags for PEI vs. DXE
modules. That way we can have section alignment as 0x20 in PEI and on a page
boundary in DXE.
> I wanted to do more investigation to see whether:
> - it really consume more space (by using padding between the 4K aligned PEI
> modules) in the UEFI Firmware
> - there was a way (probably through BaseTools) to play with the relocation
> offset to prevent these huge paddings
>
When we did the investigation a long time ago making the section boundaries
0x20 (smallest VC++ would support) saved a lot of space in PEI, so that is the
history of that number being used. It does not make much difference in
compressed images, as the empty space compresses well.
To make XIP work you generally need to make the file layout of the PE/COFF the
same as the image layout. I don’t think it is possible to “optimize” out the
empty space. There is simply not enough information in the PE/COFF relocations
of a linked image. There is probably enough information in the unlinked object
files to make this optimization, but at that point you are writing a custom
linker, so it would be easier if your projects makefiles just had the linker
flags you need.
Note, in the short run you could always:
MdeModulePkg/Core/Pei/PeiMain.inf {
<BuildOptions>
XCODE: *_*_*_DLINK_FLAGS = -segalign 0x1000
XCODE: *_*_*_MTOC_FLAGS = -segalign 0x1000
}
And compress as many PEIMs as possible. What we would really want would be
something like:
[BuildOptions.common.PEIM]
[BuildOptions.common.PEI_CORE]
[BuildOptions.common.SEC]
But that is not a really elegant solution. I’d probably rather see something
like this in the tools_def.text
*_*_*_*_BUILDXIP = PEIM PEI_CORE SEC
Then we could add:
XCODE: *_*_*_XIPDLINK_FLAGS = -segalign 0x1000
XCODE: *_*_*_XIPMTOC_FLAGS = -segalign 0x1000
And these flags would get appended to DLINK_FLAGS or MTOC_FLAGS for XIP modules
Maybe there is a better way, but it would be nice to solve this XIP issue in a
general way.
Thanks,
Andrew Fish
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors
network devices and physical & virtual servers, alerts via email & sms
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel