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
lang_list_init (&list);
wild_doit (&list, s, output, file);
- ASSERT (list.head != NULL && list.head->next == NULL);
- for (pp = &ptr->children.head;
- *pp != before;
- pp = &(*pp)->next)
- ASSERT (*pp != NULL);
+ /* If we are discarding the section, LIST.HEAD will
+ be NULL. */
+ if (list.head != NULL)
+ {
+ ASSERT (list.head->next == NULL);
- list.head->next = *pp;
- *pp = list.head;
+ for (pp = &ptr->children.head;
+ *pp != before;
+ pp = &(*pp)->next)
+ ASSERT (*pp != NULL);
+
+ list.head->next = *pp;
+ *pp = list.head;
+ }
}
}
}
if (overlay_max == NULL)
overlay_max = size;
else
- overlay_max = exp_binop (MAX, overlay_max, size);
+ overlay_max = exp_binop (MAX_K, overlay_max, size);
}
/* Finish a section in an overlay. There isn't any special to do