[U-Boot] [PATCH 4/5] arm: efi: Generate Microsoft PE format complaint images

Bin Meng bmeng.cn at gmail.com
Wed Sep 26 06:03:08 UTC 2018


Per Microsoft PE Format documentation [1], PointerToSymbolTable and
NumberOfSymbols should be zero for an image in the COFF file header.
Currently the COFF file header is hardcoded on ARM and these two
members are not zero.

This updates the hardcoded structure to clear these two members, as
well as setting the flag IMAGE_FILE_LOCAL_SYMS_STRIPPED so that we
can generate compliant *.efi images.

[1] https://docs.microsoft.com/zh-cn/windows/desktop/Debug/pe-format

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---

 arch/arm/lib/crt0_aarch64_efi.S | 7 ++++---
 arch/arm/lib/crt0_arm_efi.S     | 6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm/lib/crt0_aarch64_efi.S b/arch/arm/lib/crt0_aarch64_efi.S
index 0db4360..a489d05 100644
--- a/arch/arm/lib/crt0_aarch64_efi.S
+++ b/arch/arm/lib/crt0_aarch64_efi.S
@@ -28,13 +28,14 @@ coff_header:
 	.short	2				/* nr_sections */
 	.long	0				/* TimeDateStamp */
 	.long	0				/* PointerToSymbolTable */
-	.long	1				/* NumberOfSymbols */
+	.long	0				/* NumberOfSymbols */
 	.short	section_table - optional_header	/* SizeOfOptionalHeader */
 	/*
 	 * Characteristics: IMAGE_FILE_DEBUG_STRIPPED |
-	 * IMAGE_FILE_EXECUTABLE_IMAGE | IMAGE_FILE_LINE_NUMS_STRIPPED
+	 * IMAGE_FILE_EXECUTABLE_IMAGE | IMAGE_FILE_LINE_NUMS_STRIPPED |
+	 * IMAGE_FILE_LOCAL_SYMS_STRIPPED
 	 */
-	.short	0x206
+	.short	0x20e
 optional_header:
 	.short	0x20b				/* PE32+ format */
 	.byte	0x02				/* MajorLinkerVersion */
diff --git a/arch/arm/lib/crt0_arm_efi.S b/arch/arm/lib/crt0_arm_efi.S
index 23db49f..5330578 100644
--- a/arch/arm/lib/crt0_arm_efi.S
+++ b/arch/arm/lib/crt0_arm_efi.S
@@ -27,14 +27,14 @@ coff_header:
 	.short	2				/* nr_sections */
 	.long	0				/* TimeDateStamp */
 	.long	0				/* PointerToSymbolTable */
-	.long	1				/* NumberOfSymbols */
+	.long	0				/* NumberOfSymbols */
 	.short	section_table - optional_header	/* SizeOfOptionalHeader */
 	/*
 	 * Characteristics: IMAGE_FILE_32BIT_MACHINE |
 	 * IMAGE_FILE_DEBUG_STRIPPED | IMAGE_FILE_EXECUTABLE_IMAGE |
-	 * IMAGE_FILE_LINE_NUMS_STRIPPED
+	 * IMAGE_FILE_LINE_NUMS_STRIPPED | IMAGE_FILE_LOCAL_SYMS_STRIPPED
 	 */
-	.short	0x306
+	.short	0x30e
 optional_header:
 	.short	0x10b				/* PE32+ format */
 	.byte	0x02				/* MajorLinkerVersion */
-- 
2.7.4



More information about the U-Boot mailing list