From 43be9f53f352c723a283c3a147dddded85456a13 Mon Sep 17 00:00:00 2001 From: David McCullough Date: Tue, 29 Jul 2003 10:47:48 +0000 Subject: [PATCH] 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 --- elf2flt.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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; -- 2.39.5