diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-10-12 14:19:08 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-10-12 14:19:08 +0100 |
commit | 9c513d095ce8b1b7790958095ff83d5fe9fec308 (patch) | |
tree | 51bee432749b9bb59f13f5b1531058b03f9e05b1 /packages/sys-boot | |
parent | e697eef5a19b92933e498591c635b73ce0d948d6 (diff) |
sys-boot/grub : fix relocation 0x4 is not implemented yet
Diffstat (limited to 'packages/sys-boot')
-rw-r--r-- | packages/sys-boot/grub/files/01-xfs-accept-filesystem-with-sparse-inodes.patch (renamed from packages/sys-boot/grub/files/cda0a857dd7a27cd5d621747464bfe71e8727fff.patch) | 0 | ||||
-rw-r--r-- | packages/sys-boot/grub/files/02-support-multiple-early-initrd-images.patch (renamed from packages/sys-boot/grub/files/a698240df0c43278b2d1d7259c8e7a6926c63112.patch) | 0 | ||||
-rw-r--r-- | packages/sys-boot/grub/files/03-relocation.patch | 65 | ||||
-rw-r--r-- | packages/sys-boot/grub/files/04-Fix-packed-not-aligned-error-on-GCC-8.patch | 72 | ||||
-rw-r--r-- | packages/sys-boot/grub/grub-2.02-r3.exheres-0 | 13 | ||||
-rw-r--r-- | packages/sys-boot/grub/grub-2.02-r4.exheres-0 | 15 |
6 files changed, 152 insertions, 13 deletions
diff --git a/packages/sys-boot/grub/files/cda0a857dd7a27cd5d621747464bfe71e8727fff.patch b/packages/sys-boot/grub/files/01-xfs-accept-filesystem-with-sparse-inodes.patch index f18553d..f18553d 100644 --- a/packages/sys-boot/grub/files/cda0a857dd7a27cd5d621747464bfe71e8727fff.patch +++ b/packages/sys-boot/grub/files/01-xfs-accept-filesystem-with-sparse-inodes.patch diff --git a/packages/sys-boot/grub/files/a698240df0c43278b2d1d7259c8e7a6926c63112.patch b/packages/sys-boot/grub/files/02-support-multiple-early-initrd-images.patch index 4e17549..4e17549 100644 --- a/packages/sys-boot/grub/files/a698240df0c43278b2d1d7259c8e7a6926c63112.patch +++ b/packages/sys-boot/grub/files/02-support-multiple-early-initrd-images.patch diff --git a/packages/sys-boot/grub/files/03-relocation.patch b/packages/sys-boot/grub/files/03-relocation.patch new file mode 100644 index 0000000..1aeae68 --- /dev/null +++ b/packages/sys-boot/grub/files/03-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 + } + }, diff --git a/packages/sys-boot/grub/files/04-Fix-packed-not-aligned-error-on-GCC-8.patch b/packages/sys-boot/grub/files/04-Fix-packed-not-aligned-error-on-GCC-8.patch new file mode 100644 index 0000000..2d09149 --- /dev/null +++ b/packages/sys-boot/grub/files/04-Fix-packed-not-aligned-error-on-GCC-8.patch @@ -0,0 +1,72 @@ +From 563b1da6e6ae7af46cc8354cadb5dab416989f0a Mon Sep 17 00:00:00 2001 +From: Michael Chang <mchang@suse.com> +Date: Mon, 26 Mar 2018 16:52:34 +0800 +Subject: Fix packed-not-aligned error on GCC 8 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When building with GCC 8, there are several errors regarding packed-not-aligned. + +./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned] + +This patch fixes the build error by cleaning up the ambiguity of placing +aligned structure in a packed one. In "struct grub_btrfs_time" and "struct +grub_gpt_part_type", the aligned attribute seems to be superfluous, and also +has to be packed, to ensure the structure is bit-to-bit mapped to the format +laid on disk. I think we could blame to copy and paste error here for the +mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as +the name suggests. :) + +Signed-off-by: Michael Chang <mchang@suse.com> +Tested-by: Michael Chang <mchang@suse.com> +Tested-by: Paul Menzel <paulepanter@users.sourceforge.net> +Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> +--- + grub-core/fs/btrfs.c | 2 +- + include/grub/efiemu/runtime.h | 2 +- + include/grub/gpt_partition.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 4849c1ceb..be195448d 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -175,7 +175,7 @@ struct grub_btrfs_time + { + grub_int64_t sec; + grub_uint32_t nanosec; +-} __attribute__ ((aligned (4))); ++} GRUB_PACKED; + + struct grub_btrfs_inode + { +diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h +index 9b6b729f4..36d2dedf4 100644 +--- a/include/grub/efiemu/runtime.h ++++ b/include/grub/efiemu/runtime.h +@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel + + struct efi_variable + { +- grub_efi_guid_t guid; ++ grub_efi_packed_guid_t guid; + grub_uint32_t namelen; + grub_uint32_t size; + grub_efi_uint32_t attributes; +diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h +index 1b32f6725..9668a68c3 100644 +--- a/include/grub/gpt_partition.h ++++ b/include/grub/gpt_partition.h +@@ -28,7 +28,7 @@ struct grub_gpt_part_type + grub_uint16_t data2; + grub_uint16_t data3; + grub_uint8_t data4[8]; +-} __attribute__ ((aligned(8))); ++} GRUB_PACKED; + typedef struct grub_gpt_part_type grub_gpt_part_type_t; + + #define GRUB_GPT_PARTITION_TYPE_EMPTY \ +-- +cgit v1.1-33-g03f6 + diff --git a/packages/sys-boot/grub/grub-2.02-r3.exheres-0 b/packages/sys-boot/grub/grub-2.02-r3.exheres-0 deleted file mode 100644 index 5a7c080..0000000 --- a/packages/sys-boot/grub/grub-2.02-r3.exheres-0 +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2015 Ivan Diorditsa <ivan.diorditsa@gmail.com> -# Distributed under the terms of the GNU General Public License v2 - -require grub - -SLOT="0" -PLATFORMS="~amd64 ~armv7 ~armv8 ~x86" - -DEFAULT_SRC_PREPARE_PATCHES=( - "${FILES}"/a698240df0c43278b2d1d7259c8e7a6926c63112.patch - "${FILES}"/cda0a857dd7a27cd5d621747464bfe71e8727fff.patch -) - diff --git a/packages/sys-boot/grub/grub-2.02-r4.exheres-0 b/packages/sys-boot/grub/grub-2.02-r4.exheres-0 new file mode 100644 index 0000000..cc5b955 --- /dev/null +++ b/packages/sys-boot/grub/grub-2.02-r4.exheres-0 @@ -0,0 +1,15 @@ +# Copyright 2015 Ivan Diorditsa <ivan.diorditsa@gmail.com> +# Distributed under the terms of the GNU General Public License v2 + +require grub + +SLOT="0" +PLATFORMS="~amd64 ~armv7 ~armv8 ~x86" + +DEFAULT_SRC_PREPARE_PATCHES=( + "${FILES}"/01-xfs-accept-filesystem-with-sparse-inodes.patch + "${FILES}"/02-support-multiple-early-initrd-images.patch + "${FILES}"/03-relocation.patch + "${FILES}"/04-Fix-packed-not-aligned-error-on-GCC-8.patch +) + |