From 44c11b98a1077cadf159d5137ac4b68a48707e9d Mon Sep 17 00:00:00 2001 From: David McCullough Date: Tue, 23 Mar 2004 04:00:15 +0000 Subject: [PATCH] Use headers direct from binutils Patch also includes a horrible kludge to get around some wierdness in the elf files produced by mb-ld. John Williams --- elf2flt.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/elf2flt.c b/elf2flt.c index 4161d10..bca57bc 100644 --- a/elf2flt.c +++ b/elf2flt.c @@ -48,6 +48,8 @@ #if defined(TARGET_h8300) #include /* TARGET_* ELF support for the BFD library */ +#elif defined(TARGET_microblaze) +#include /* TARGET_* ELF support for the BFD library */ #elif defined(__CYGWIN__) #include "cygwin-elf.h" /* Cygwin uses a local copy */ #else @@ -800,10 +802,19 @@ dump_symbols(symbols, number_of_symbols); /* 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 += offset + sym_vma + q->addend; + /* This is a horrible kludge. For some + reason, *sometimes* the offset is in + both addend and the code. Detect + it, and cancel the effect. Otherwise + the offset gets added twice - ouch. + There should be a better test + for this condition, based on the + BFD data structures */ + if(offset==q->addend) + offset=0; + sym_addr += offset + sym_vma + q->addend; relocation_needed = 1; break; } -- 2.39.5