summaryrefslogtreecommitdiff
path: root/user/grub
diff options
context:
space:
mode:
authorMax Rees <maxcrees@me.com>2019-06-14 08:07:50 -0400
committerMax Rees <maxcrees@me.com>2019-06-14 08:07:50 -0400
commit4ffb5416b82b7565a91090873530f423dc6f051a (patch)
tree406ba660e71f4d773b814773900daa88f1dd4545 /user/grub
parentdef050dee08eeaef5fe071ab002ba363be1a2190 (diff)
downloadpackages-4ffb5416b82b7565a91090873530f423dc6f051a.tar.gz
packages-4ffb5416b82b7565a91090873530f423dc6f051a.tar.bz2
packages-4ffb5416b82b7565a91090873530f423dc6f051a.tar.xz
packages-4ffb5416b82b7565a91090873530f423dc6f051a.zip
user/grub: fix x86_64 EFI support
Diffstat (limited to 'user/grub')
-rw-r--r--user/grub/APKBUILD4
-rw-r--r--user/grub/x86_64_asm.patch73
2 files changed, 76 insertions, 1 deletions
diff --git a/user/grub/APKBUILD b/user/grub/APKBUILD
index 532b0aa48..7c3123ecb 100644
--- a/user/grub/APKBUILD
+++ b/user/grub/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=grub
pkgver=2.02
-pkgrel=5
+pkgrel=6
pkgdesc="Bootloader with support for Linux, Multiboot and more"
url="https://www.gnu.org/software/grub/"
arch="all !s390x"
@@ -32,6 +32,7 @@ source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz
grub2-accept-empty-module.patch
grub-xen-host_grub.cfg
the-arch-everyone-uses-and-nobody-loves.patch
+ x86_64_asm.patch
default-grub
"
@@ -158,4 +159,5 @@ f2a7d9ab6c445f4e402e790db56378cecd6631b5c367451aa6ce5c01cd95b95c83c3dd24d6d4b857
098a1742aef131c85d63b934a9815879b991f2e73030cb90ac4b5dcd07d249fa0dd0a281e52ada0e10f05d59223493bd416eb47543242bf0ba336a0ebc9b2a1a grub2-accept-empty-module.patch
4e7394e0fff6772c89683039ccf81099ebbfe4f498e6df408977a1488fd59389b6e19afdbf0860ec271e2b2aea0df7216243dcc8235d1ca3af0e7f4d0a9d60a4 grub-xen-host_grub.cfg
088455205f2f397d60e43eab19ed73994880ea1f442661f7975846cceaf2b112d92fd1341119d7dbfad3af2174dfd4d4721f31dead1ac35f4a3cb7c0d92f8a04 the-arch-everyone-uses-and-nobody-loves.patch
+271fdcfbdec567802b351e0a6c38a227ff4ad4eb17533cfa433398fa0929645671a2bfebcc7911d71c1fc3ced94985de148c153834bd2d62018f033eedfbdaf7 x86_64_asm.patch
048d061ac0aab0106f59a3d257739ff5de6c7dc08a4dc9b8b12e9bd2b1ec11f9bc6214013f3d1083b11c3ce41185fcbb5615beb2f290380abf392bb4c3f0d509 default-grub"
diff --git a/user/grub/x86_64_asm.patch b/user/grub/x86_64_asm.patch
new file mode 100644
index 000000000..9ce48165d
--- /dev/null
+++ b/user/grub/x86_64_asm.patch
@@ -0,0 +1,73 @@
+From 842c390469e2c2e10b5aa36700324cd3bde25875 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Sat, 17 Feb 2018 06:47:28 -0800
+Subject: [PATCH] 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>
+---
+ grub-core/efiemu/i386/loadcore64.c | 1 +
+ grub-core/kern/x86_64/dl.c | 1 +
+ util/grub-mkimagexx.c | 1 +
+ util/grub-module-verifier.c | 1 +
+ 4 files changed, 4 insertions(+)
+
+diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c
+index e49d0b6..18facf4 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 4406906..3a73e6e 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 a2bb054..39d7efb 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 9179285..a79271f 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
+ }
+ },
+--
+1.9.1
+