Magellan Linux

Annotation of /trunk/grub/patches/grub-2.02-x86_64_PLT32.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3290 - (hide annotations) (download)
Mon Mar 11 18:21:01 2019 UTC (5 years, 2 months ago) by niro
File size: 2255 byte(s)
-added patches to fix ftbfs
1 niro 3290 commit 842c390469e2c2e10b5aa36700324cd3bde25875
2     Author: H.J. Lu <hjl.tools@gmail.com>
3     Date: Sat Feb 17 06:47:28 2018 -0800
4    
5     x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32
6    
7     Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a:
8    
9     https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a
10    
11     x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for
12     32-bit PC-relative branches. Grub2 should treat R_X86_64_PLT32 as
13     R_X86_64_PC32.
14    
15     Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
16     Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
17    
18     diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c
19     index e49d0b6ff..18facf47f 100644
20     --- a/grub-core/efiemu/i386/loadcore64.c
21     +++ b/grub-core/efiemu/i386/loadcore64.c
22     @@ -98,6 +98,7 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
23     break;
24    
25     case R_X86_64_PC32:
26     + case R_X86_64_PLT32:
27     err = grub_efiemu_write_value (addr,
28     *addr32 + rel->r_addend
29     + sym.off
30     diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
31     index 440690673..3a73e6e6c 100644
32     --- a/grub-core/kern/x86_64/dl.c
33     +++ b/grub-core/kern/x86_64/dl.c
34     @@ -70,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
35     break;
36    
37     case R_X86_64_PC32:
38     + case R_X86_64_PLT32:
39     {
40     grub_int64_t value;
41     value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
42     diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
43     index a2bb05439..39d7efb91 100644
44     --- a/util/grub-mkimagexx.c
45     +++ b/util/grub-mkimagexx.c
46     @@ -841,6 +841,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
47     break;
48    
49     case R_X86_64_PC32:
50     + case R_X86_64_PLT32:
51     {
52     grub_uint32_t *t32 = (grub_uint32_t *) target;
53     *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32)
54     diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c
55     index 9179285a5..a79271f66 100644
56     --- a/util/grub-module-verifier.c
57     +++ b/util/grub-module-verifier.c
58     @@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = {
59     -1
60     }, (int[]){
61     R_X86_64_PC32,
62     + R_X86_64_PLT32,
63     -1
64     }
65     },