OSDN Git Service

Fixed handling of MICROBLAZE_32 reloc type. The mb-gcc distributes
authorDavid McCullough <davidm@snapgear.com>
Tue, 29 Jul 2003 10:47:48 +0000 (10:47 +0000)
committerDavid McCullough <davidm@snapgear.com>
Tue, 29 Jul 2003 10:47:48 +0000 (10:47 +0000)
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 <jwilliams@itee.uq.edu.au>

elf2flt.c

index 4453392..048e424 100644 (file)
--- 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;