diff options
author | Ian Lance Taylor <ian@airs.com> | 1998-07-03 21:52:43 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1998-07-03 21:52:43 +0000 |
commit | 6ccce8e82b4b18e5008f94808ddaf554bdd6c040 (patch) | |
tree | 9be4e4b344b9f8f18e2b24ed1b39dad8d73fac10 /ld/ldlang.c | |
parent | 4d315b86605a2b13ecf4dbd6287406bde3deb3b0 (diff) | |
download | gdb-6ccce8e82b4b18e5008f94808ddaf554bdd6c040.zip gdb-6ccce8e82b4b18e5008f94808ddaf554bdd6c040.tar.gz gdb-6ccce8e82b4b18e5008f94808ddaf554bdd6c040.tar.bz2 |
* ldlang.c (wild_sort): When sorting by file name, sort by archive
name first.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index 56b4294..4194614 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -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 |