From: David McCullough Date: Tue, 29 Jul 2003 10:47:48 +0000 (+0000) Subject: Fixed handling of MICROBLAZE_32 reloc type. The mb-gcc distributes X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=43be9f53f352c723a283c3a147dddded85456a13;p=elf2flt.git Fixed handling of MICROBLAZE_32 reloc type. The mb-gcc distributes relocations across several places - the "standard" ones such as q->addend and bfd_section_vma(), but also embeds small offsets in the actual text (code) itself. Thus, it is necessary to examine the text to get an initial offset, then add that to the others to get the final fixup location. This is required for at least MICROBLAZE_64 and MICROBLAZE_32 - others may also need it. Patch from John Williams --- diff --git a/elf2flt.c b/elf2flt.c index 4453392..048e424 100644 --- a/elf2flt.c +++ b/elf2flt.c @@ -784,12 +784,19 @@ dump_symbols(symbols, number_of_symbols); continue; } case R_MICROBLAZE_32: - relocation_needed = 1; + { + unsigned char *p = r_mem; + unsigned long offset; + + /* grab any offset from the text */ + offset = (p[0]<<24) + (p[1] << 16) + (p[2] << 8) + (p[3]); //sym_addr = (*(q->sym_ptr_ptr))->value; sym_vma = bfd_section_vma(abs_bfd, sym_section); - sym_addr += sym_vma + q->addend; - break; + sym_addr += offset + sym_vma + q->addend; + relocation_needed = 1; + break; + } case R_MICROBLAZE_64_PCREL: sym_vma = 0; //sym_addr = (*(q->sym_ptr_ptr))->value;