* pe-dll.c: Revert changes accidentally committed 2004-03-08.
authorAlan Modra <amodra@gmail.com>
Thu, 29 Apr 2004 13:05:49 +0000 (13:05 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 29 Apr 2004 13:05:49 +0000 (13:05 +0000)
(fill_edata): Correct pointer arithmetic.

ld/ChangeLog
ld/pe-dll.c

index ad50e6be599b02616405dbd672fe5954881c2676..6d535daeca3fa597344592b3c22d1d74df57f3dd 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-29  Alan Modra  <amodra@bigpond.net.au>
+
+       * pe-dll.c: Revert changes accidentally committed 2004-03-08.
+       (fill_edata): Correct pointer arithmetic.
+
 2004-04-21  Chris Demetriou  <cgd@broadcom.com>
 
        * ld.texinfo: Remove MIPS --embedded-relocs documentation.
index 10d636e544c50034731f3ef1bfc3bef1b25fd24b..45d00aedccb9af8b7b70136a8aaae8f30d76bad8 100644 (file)
@@ -26,7 +26,6 @@
 #include "libiberty.h"
 #include "safe-ctype.h"
 
-#include <stdint.h>
 #include <time.h>
 
 #include "ld.h"
@@ -918,9 +917,9 @@ fill_edata (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
 {
   int s, hint;
   unsigned char *edirectory;
-  uint32_t *eaddresses;
-  uint32_t *enameptrs;
-  unsigned short *eordinals;
+  unsigned char *eaddresses;
+  unsigned char *enameptrs;
+  unsigned char *eordinals;
   unsigned char *enamestr;
   time_t now;
 
@@ -930,10 +929,10 @@ fill_edata (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
 
   /* Note use of array pointer math here.  */
   edirectory = edata_d;
-  eaddresses = (uint32_t *) (edata_d + 40);
-  enameptrs = eaddresses + export_table_size;
-  eordinals = (unsigned short *) (enameptrs + count_exported_byname);
-  enamestr = (char *) (eordinals + count_exported_byname);
+  eaddresses = edata_d + 40;
+  enameptrs = eaddresses + 4 * export_table_size;
+  eordinals = enameptrs + 4 * count_exported_byname;
+  enamestr = eordinals + 2 * count_exported_byname;
 
 #define ERVA(ptr) (((unsigned char *)(ptr) - edata_d) \
                   + edata_s->output_section->vma - image_base)
@@ -976,18 +975,18 @@ fill_edata (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
          int ord = pe_def_file->exports[s].ordinal;
 
          bfd_put_32 (abfd, srva - image_base,
-                     (void *) (eaddresses + ord - min_ordinal));
+                     eaddresses + 4 * (ord - min_ordinal));
 
          if (!pe_def_file->exports[s].flag_noname)
            {
              char *ename = pe_def_file->exports[s].name;
 
-             bfd_put_32 (abfd, ERVA (enamestr), (void *) enameptrs);
-             enameptrs++;
+             bfd_put_32 (abfd, ERVA (enamestr), enameptrs);
+             enameptrs += 4;
              strcpy (enamestr, ename);
              enamestr += strlen (enamestr) + 1;
-             bfd_put_16 (abfd, ord - min_ordinal, (void *) eordinals);
-             eordinals++;
+             bfd_put_16 (abfd, ord - min_ordinal, eordinals);
+             eordinals += 2;
              pe_def_file->exports[s].hint = hint++;
            }
        }