From 84b81c5eaab4390eebe1ab078d75a39a203b3d11 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Mon, 3 Jun 2013 20:26:53 +0800 Subject: 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. --- rtl-rap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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" \ -- cgit v1.2.3