public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Hii PE/COFF resource section.
@ 2020-05-16 22:43 Andrew Fish
  0 siblings, 0 replies; only message in thread
From: Andrew Fish @ 2020-05-16 22:43 UTC (permalink / raw)
  To: edk2-devel-groups-io

I finally bit the bullet and tried to figure out how to ge Hii resource sections working with Xcode (any tool chain that does not have a resource compiler).

I have some crazy ideas that look like they might work but I'm seeing something strange in the code that extracts the HII resource section [1]. From what I'm seeing it seems to imply that  ResourceDirectoryEntry->u2.OffsetToData is an image relative offset, but  ResourceDirectoryEntry->u2.s.OffsetToDirectory seems relative to the section? That seems like of strange. Is that how it works?

My hack is 2 fold. 
1) In [Hii-Binary-Package.UEFI_HII] I create an empty  $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.lib. The $(RC) usually creates a lib with the resource section, but given libs in Xcode are mach-O Images that is not super helpful. If the magic libs are constructed then $(RC) aware linkers can do the magic. 
2) I updated the Xcode rule for [Dynamic-Library-File] to pass --rc  $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc to $(GENFW)". If that file does not exist it then no-op, if the file exists append the .rc to the end of the image, point the resource directory entry, and grow the last section. For Xcode this is always the .debug section. 

[1] https://github.com/tianocore/edk2/blob/master/MdePkg/Library/BasePeCoffLib/BasePeCoff.c#L1521

Thanks,

Andrew Fish


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-16 22:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-16 22:43 Hii PE/COFF resource section Andrew Fish

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox