summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-bsp/grub/files/0001-x86-64-Treat-R_X86_64_PLT32-as-R_X86_64_PC32.patch76
-rw-r--r--meta/recipes-bsp/grub/grub2.inc3
2 files changed, 78 insertions, 1 deletions
diff --git a/meta/recipes-bsp/grub/files/0001-x86-64-Treat-R_X86_64_PLT32-as-R_X86_64_PC32.patch b/meta/recipes-bsp/grub/files/0001-x86-64-Treat-R_X86_64_PLT32-as-R_X86_64_PC32.patch
new file mode 100644
index 0000000000..61d58c4047
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/0001-x86-64-Treat-R_X86_64_PLT32-as-R_X86_64_PC32.patch
@@ -0,0 +1,76 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@intel.com>
3
4From 842c390469e2c2e10b5aa36700324cd3bde25875 Mon Sep 17 00:00:00 2001
5From: "H.J. Lu" <hjl.tools@gmail.com>
6Date: Sat, 17 Feb 2018 06:47:28 -0800
7Subject: [PATCH] x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32
8
9Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a:
10
11https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a
12
13x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for
1432-bit PC-relative branches. Grub2 should treat R_X86_64_PLT32 as
15R_X86_64_PC32.
16
17Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
18Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
19---
20 grub-core/efiemu/i386/loadcore64.c | 1 +
21 grub-core/kern/x86_64/dl.c | 1 +
22 util/grub-mkimagexx.c | 1 +
23 util/grub-module-verifier.c | 1 +
24 4 files changed, 4 insertions(+)
25
26diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c
27index e49d0b6ff..18facf47f 100644
28--- a/grub-core/efiemu/i386/loadcore64.c
29+++ b/grub-core/efiemu/i386/loadcore64.c
30@@ -98,6 +98,7 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
31 break;
32
33 case R_X86_64_PC32:
34+ case R_X86_64_PLT32:
35 err = grub_efiemu_write_value (addr,
36 *addr32 + rel->r_addend
37 + sym.off
38diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
39index 440690673..3a73e6e6c 100644
40--- a/grub-core/kern/x86_64/dl.c
41+++ b/grub-core/kern/x86_64/dl.c
42@@ -70,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
43 break;
44
45 case R_X86_64_PC32:
46+ case R_X86_64_PLT32:
47 {
48 grub_int64_t value;
49 value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
50diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
51index a2bb05439..39d7efb91 100644
52--- a/util/grub-mkimagexx.c
53+++ b/util/grub-mkimagexx.c
54@@ -841,6 +841,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
55 break;
56
57 case R_X86_64_PC32:
58+ case R_X86_64_PLT32:
59 {
60 grub_uint32_t *t32 = (grub_uint32_t *) target;
61 *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32)
62diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c
63index 9179285a5..a79271f66 100644
64--- a/util/grub-module-verifier.c
65+++ b/util/grub-module-verifier.c
66@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = {
67 -1
68 }, (int[]){
69 R_X86_64_PC32,
70+ R_X86_64_PLT32,
71 -1
72 }
73 },
74--
752.11.0
76
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index a8f335e1f8..230c585691 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -17,8 +17,9 @@ SRC_URI = "https://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
17 file://autogen.sh-exclude-pc.patch \ 17 file://autogen.sh-exclude-pc.patch \
18 file://grub-module-explicitly-keeps-symbole-.module_license.patch \ 18 file://grub-module-explicitly-keeps-symbole-.module_license.patch \
19 file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \ 19 file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
20 file://fix.build.with.gcc-7.patch \ 20 file://fix.build.with.gcc-7.patch \
21 file://gcc8.patch \ 21 file://gcc8.patch \
22 file://0001-x86-64-Treat-R_X86_64_PLT32-as-R_X86_64_PC32.patch \
22" 23"
23SRC_URI[md5sum] = "1116d1f60c840e6dbd67abbc99acb45d" 24SRC_URI[md5sum] = "1116d1f60c840e6dbd67abbc99acb45d"
24SRC_URI[sha256sum] = "660ee136fbcee08858516ed4de2ad87068bfe1b6b8b37896ce3529ff054a726d" 25SRC_URI[sha256sum] = "660ee136fbcee08858516ed4de2ad87068bfe1b6b8b37896ce3529ff054a726d"