Browse Source

Fix dummy relocation block alignment

As per the PE format specification, relocation blocks must be aligned on 32-bit boundaries. Fix the dummy relocations to obey the alignment constraints.
Marvin Häuser 4 years ago
parent
commit
b916d1e54e
3 changed files with 6 additions and 4 deletions
  1. 3 2
      gnuefi/crt0-efi-ia32.S
  2. 1 1
      gnuefi/crt0-efi-ia64.S
  3. 2 1
      gnuefi/crt0-efi-x86_64.S

+ 3 - 2
gnuefi/crt0-efi-ia32.S

@@ -72,5 +72,6 @@ dummy:	.long	0
 #define IMAGE_REL_ABSOLUTE	0
  	.section .reloc
  	.long	dummy					// Page RVA
- 	.long	10					// Block Size (2*4+2)
- 	.word	(IMAGE_REL_ABSOLUTE<<12) +  0		// reloc for dummy
+	.long	12					// Block Size (2*4+2*2), must be aligned by 32 Bits
+	.word	(IMAGE_REL_ABSOLUTE<<12) +  0		// reloc for dummy
+	.word	(IMAGE_REL_ABSOLUTE<<12) +  0		// reloc for dummy

+ 1 - 1
gnuefi/crt0-efi-ia64.S

@@ -82,6 +82,6 @@ _start_plabel:
 
 	.section .reloc, "a"
 	data4	_start_plabel				// Page RVA
-	data4	12					// Block Size (2*4+2*2)
+	data4	12					// Block Size (2*4+2*2), must be aligned by 32 Bits
 	data2	(IMAGE_REL_BASED_DIR64<<12) +  0	// reloc for plabel's entry point
 	data2	(IMAGE_REL_BASED_DIR64<<12) +  8	// reloc for plabel's global pointer

+ 2 - 1
gnuefi/crt0-efi-x86_64.S

@@ -71,6 +71,7 @@ dummy:	.long	0
  	.section .reloc, "a"
 label1:
 	.long	dummy-label1				// Page RVA
- 	.long	10					// Block Size (2*4+2)
+	.long	12					// Block Size (2*4+2*2), must be aligned by 32 Bits
+	.word	(IMAGE_REL_ABSOLUTE<<12) +  0		// reloc for dummy
 	.word	(IMAGE_REL_ABSOLUTE<<12) +  0		// reloc for dummy