SHA256
1
0
forked from pool/grub2
grub2/aarch64-reloc.patch
Michael Chang 20cf2b8803 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
2014-08-13 02:36:26 +00:00

57 lines
2.0 KiB
Diff

From f472bc5ac54e72eb09b0606f588085af504d754b Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
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