]> git.wh0rd.org Git - elf2flt.git/commitdiff
Use headers direct from binutils
authorDavid McCullough <davidm@snapgear.com>
Tue, 23 Mar 2004 04:00:15 +0000 (04:00 +0000)
committerDavid McCullough <davidm@snapgear.com>
Tue, 23 Mar 2004 04:00:15 +0000 (04:00 +0000)
Patch also includes a horrible kludge to get around some wierdness in the
elf files produced by mb-ld.

John Williams <jwilliams@itee.uq.edu.au>

elf2flt.c

index 4161d1022b02d40ca7045800bdfd2ffbdefbaae0..bca57bc81a6f11817f8b6d8f661d0fe360d5a2cf 100644 (file)
--- a/elf2flt.c
+++ b/elf2flt.c
@@ -48,6 +48,8 @@
 
 #if defined(TARGET_h8300)
 #include <elf/h8.h>      /* TARGET_* ELF support for the BFD library            */
+#elif defined(TARGET_microblaze)
+#include <elf/microblaze.h>    /* 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;
                                }