This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
From: hjl@nynexst.com (H.J. Lu)
Date: Sat, 29 Oct 94 1:10:26 EDT
Since when does the linker abort on the empty library?
# rm libfoo.a
# ar cvru libfoo.a
# gcc bar.o libfoo.a
libfoo.a: could not read symbols: No symbols
Well, I must admit that this bug has existed for about ten months.
Here is the patch. Ken, this should go into the next release, if
there is one.
Ian
Index: linker.c
===================================================================
RCS file: /rel/cvsfiles/devo/bfd/linker.c,v
retrieving revision 1.40
diff -p -r1.40 linker.c
*** linker.c 1994/10/25 15:47:59 1.40
--- linker.c 1994/10/29 16:17:43
*************** _bfd_generic_link_add_archive_symbols (a
*** 867,872 ****
--- 867,875 ----
if (! bfd_has_map (abfd))
{
+ /* An empty archive is a special case. */
+ if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
+ return true;
bfd_set_error (bfd_error_no_symbols);
return false;
}
Index: ecoff.c
===================================================================
RCS file: /rel/cvsfiles/devo/bfd/ecoff.c,v
retrieving revision 1.74
diff -p -r1.74 ecoff.c
*** ecoff.c 1994/10/24 19:37:18 1.74
--- ecoff.c 1994/10/29 16:17:53
*************** ecoff_link_add_archive_symbols (abfd, in
*** 3860,3865 ****
--- 3860,3868 ----
if (! bfd_has_map (abfd))
{
+ /* An empty archive is a special case. */
+ if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
+ return true;
bfd_set_error (bfd_error_no_symbols);
return false;
}
Index: elfcode.h
===================================================================
RCS file: /rel/cvsfiles/devo/bfd/elfcode.h,v
retrieving revision 1.143
diff -p -r1.143 elfcode.h
*** elfcode.h 1994/10/27 21:25:25 1.143
--- elfcode.h 1994/10/29 16:17:58
*************** elf_link_add_archive_symbols (abfd, info
*** 3738,3743 ****
--- 3738,3746 ----
if (! bfd_has_map (abfd))
{
+ /* An empty archive is a special case. */
+ if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
+ return true;
bfd_set_error (bfd_error_no_symbols);
return false;
}