* pe-dll.c (process_def_file): Uninitialized data wasn't
authorDJ Delorie <dj@redhat.com>
Thu, 28 Sep 2000 20:53:40 +0000 (20:53 +0000)
committerDJ Delorie <dj@redhat.com>
Thu, 28 Sep 2000 20:53:40 +0000 (20:53 +0000)
exported with --export-all-symbols switch.

* pe-dll.c (fill_edata): rearrange the data so that ordinals and
noname work properly.

ld/ChangeLog
ld/emultempl/pe.em
ld/pe-dll.c

index c4b2a3ae8d998b7a57b8cdff135b5014a160a173..0c72cac90b3dd88076b004b633f5f96897a78be3 100644 (file)
@@ -1,3 +1,13 @@
+2000-09-28  Paul Sokolovsky  <Paul.Sokolovsky@technologist.com>
+
+       * pe-dll.c (process_def_file): Uninitialized data wasn't
+       exported with --export-all-symbols switch.
+       
+2000-09-28  DJ Delorie  <dj@redhat.com>
+
+       * pe-dll.c (fill_edata): rearrange the data so that ordinals and
+       noname work properly.
+
 2000-09-28  Alan Modra  <alan@linuxcare.com.au>
 
        * ld.texinfo (HPPA ELF32): New section.
index 0ffeffc061b4992cd6a2679e55e4194d1afc465c..b556fac90d841772070de37490afd69e08f01476 100644 (file)
@@ -876,6 +876,27 @@ gld_${EMULATION_NAME}_after_open ()
          }
       }
   }
+
+  {
+    LANG_FOR_EACH_INPUT_STATEMENT (is)
+      {
+       asection *sec;
+       char *new_name, seq;
+
+
+       if (is->the_bfd->my_archive)
+         for (sec = is->the_bfd->sections; sec; sec = sec->next)
+           if (strcmp (sec->name, ".idata\$7") == 0
+               && sec->reloc_count == 0)
+             {
+               char *name = xmalloc (sec->_raw_size + 1);
+               bfd_get_section_contents (is->the_bfd, sec, name, 0, sec->_raw_size);
+               name[sec->_raw_size] = 0;
+               printf ("dj: implib \"%s\" for dll \"%s\" %d\n",
+                       is->the_bfd->my_archive->filename, name, sec->_raw_size);
+             }
+      }
+  }
 }
 \f
 static void  
index cbd0c495a44ee2eb93c816fdc881c06c97a64ef4..99ca3125847b73191c39525eeb40a94dabf169f4 100644 (file)
@@ -302,7 +302,10 @@ process_def_file (abfd, info)
 
          for (j = 0; j < nsyms; j++)
            {
-             if (symbols[j]->flags & BSF_GLOBAL)
+              /* We should export symbols which are either global or not
+                 anything at all (.bss data is the latter)  */
+             if ((symbols[j]->flags & BSF_GLOBAL)
+                  || (symbols[j]->flags == BSF_NO_FLAGS))
                {
                  const char *sn = symbols[j]->name;
                  if (*sn == '_')
@@ -703,19 +706,21 @@ fill_edata (abfd, info)
          unsigned long srva = (exported_symbol_offsets[s]
                                + ssec->output_section->vma
                                + ssec->output_offset);
+         int ord = pe_def_file->exports[s].ordinal;
 
-         bfd_put_32 (abfd, srva - image_base, (void *) (eaddresses + i));
+         bfd_put_32 (abfd, srva - image_base,
+                     (void *) (eaddresses + 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++;
              strcpy (enamestr, ename);
              enamestr += strlen (enamestr) + 1;
-             bfd_put_16 (abfd, i, (void *) eordinals);
-             enameptrs++;
+             bfd_put_16 (abfd, ord - min_ordinal, (void *) eordinals);
+             eordinals++;
              pe_def_file->exports[s].hint = hint++;
            }
-         eordinals++;
        }
     }
 }