From: "Andrew Fish" <afish@apple.com>
To: edk2-devel-groups-io <devel@edk2.groups.io>
Subject: Hii PE/COFF resource section.
Date: Sat, 16 May 2020 15:43:21 -0700 [thread overview]
Message-ID: <1CEFBD01-06D7-4973-9C90-AB7E0BA2CB2F@apple.com> (raw)
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
reply other threads:[~2020-05-16 22:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1CEFBD01-06D7-4973-9C90-AB7E0BA2CB2F@apple.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox