bfd/
[deliverable/binutils-gdb.git] / ld / pe-dll.c
index 5c4a3ad72b37b29ed63eb4e6f0e97518606abc1c..0d0ecda87db72da523a49660ab4401a40a123f4d 100644 (file)
@@ -398,7 +398,7 @@ auto_export (bfd *abfd, def_file *d, const char *n)
     libname = lbasename (abfd->my_archive->filename);
 
   /* We should not re-export imported stuff.  */
-  if (strncmp (n, "_imp__", 6) == 0)
+  if (strncmp (n, "_imp_", 5) == 0)
     return 0;
 
   for (i = 0; i < d->num_exports; i++)
@@ -515,7 +515,7 @@ process_def_file (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
       s = bfd_get_section_by_name (b, ".drectve");
       if (s)
        {
-         int size = bfd_get_section_size_before_reloc (s);
+         long size = s->size;
          char *buf = xmalloc (size);
 
          bfd_get_section_contents (b, s, buf, 0, size);
@@ -917,9 +917,9 @@ fill_edata (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
 {
   int s, hint;
   unsigned char *edirectory;
-  unsigned long *eaddresses;
-  unsigned long *enameptrs;
-  unsigned short *eordinals;
+  unsigned char *eaddresses;
+  unsigned char *enameptrs;
+  unsigned char *eordinals;
   unsigned char *enamestr;
   time_t now;
 
@@ -929,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 = (unsigned long *) (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)
@@ -975,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++;
            }
        }
@@ -1252,7 +1252,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
   if (page_ptr != (unsigned long) -1)
     bfd_put_32 (abfd, reloc_sz - page_ptr, reloc_d + page_ptr + 4);
 
-  while (reloc_sz < reloc_s->_raw_size)
+  while (reloc_sz < reloc_s->size)
     reloc_d[reloc_sz++] = 0;
 }
 
@@ -2257,6 +2257,9 @@ pe_dll_generate_implib (def_file *def, const char *impfilename)
       char *internal = def->exports[i].internal_name;
       bfd *n;
 
+      /* Don't add PRIVATE entries to import lib.  */  
+      if (pe_def_file->exports[i].flag_private)
+       continue;
       def->exports[i].internal_name = def->exports[i].name;
       n = make_one (def->exports + i, outarch);
       n->next = head;
This page took 0.024291 seconds and 4 git commands to generate.