[PATCH 1/4] Fix rela addend

Peng Fan van.freenix at gmail.com
Wed May 29 04:49:48 UTC 2013


 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.
---
 rtl-rap.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/rtl-rap.c b/rtl-rap.c
index efe2362..e0c5527 100644
--- a/rtl-rap.c
+++ b/rtl-rap.c
@@ -377,7 +377,11 @@ 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" \
-- 
1.7.10.4




More information about the devel mailing list