[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] riscv: fix computation of pc-relative relocation offset
From: |
Andreas Schwab |
Subject: |
[PATCH] riscv: fix computation of pc-relative relocation offset |
Date: |
Wed, 26 Jun 2019 16:50:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) |
The offset calculation was missing the relocation addend.
Signed-off-by: Andreas Schwab <address@hidden>
---
util/grub-mkimagexx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
index bc087c2b5..d16ec63a1 100644
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -1232,8 +1232,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct
section_metadata *smd,
grub_uint32_t *t32 = (grub_uint32_t *) target;
grub_uint16_t *t16 = (grub_uint16_t *) target;
grub_uint8_t *t8 = (grub_uint8_t *) target;
- grub_int64_t off = (long)sym_addr - target_section_addr -
offset
- - image_target->vaddr_offset;
+ grub_int64_t off;
/*
* Instructions and instruction encoding are documented in the
RISC-V
@@ -1243,6 +1242,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct
section_metadata *smd,
*/
sym_addr += addend;
+ off = sym_addr - target_section_addr - offset -
image_target->vaddr_offset;
switch (ELF_R_TYPE (info))
{
--
2.22.0
--
Andreas Schwab, SUSE Labs, address@hidden
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] riscv: fix computation of pc-relative relocation offset,
Andreas Schwab <=