diff options
author | 2018-01-28 22:54:24 +0000 | |
---|---|---|
committer | 2018-01-28 22:58:41 +0000 | |
commit | c62fc5c0068b7cf27a79700cf9f0e7f20a625641 (patch) | |
tree | c98609638dead63ccf9936a0afa2f414fca6a1dd /sys-boot/gnu-efi/files/gnu-efi-3.0.6-ia64-gnu-hash.patch | |
parent | net-dns/bind: stable 9.11.2_p1 for ppc, bug #644706 (diff) | |
download | gentoo-c62fc5c0068b7cf27a79700cf9f0e7f20a625641.tar.gz gentoo-c62fc5c0068b7cf27a79700cf9f0e7f20a625641.tar.bz2 gentoo-c62fc5c0068b7cf27a79700cf9f0e7f20a625641.zip |
sys-boot/gnu-efi: fix linker script on .gnu.hash systems, bug #575300
Two patches here:
- gnu-hash.patch: fix linker script to work on .gnu.hash-only systems
- ia64-setjmp.patch: fix build breakage on ia64 systems
Reported-by: Émeric Maschino
Closes: https://bugs.gentoo.org/575300
Package-Manager: Portage-2.3.20, Repoman-2.3.6
Diffstat (limited to 'sys-boot/gnu-efi/files/gnu-efi-3.0.6-ia64-gnu-hash.patch')
-rw-r--r-- | sys-boot/gnu-efi/files/gnu-efi-3.0.6-ia64-gnu-hash.patch | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/sys-boot/gnu-efi/files/gnu-efi-3.0.6-ia64-gnu-hash.patch b/sys-boot/gnu-efi/files/gnu-efi-3.0.6-ia64-gnu-hash.patch new file mode 100644 index 000000000000..9487ba4c6731 --- /dev/null +++ b/sys-boot/gnu-efi/files/gnu-efi-3.0.6-ia64-gnu-hash.patch @@ -0,0 +1,149 @@ +https://sourceforge.net/p/gnu-efi/code/merge-requests/1/ + +From 2cc0b085fb82e80d43cc08c8376dff9f9532a72d Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich <slyfox@gentoo.org> +Date: Sat, 27 Jan 2018 20:29:05 +0000 +Subject: [PATCH] gnuefi: preserve .gnu.hash sections (unbreaks elilo on IA-64) + +Gentoo has slightly modified linker defaults: --hash-style=gnu +This means all ELF files in system have '.gnu.hash' section +but no '.hash' section. + +gnuefi's ldscript did not account for it and as a result +one symbol 'ImageBase' did not resolve locally for elilo.so +and caused 'elilo' to fail to load by ia64 EFI: + Loading.: Gentoo (try new elilo) + ImageAddress: pointer is outside of image + ImageAddress: pointer is outside of image + +Those two relocations come from crt0-efi-ia64.S PE32 entry point +fdescr: + +``` + #define IMAGE_REL_BASED_DIR64<->10 + .section .reloc, "a" + data4 _start_plabel // Page RVA + data4 12 // Block Size (2*4+2*2) + 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 +``` + +These refer ImageBase. + +The change adds '.gnu.hash' collection (follows existing '.hash' +collection). + +Tested on IA-64 by successfully booting elilo-3.16. + +Bug: https://bugs.gentoo.org/575300 +Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> +--- + README.gnuefi | 8 +++++++- + gnuefi/elf_ia32_efi.lds | 4 +++- + gnuefi/elf_ia32_fbsd_efi.lds | 4 +++- + gnuefi/elf_ia64_efi.lds | 4 +++- + gnuefi/elf_x86_64_efi.lds | 4 +++- + gnuefi/elf_x86_64_fbsd_efi.lds | 4 +++- + 6 files changed, 22 insertions(+), 6 deletions(-) + +diff --git a/README.gnuefi b/README.gnuefi +index a7feec0..512698c 100644 +--- a/README.gnuefi ++++ b/README.gnuefi +@@ -231,11 +231,17 @@ and page sized.These eight sections are used to group together the much + greater number of sections that are typically present in ELF object files. + Specifically: + +- .hash ++ .hash (and/or .gnu.hash) + Collects the ELF .hash info (this section _must_ be the first + section in order to build a shared object file; the section is + not actually loaded or used at runtime). + ++ GNU binutils provides a mechanism to generate different hash info ++ via --hash-style=<sysv|gnu|both> option. In this case output ++ shared object will contain .hash section, .gnu.hash section or ++ both. In order to generate correct output linker script preserves ++ both types of hash sections. ++ + .text + Collects all sections containing executable code. + +diff --git a/gnuefi/elf_ia32_efi.lds b/gnuefi/elf_ia32_efi.lds +index 6cc4ce1..f27fe5f 100644 +--- a/gnuefi/elf_ia32_efi.lds ++++ b/gnuefi/elf_ia32_efi.lds +@@ -5,7 +5,9 @@ SECTIONS + { + . = 0; + ImageBase = .; +- .hash : { *(.hash) } /* this MUST come first! */ ++ /* .hash and/or .gnu.hash MUST come first! */ ++ .hash : { *(.hash) } ++ .gnu.hash : { *(.gnu.hash) } + . = ALIGN(4096); + .text : + { +diff --git a/gnuefi/elf_ia32_fbsd_efi.lds b/gnuefi/elf_ia32_fbsd_efi.lds +index 77d6fad..cd309e2 100644 +--- a/gnuefi/elf_ia32_fbsd_efi.lds ++++ b/gnuefi/elf_ia32_fbsd_efi.lds +@@ -5,7 +5,9 @@ SECTIONS + { + . = 0; + ImageBase = .; +- .hash : { *(.hash) } /* this MUST come first! */ ++ /* .hash and/or .gnu.hash MUST come first! */ ++ .hash : { *(.hash) } ++ .gnu.hash : { *(.gnu.hash) } + . = ALIGN(4096); + .text : + { +diff --git a/gnuefi/elf_ia64_efi.lds b/gnuefi/elf_ia64_efi.lds +index baca962..190792a 100644 +--- a/gnuefi/elf_ia64_efi.lds ++++ b/gnuefi/elf_ia64_efi.lds +@@ -5,7 +5,9 @@ SECTIONS + { + . = 0; + ImageBase = .; +- .hash : { *(.hash) } /* this MUST come first! */ ++ /* .hash and/or .gnu.hash MUST come first! */ ++ .hash : { *(.hash) } ++ .gnu.hash : { *(.gnu.hash) } + . = ALIGN(4096); + .text : + { +diff --git a/gnuefi/elf_x86_64_efi.lds b/gnuefi/elf_x86_64_efi.lds +index 942d1f3..7be5902 100644 +--- a/gnuefi/elf_x86_64_efi.lds ++++ b/gnuefi/elf_x86_64_efi.lds +@@ -6,7 +6,9 @@ SECTIONS + { + . = 0; + ImageBase = .; +- .hash : { *(.hash) } /* this MUST come first! */ ++ /* .hash and/or .gnu.hash MUST come first! */ ++ .hash : { *(.hash) } ++ .gnu.hash : { *(.gnu.hash) } + . = ALIGN(4096); + .eh_frame : + { +diff --git a/gnuefi/elf_x86_64_fbsd_efi.lds b/gnuefi/elf_x86_64_fbsd_efi.lds +index 6fd2031..fe1f334 100644 +--- a/gnuefi/elf_x86_64_fbsd_efi.lds ++++ b/gnuefi/elf_x86_64_fbsd_efi.lds +@@ -6,7 +6,9 @@ SECTIONS + { + . = 0; + ImageBase = .; +- .hash : { *(.hash) } /* this MUST come first! */ ++ /* .hash and/or .gnu.hash MUST come first! */ ++ .hash : { *(.hash) } ++ .gnu.hash : { *(.gnu.hash) } + . = ALIGN(4096); + .eh_frame : + { +-- +2.16.1 + |