From de52fceb60bdda093fcc87b026d98cb23a31d27e121060dbca1d89510019048d Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Tue, 12 Aug 2014 02:33:07 +0000 Subject: [PATCH 1/2] Accepting request 244238 from home:k0da:ppc - Fix the 64-bit trampoline code in dynamic linker (bnc#890999) grub2-ppc64le-fix-64bit-trampoline-in-dyn-linker.patch OBS-URL: https://build.opensuse.org/request/show/244238 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=101 --- ...e-fix-64bit-trampoline-in-dyn-linker.patch | 20 +++++++++++++++++++ grub2.changes | 6 ++++++ grub2.spec | 2 ++ 3 files changed, 28 insertions(+) create mode 100644 grub2-ppc64le-fix-64bit-trampoline-in-dyn-linker.patch diff --git a/grub2-ppc64le-fix-64bit-trampoline-in-dyn-linker.patch b/grub2-ppc64le-fix-64bit-trampoline-in-dyn-linker.patch new file mode 100644 index 0000000..1d1f132 --- /dev/null +++ b/grub2-ppc64le-fix-64bit-trampoline-in-dyn-linker.patch @@ -0,0 +1,20 @@ +Index: grub-2.02~beta2/grub-core/kern/powerpc/dl.c +=================================================================== +--- grub-2.02~beta2.orig/grub-core/kern/powerpc/dl.c ++++ grub-2.02~beta2/grub-core/kern/powerpc/dl.c +@@ -61,6 +61,7 @@ struct trampoline + grub_uint32_t std; + grub_uint32_t addis; + grub_uint32_t addi; ++ grub_uint32_t clrldi; + grub_uint32_t mtctr; + grub_uint32_t bctr; + }; +@@ -70,6 +71,7 @@ static const struct trampoline trampolin + 0xf8410018, /* std r2,24(r1) */ + 0x3d800000, /* addis r12,0,0 */ + 0x398c0000, /* addi r12,r12,0 */ ++ 0x798c0020, /* clrldi r12,r12,32 */ + 0x7d8903a6, /* mtctr r12 */ + 0x4e800420, /* bctr */ + }; diff --git a/grub2.changes b/grub2.changes index 3b2288e..4af7371 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Aug 11 14:34:55 UTC 2014 - dvaleev@suse.com + +- Fix the 64-bit trampoline code in dynamic linker (bnc#890999) + grub2-ppc64le-fix-64bit-trampoline-in-dyn-linker.patch + ------------------------------------------------------------------- Tue Jul 29 11:46:54 CEST 2014 - tiwai@suse.de diff --git a/grub2.spec b/grub2.spec index d10d109..86233fa 100644 --- a/grub2.spec +++ b/grub2.spec @@ -179,6 +179,7 @@ Patch229: grub2-xfs-Fix-termination-loop-for-directory-iteration.patch Patch230: grub2-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch Patch231: grub2-xfs-V5-filesystem-format-support.patch Patch232: grub2-efi_gop-avoid-low-resolution.patch +Patch233: grub2-ppc64le-fix-64bit-trampoline-in-dyn-linker.patch Requires: gettext-runtime %if 0%{?suse_version} >= 1140 @@ -374,6 +375,7 @@ mv po/grub.pot po/%{name}.pot %patch230 -p1 %patch231 -p1 %patch232 -p1 +%patch233 -p1 # Generate po/LINGUAS for message catalogs ... ./linguas.sh From 20cf2b88034650aa2d95d4312f287723f4fd8c45a58431ebb9550f0ce5f8d321 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Wed, 13 Aug 2014 02:36:26 +0000 Subject: [PATCH 2/2] Accepting request 244332 from home:Andreas_Schwab:Factory - Enable building on aarch64 - aarch64-reloc.patch: support R_AARCH64_PREL32 relocation - Build host tools with RPM_OPT_FLAGS OBS-URL: https://build.opensuse.org/request/show/244332 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=102 --- aarch64-reloc.patch | 56 +++++++++++++++++++++++++++++++++++++++++++++ grub2.changes | 7 ++++++ grub2.spec | 14 ++++++++++-- 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 aarch64-reloc.patch diff --git a/aarch64-reloc.patch b/aarch64-reloc.patch new file mode 100644 index 0000000..bd86338 --- /dev/null +++ b/aarch64-reloc.patch @@ -0,0 +1,56 @@ +From f472bc5ac54e72eb09b0606f588085af504d754b Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Tue, 12 Aug 2014 10:42:43 +0200 +Subject: [PATCH] Support R_AARCH64_PREL32 relocation + + * include/grub/elf.h (R_AARCH64_PREL32): Define. + * util/grub-mkimagexx.c (make_reloc_section): Handle it. + (relocate_addresses): Likewise. +--- + include/grub/elf.h | 1 + + util/grub-mkimagexx.c | 10 ++++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/include/grub/elf.h b/include/grub/elf.h +index caa7963..836b304 100644 +--- a/include/grub/elf.h ++++ b/include/grub/elf.h +@@ -2070,6 +2070,7 @@ typedef Elf32_Addr Elf32_Conflict; + #define R_AARCH64_ABS32 258 /* Direct 32 bit. */ + #define R_AARCH64_JUMP26 282 /* 26-bit relative. */ + #define R_AARCH64_CALL26 283 /* 26-bit relative. */ ++#define R_AARCH64_PREL32 261 /* 32-bit pc-relative. */ + #define R_AARCH64_COPY 1024 /* Copy symbol at runtime. */ + #define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */ + #define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */ +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index 0a1ac9e..376dc2d 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -836,6 +836,15 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, + *target = grub_host_to_target64 (grub_target_to_host64 (*target) + sym_addr); + } + break; ++ case R_AARCH64_PREL32: ++ { ++ grub_uint32_t *t32 = (grub_uint32_t *) target; ++ *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32) ++ + sym_addr ++ - target_section_addr - offset ++ - image_target->vaddr_offset); ++ break; ++ } + case R_AARCH64_JUMP26: + case R_AARCH64_CALL26: + { +@@ -1197,6 +1206,7 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out, + } + break; + /* Relative relocations do not require fixup entries. */ ++ case R_AARCH64_PREL32: + case R_AARCH64_CALL26: + case R_AARCH64_JUMP26: + break; +-- +2.0.4 + diff --git a/grub2.changes b/grub2.changes index 4af7371..0e4d91a 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Aug 12 12:56:29 UTC 2014 - schwab@suse.de + +- Enable building on aarch64 +- aarch64-reloc.patch: support R_AARCH64_PREL32 relocation +- Build host tools with RPM_OPT_FLAGS + ------------------------------------------------------------------- Mon Aug 11 14:34:55 UTC 2014 - dvaleev@suse.com diff --git a/grub2.spec b/grub2.spec index 86233fa..ecd9124 100644 --- a/grub2.spec +++ b/grub2.spec @@ -80,16 +80,23 @@ BuildRequires: xen-devel # build efi bootloader on some platforms only: %if ! 0%{?efi} -%global efi %{ix86} x86_64 ia64 +%global efi %{ix86} x86_64 ia64 aarch64 +%endif +%ifarch aarch64 +%define only_efi 1 %endif %ifarch %{efi} %ifarch %{ix86} %define grubefiarch i386-efi %else +%ifarch aarch64 +%define grubefiarch arm64-efi +%else %define grubefiarch %{_target_cpu}-efi %endif %endif +%endif %if 0%{?suse_version} == 1110 %define only_efi %{nil} @@ -140,6 +147,7 @@ Patch36: 0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch Patch37: grub2-use-Unifont-for-starfield-theme-terminal.patch Patch38: grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch Patch39: grub2-use-rpmsort-for-version-sorting.patch +Patch40: aarch64-reloc.patch # Btrfs snapshot booting related patches Patch101: 0002-btrfs-add-ability-to-boot-from-subvolumes.patch Patch102: 0003-cmdline-add-envvar-loader_cmdline_append.patch @@ -196,7 +204,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?only_x86_64:1} ExclusiveArch: x86_64 %else -ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x +ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x aarch64 %endif %description @@ -338,6 +346,7 @@ mv po/grub.pot po/%{name}.pot %patch37 -p1 %patch38 -p1 %patch39 -p1 +%patch40 -p1 %patch101 -p1 %patch102 -p1 %patch103 -p1 @@ -405,6 +414,7 @@ CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once " CXXFLAGS=" " FFLAGS=" " export CFLAGS CXXFLAGS FFLAGS +export HOST_CFLAGS=$RPM_OPT_FLAGS %ifarch x86_64 cd build-xen