1 Star 0 Fork 71

dingwei / grub2

forked from src-openEuler / grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0176-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
hanzj0122_admin 提交于 2020-07-29 20:47 . update to 2.04
From bad3d7b8f5b050898b20f0ca10894e6d1c5bb161 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 26 Jun 2019 16:50:03 +0200
Subject: [PATCH 176/220] RISC-V: Fix computation of pc-relative relocation
offset
The offset calculation was missing the relocation addend.
Signed-off-by: Andreas Schwab <schwab@suse.de>
Tested-by: Chester Lin <clin@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
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 bc087c2..d16ec63 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))
{
--
1.8.3.1
1
https://gitee.com/dingwei_chinamobile/grub2.git
git@gitee.com:dingwei_chinamobile/grub2.git
dingwei_chinamobile
grub2
grub2
master

搜索帮助