Mention PR ld/4701.
[deliverable/binutils-gdb.git] / sim / erc32 / func.c
index d2427b795e287b5dc3a75cd3d656545a71ed5e9d..bf898bba6cc93f5eebac6db60138a0cbfc4d8c3c 100644 (file)
@@ -827,49 +827,6 @@ dis_mem(addr, len, info)
     }
 }
 
-int
-buffer_read_memory(addr, buffer, size, info)
-    bfd_vma         addr;
-    bfd_byte       *buffer;
-    int32           size;
-    struct disassemble_info *info;
-{
-    if (size == sis_memory_read(addr, buffer, size))
-       return (0);
-    else
-       return (1);
-}
-
-void
-perror_memory(status, addr, info)
-    int32           status;
-    bfd_vma         addr;
-    struct disassemble_info *info;
-{
-
-    printf("Could not read address 0x%08x\n", (unsigned int) addr);
-}
-
-void
-generic_print_address(addr, info)
-    bfd_vma         addr;
-    struct disassemble_info *info;
-{
-
-    printf("0x%x", (unsigned int) addr);
-}
-
-/* Just return the given address.  */
-
-int
-generic_symbol_at_address (addr, info)
-     bfd_vma addr;
-     struct disassemble_info * info;
-{
-  return 1;
-}
-
-
 /* Add event to event queue */
 
 void
@@ -1045,11 +1002,7 @@ sys_halt()
 
 #include "ansidecl.h"
 
-#ifdef ANSI_PROTOTYPES
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 
 #include "libiberty.h"
 #include "bfd.h"
@@ -1082,7 +1035,8 @@ bfd_load(fname)
     else
        current_target_byte_order = BIG_ENDIAN;
     if (sis_verbose)
-       printf("file %s is little-endian.\n", fname);
+       printf("file %s is %s-endian.\n", fname,
+              current_target_byte_order == BIG_ENDIAN ? "big" : "little");
 
     if (sis_verbose)
        printf("loading %s:", fname);
@@ -1099,12 +1053,34 @@ bfd_load(fname)
             * Adjust sections from a.out files, since they don't carry their
             * addresses with.
             */
-           if (bfd_get_flavour(pbfd) == bfd_target_aout_flavour)
-               section_address += bfd_get_start_address (pbfd);
+           if (bfd_get_flavour(pbfd) == bfd_target_aout_flavour) {
+               if (strcmp (section_name, ".text") == 0)
+                   section_address = bfd_get_start_address (pbfd);
+               else if (strcmp (section_name, ".data") == 0) {
+                   /* Read the first 8 bytes of the data section.
+                      There should be the string 'DaTa' followed by
+                      a word containing the actual section address. */
+                   struct data_marker
+                   {
+                       char signature[4];      /* 'DaTa' */
+                       unsigned char sdata[4]; /* &sdata */
+                   } marker;
+                   bfd_get_section_contents (pbfd, section, &marker, 0,
+                                             sizeof (marker));
+                   if (strncmp (marker.signature, "DaTa", 4) == 0)
+                     {
+                       if (current_target_byte_order == BIG_ENDIAN)
+                         section_address = bfd_getb32 (marker.sdata);
+                       else
+                         section_address = bfd_getl32 (marker.sdata);
+                     }
+               }
+           }
+
            section_size = bfd_section_size(pbfd, section);
 
            if (sis_verbose)
-               printf("\nsection %s at 0x%08lx (%ld bytes)",
+               printf("\nsection %s at 0x%08lx (0x%lx bytes)",
                       section_name, section_address, section_size);
 
            /* Text, data or lit */
This page took 0.024788 seconds and 4 git commands to generate.