diff options
-rw-r--r-- | grub2-efi/.signature | 5 | ||||
-rw-r--r-- | grub2-efi/Pkgfile | 5 | ||||
-rw-r--r-- | grub2-efi/grub2-relocation.patch | 65 |
3 files changed, 72 insertions, 3 deletions
diff --git a/grub2-efi/.signature b/grub2-efi/.signature index f5d5cc344..100a4b57c 100644 --- a/grub2-efi/.signature +++ b/grub2-efi/.signature @@ -1,5 +1,6 @@ untrusted comment: verify with /etc/ports/opt.pub -RWSE3ohX2g5d/YJmUPwai4w+Twi2eTcGTxxLuh6HExjesdh+URSxqlpP1xWSFwLQ9xl2NyRwC0LMrQZ4S8i+m0oMo7kxShoIMAw= -SHA256 (Pkgfile) = 4e628b4ad1739b28f0c0935d429bcac90557297cb222adb6ca4e3fcb762aad14 +RWSE3ohX2g5d/dn5qt9MdIDdhx1aCa9A5s4fl6T4mdXJLNseCjebyUuI0poWVO8Z44IJ6732mVuurZhwLerJhikiTS6nef7aSQg= +SHA256 (Pkgfile) = db9fdbe845496dcb22024bffe49c58cf3c9ba7952dfedbf12c9b46c37304d93a SHA256 (.footprint) = be3c0c176335de61fb03e01702968798c101216091640b618b61b467dcfd92d8 SHA256 (grub-2.02.tar.xz) = 810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f +SHA256 (grub2-relocation.patch) = 51562fa1016c54567dbf42a86c0cfc902372ab579bbee17879a81aff09b76b99 diff --git a/grub2-efi/Pkgfile b/grub2-efi/Pkgfile index 3190dfe71..3bf5ee0c7 100644 --- a/grub2-efi/Pkgfile +++ b/grub2-efi/Pkgfile @@ -6,11 +6,14 @@ name=grub2-efi version=2.02 release=1 -source=(http://ftp.gnu.org/gnu/grub/grub-$version.tar.xz) +source=(http://ftp.gnu.org/gnu/grub/grub-$version.tar.xz \ + grub2-relocation.patch) build() { export CFLAGS="${CFLAGS} -Wno-error" + patch -d grub-$version -p1 -i $SRC/grub2-relocation.patch + # fix for glibc 'gets' removal sed -i -e '/gets is a/d' grub-$version/grub-core/gnulib/stdio.in.h diff --git a/grub2-efi/grub2-relocation.patch b/grub2-efi/grub2-relocation.patch new file mode 100644 index 000000000..1aeae6849 --- /dev/null +++ b/grub2-efi/grub2-relocation.patch @@ -0,0 +1,65 @@ +commit 842c390469e2c2e10b5aa36700324cd3bde25875 +Author: H.J. Lu <hjl.tools@gmail.com> +Date: Sat Feb 17 06:47:28 2018 -0800 + + x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32 + + Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a: + + https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a + + x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for + 32-bit PC-relative branches. Grub2 should treat R_X86_64_PLT32 as + R_X86_64_PC32. + + Signed-off-by: H.J. Lu <hjl.tools@gmail.com> + Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> + +diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c +index e49d0b6ff..18facf47f 100644 +--- a/grub-core/efiemu/i386/loadcore64.c ++++ b/grub-core/efiemu/i386/loadcore64.c +@@ -98,6 +98,7 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs, + break; + + case R_X86_64_PC32: ++ case R_X86_64_PLT32: + err = grub_efiemu_write_value (addr, + *addr32 + rel->r_addend + + sym.off +diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c +index 440690673..3a73e6e6c 100644 +--- a/grub-core/kern/x86_64/dl.c ++++ b/grub-core/kern/x86_64/dl.c +@@ -70,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + break; + + case R_X86_64_PC32: ++ case R_X86_64_PLT32: + { + grub_int64_t value; + value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value - +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index a2bb05439..39d7efb91 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -841,6 +841,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, + break; + + case R_X86_64_PC32: ++ case R_X86_64_PLT32: + { + grub_uint32_t *t32 = (grub_uint32_t *) target; + *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32) +diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c +index 9179285a5..a79271f66 100644 +--- a/util/grub-module-verifier.c ++++ b/util/grub-module-verifier.c +@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = { + -1 + }, (int[]){ + R_X86_64_PC32, ++ R_X86_64_PLT32, + -1 + } + }, |