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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#59715): https://edk2.groups.io/g/devel/message/59715
Mute This Topic: https://groups.io/mt/74260002/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to