summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <van.freenix@gmail.com>2013-06-03 20:26:53 +0800
committerChris Johns <chrisj@rtems.org>2013-06-04 08:36:10 +1000
commit84b81c5eaab4390eebe1ab078d75a39a203b3d11 (patch)
tree816693c57fdca46a1d7fc8d217761ce2097bb83b
parentcb3c818eb2d915894c25cb307b7dfc89f9b555cb (diff)
Fix rela addend
If the bit 31 of info is 0, it means this is a reloc based on section. In rtl-rap.c this line 'symvalue = (Elf_Word) symsect->base + addend' show that if the bit 31 of info is 0, addend will be added to symvalue. Then if the reloc type is rela and the reloc entry is based on section, the addend should be assigned 0, otherwise error will be incured in the reloc resolving function.
-rw-r--r--rtl-rap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/rtl-rap.c b/rtl-rap.c
index efe2362..808caf3 100644
--- a/rtl-rap.c
+++ b/rtl-rap.c
@@ -377,7 +377,10 @@ rtems_rtl_rap_relocate (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj)
rela.r_offset = offset;
rela.r_info = type;
- rela.r_addend = addend;
+
+ if ((info & (1 << 31)) == 0)
+ rela.r_addend = 0;
+ else rela.r_addend = addend;
if (rtems_rtl_trace (RTEMS_RTL_TRACE_RELOC))
printf (" %2d: rela: type:%-2d off:%lu addend:%d" \