efi/riscv64: Fix NumberOfRvaAndSizes of PE header

The riscv64 UEFI executable has inconsistent header and therefore cannot
be loaded by the EDK2 implementation of UEFI. Apparently Uboot doesn't
care about this detail but EDK2 validates it.

Specifically NumberOfRvaAndSizes should be the number of data directory
entries. It is set to 6 but there are actually 16.
(All entries below NumberOfRvaAndSizes until section_table)

This was probably a typo 0x6 -> 16 (or 0x10).

This is the check of EDK2:
https://github.com/tianocore/edk2/blob/stable/202011/MdePkg/Library/BasePeCoffLib/BasePeCoff.c#L313-L321

Fixes #16824

Change-Id: I5c0dc080cb1cd191b44e016298656db9edd9ca8d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3761
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
This commit is contained in:
Daniel Schaefer 2021-03-03 00:09:10 +08:00 committed by Alex von Gluck IV
parent ec8bba1587
commit bc33f9dd87

View File

@ -87,7 +87,7 @@ extra_header_fields:
.quad 0 // SizeOfHeapReserve
.quad 0 // SizeOfHeapCommit
.long 0 // LoaderFlags
.long 0x6 // NumberOfRvaAndSizes
.long 16 // NumberOfRvaAndSizes
.quad 0 // ExportTable
.quad 0 // ImportTable