Various noise
This commit is contained in:
parent
a7fe4c5997
commit
0452b5aacf
107
bfd/archive.c
107
bfd/archive.c
|
@ -28,7 +28,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/* $Id$
|
/* $Id$
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.1 1991/03/21 21:10:42 gumby
|
* Revision 1.2 1991/04/03 22:09:43 steve
|
||||||
|
* Various noise
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1991/03/21 21:10:42 gumby
|
||||||
|
* Back from Intel with Steve
|
||||||
|
*
|
||||||
|
* Revision 1.1 1991/03/21 21:10:42 gumby
|
||||||
* Initial revision
|
* Initial revision
|
||||||
*
|
*
|
||||||
* Revision 1.3 1991/03/16 05:55:25 rich
|
* Revision 1.3 1991/03/16 05:55:25 rich
|
||||||
|
@ -259,7 +265,7 @@ snarf_ar_hdr (abfd)
|
||||||
|
|
||||||
namelen = 0;
|
namelen = 0;
|
||||||
|
|
||||||
while (namelen < ar_maxnamelen(abfd) &&
|
while (namelen < (unsigned)ar_maxnamelen(abfd) &&
|
||||||
( hdr.ar_name[namelen] != 0 &&
|
( hdr.ar_name[namelen] != 0 &&
|
||||||
hdr.ar_name[namelen] != ' ' &&
|
hdr.ar_name[namelen] != ' ' &&
|
||||||
hdr.ar_name[namelen] != ar_padchar(abfd))) {
|
hdr.ar_name[namelen] != ar_padchar(abfd))) {
|
||||||
|
@ -903,7 +909,7 @@ _bfd_write_archive_contents (arch)
|
||||||
|
|
||||||
BFD_SEND (arch, _bfd_truncate_arname,(arch,
|
BFD_SEND (arch, _bfd_truncate_arname,(arch,
|
||||||
current->filename,
|
current->filename,
|
||||||
arch_hdr(current)));
|
(char *) arch_hdr(current)));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -959,14 +965,16 @@ _bfd_write_archive_contents (arch)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (bfd_seek (current, 0L, SEEK_SET) != 0L) goto syserr;
|
if (bfd_seek (current, 0L, SEEK_SET) != 0L) goto syserr;
|
||||||
while (remaining) {
|
while (remaining)
|
||||||
unsigned int amt = ((remaining <= DEFAULT_BUFFERSIZE) ? remaining :
|
{
|
||||||
DEFAULT_BUFFERSIZE);
|
unsigned int amt = DEFAULT_BUFFERSIZE;
|
||||||
|
if (amt > remaining) {
|
||||||
if (bfd_read (buffer, amt, 1, current) != amt) goto syserr;
|
amt = remaining;
|
||||||
if (bfd_write (buffer, amt, 1, arch) != amt) goto syserr;
|
}
|
||||||
remaining -= amt;
|
if (bfd_read (buffer, amt, 1, current) != amt) goto syserr;
|
||||||
}
|
if (bfd_write (buffer, amt, 1, arch) != amt) goto syserr;
|
||||||
|
remaining -= amt;
|
||||||
|
}
|
||||||
if ((arelt_size (current) % 2) == 1) bfd_write ("\n", 1, 1, arch);
|
if ((arelt_size (current) % 2) == 1) bfd_write ("\n", 1, 1, arch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1003,52 +1011,49 @@ compute_and_write_armap (arch, elength)
|
||||||
current != (bfd *)NULL;
|
current != (bfd *)NULL;
|
||||||
current = current->next, elt_no++)
|
current = current->next, elt_no++)
|
||||||
{
|
{
|
||||||
if ((bfd_check_format (current, bfd_object) == true)
|
if ((bfd_check_format (current, bfd_object) == true)
|
||||||
&& ((bfd_get_file_flags (current) & HAS_SYMS))) {
|
&& ((bfd_get_file_flags (current) & HAS_SYMS))) {
|
||||||
asymbol **syms;
|
asymbol **syms;
|
||||||
unsigned int storage;
|
unsigned int storage;
|
||||||
unsigned int symcount;
|
unsigned int symcount;
|
||||||
unsigned int src_count;
|
unsigned int src_count;
|
||||||
|
|
||||||
storage = get_symtab_upper_bound (current);
|
storage = get_symtab_upper_bound (current);
|
||||||
if (storage == 0) {
|
if (storage != 0) {
|
||||||
nosymz:
|
|
||||||
fprintf (stderr, "%s: Symflags set but there are none?\n",
|
|
||||||
bfd_get_filename (current));
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
syms = (asymbol **) zalloc (storage);
|
|
||||||
if (syms == NULL) {
|
|
||||||
bfd_error = no_memory; /* FIXME -- memory leak */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
symcount = bfd_canonicalize_symtab (current, syms);
|
|
||||||
if (symcount == 0) goto nosymz;
|
|
||||||
|
|
||||||
/* Now map over all the symbols, picking out the ones we want */
|
syms = (asymbol **) zalloc (storage);
|
||||||
for (src_count = 0; src_count <symcount; src_count++) {
|
if (syms == NULL) {
|
||||||
flagword flags = (syms[src_count])->flags;
|
bfd_error = no_memory; /* FIXME -- memory leak */
|
||||||
if ((flags & BSF_GLOBAL) ||
|
return false;
|
||||||
(flags & BSF_FORT_COMM)) {
|
}
|
||||||
|
symcount = bfd_canonicalize_symtab (current, syms);
|
||||||
|
|
||||||
/* This symbol will go into the archive header */
|
|
||||||
if (orl_count == orl_max)
|
/* Now map over all the symbols, picking out the ones we want */
|
||||||
{
|
for (src_count = 0; src_count <symcount; src_count++) {
|
||||||
orl_max *= 2;
|
flagword flags = (syms[src_count])->flags;
|
||||||
map = (struct orl *) realloc ((char *) map,
|
if ((flags & BSF_GLOBAL) ||
|
||||||
orl_max * sizeof (struct orl));
|
(flags & BSF_FORT_COMM)) {
|
||||||
|
|
||||||
|
/* This symbol will go into the archive header */
|
||||||
|
if (orl_count == orl_max)
|
||||||
|
{
|
||||||
|
orl_max *= 2;
|
||||||
|
map = (struct orl *) realloc ((char *) map,
|
||||||
|
orl_max * sizeof (struct orl));
|
||||||
|
}
|
||||||
|
|
||||||
|
(map[orl_count]).name = &((syms[src_count])->name);
|
||||||
|
(map[orl_count]).pos = elt_no;
|
||||||
|
(map[orl_count]).namidx = stridx;
|
||||||
|
|
||||||
|
stridx += strlen ((syms[src_count])->name) + 1;
|
||||||
|
++orl_count;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(map[orl_count]).name = &((syms[src_count])->name);
|
|
||||||
(map[orl_count]).pos = elt_no;
|
|
||||||
(map[orl_count]).namidx = stridx;
|
|
||||||
|
|
||||||
stridx += strlen ((syms[src_count])->name) + 1;
|
|
||||||
++orl_count;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
/* OK, now we have collected all the data, let's write them out */
|
/* OK, now we have collected all the data, let's write them out */
|
||||||
if (!BFD_SEND (arch, write_armap,
|
if (!BFD_SEND (arch, write_armap,
|
||||||
(arch, elength, map, orl_count, stridx))) {
|
(arch, elength, map, orl_count, stridx))) {
|
||||||
|
|
Loading…
Reference in New Issue