* ldlang.c (wild_sort): When sorting by file name, sort by archive
authorIan Lance Taylor <ian@airs.com>
Fri, 3 Jul 1998 21:52:43 +0000 (21:52 +0000)
committerIan Lance Taylor <ian@airs.com>
Fri, 3 Jul 1998 21:52:43 +0000 (21:52 +0000)
name first.

ld/ChangeLog
ld/ldlang.c

index 7d85d5089252ed1e3920ee1f2bdd0ac3934e7ade..66eaa2fe169ab76388fa6db4b4bc84230b8a7ff4 100644 (file)
@@ -1,5 +1,21 @@
 Fri Jul  3 14:19:06 1998  Ian Lance Taylor  <ian@cygnus.com>
 
+       * scripttempl/pe.sc: Use SORT to sort sections appropriately.
+       * emultempl/pe.em (sort_by_file_name): Remove.
+       (sort_by_section_name): Remove.
+       (sort_sections_1, sort_sections): Remove.
+       (gld_${EMULATION_NAME}_before_allocation): Don't call
+       sort_sections.
+       (hold_section, hold_section_name): New static variables.
+       (hold_use, hold_text, hold_rdata, hold_data, hold_bss): Likewise.
+       (gld_${EMULATION_NAME}_place_orphan): Rewrite.  Look for a good
+       place to put the section.  Align the section.  Sort the input
+       sections by name.
+       (gld_${EMULATION_NAME}_place_section): New static function.
+
+       * ldlang.c (wild_sort): When sorting by file name, sort by archive
+       name first.
+
        * emultempl/pe.em (set_pe_subsystem): Don't call
        ldlang_add_undef.
        (gld_${EMULATION_NAME}_after_parse): New static function.
index 56b42948a1eaf5933d5f28932fa25226dc6c34e2..41946145554dbb58c9ff873774ef2b9ab14ccaf5 100644 (file)
@@ -993,13 +993,58 @@ wild_sort (wild, file, section)
 
       if (wild->filenames_sorted)
        {
+         const char *fn, *ln;
+         boolean fa, la;
          int i;
 
-         i = strcmp (file->filename, ls->ifile->filename);
+         /* The PE support for the .idata section as generated by
+             dlltool assumes that files will be sorted by the name of
+             the archive and then the name of the file within the
+             archive.  */
+
+         if (file->the_bfd != NULL
+             && bfd_my_archive (file->the_bfd) != NULL)
+           {
+             fn = bfd_get_filename (bfd_my_archive (file->the_bfd));
+             fa = true;
+           }
+         else
+           {
+             fn = file->filename;
+             fa = false;
+           }
+
+         if (ls->ifile->the_bfd != NULL
+             && bfd_my_archive (ls->ifile->the_bfd) != NULL)
+           {
+             ln = bfd_get_filename (bfd_my_archive (ls->ifile->the_bfd));
+             la = true;
+           }
+         else
+           {
+             ln = ls->ifile->filename;
+             la = false;
+           }
+
+         i = strcmp (fn, ln);
          if (i > 0)
            continue;
          else if (i < 0)
            break;
+
+         if (fa || la)
+           {
+             if (fa)
+               fn = file->filename;
+             if (la)
+               ln = ls->ifile->filename;
+
+             i = strcmp (fn, ln);
+             if (i > 0)
+               continue;
+             else if (i < 0)
+               break;
+           }
        }
 
       /* Here either the files are not sorted by name, or we are
This page took 0.032258 seconds and 4 git commands to generate.