gnu-efi/0032-Make-our-dummy-.reloc-sections-not-depend-on-section.patch
Peter Jones e7a09764c4 Update to 3.0.11 and add some fixes and enhancements.
- Update to 3.0.11 (via patches generated from git)
- Plus newer upstream fixes (also via patches generated from git)
- Fix shell exit failures in make
- Fix .reloc section generation
- Fix CHAR8 definition
- Fix "make DESTDIR=..."
- Change the installed .a/.o layout
- Provide makefiles for consumers to use.
- Make the -devel noarch since it's just headers.
- Add a bunch of compatibility symlinks for our older packages.
  These will go away once we've migrated everything using them in fedora
  to use the newer make system...

Signed-off-by: Peter Jones <pjones@redhat.com>
2020-01-23 15:08:08 -05:00

84 lines
2.5 KiB
Diff

From 6eb63b104e77f9244a31d183cbe34e929afe1975 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 30 Sep 2019 14:29:45 -0400
Subject: [PATCH 32/45] Make our dummy .reloc sections not depend on section
order.
Currently on x64 we manually build a dummy .reloc table entry by using a
symbol in .text and subtracting its address from another symbol that's
inside the .reloc section. On ia32 we just use its location. In either
case, if the linker puts either section in a location we're not
expecting, the .reloc table winds up having invalid values, and the PE
loader will fail to load the binary.
This changes it to be two symbols that are both in .text, making the
result unrelated to the section order or location.
It's not clear to me that these .reloc entries are actually necessary at
all, but I'm going to leave them in place for now, in case they are.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
gnuefi/crt0-efi-ia32.S | 17 +++++++++--------
gnuefi/crt0-efi-x64.S | 16 ++++++++--------
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/gnuefi/crt0-efi-ia32.S b/gnuefi/crt0-efi-ia32.S
index 8e8e372f551..031a592ab35 100644
--- a/gnuefi/crt0-efi-ia32.S
+++ b/gnuefi/crt0-efi-ia32.S
@@ -64,13 +64,14 @@ _start:
.exit: leave
ret
- // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
-
- .data
-dummy: .long 0
+ // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
+ .data
+.dummy0:
+.dummy1:
+ .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
+ .section .reloc, "a"
+ .long .dummy1-.dummy0 // Page RVA
+ .long 10 // Block Size (2*4+2)
+ .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
diff --git a/gnuefi/crt0-efi-x64.S b/gnuefi/crt0-efi-x64.S
index 3fe361b7ffd..5c86cde12e8 100644
--- a/gnuefi/crt0-efi-x64.S
+++ b/gnuefi/crt0-efi-x64.S
@@ -62,15 +62,15 @@ _start:
.exit:
ret
- // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
-
- .data
-dummy: .long 0
+ // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
+ .data
+.dummy0:
+.dummy1:
+ .long 0
#define IMAGE_REL_ABSOLUTE 0
- .section .reloc, "a"
-label1:
- .long dummy-label1 // Page RVA
- .long 10 // Block Size (2*4+2)
+ .section .reloc, "a"
+ .long .dummy1-.dummy0 // Page RVA
+ .long 10 // Block Size (2*4+2)
.word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
--
2.24.1