Completely backport _bfd_ar_spacepad() changes from
X-Git-Url: http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=390c0e4288ca46982c7702ec420d277c021032f4 * bfd/libbfd-in.h (_bfd_ar_spacepad): New prototype. * bfd/libbfd.h (_bfd_ar_spacepad): Likewise. * bfd/archive.c (_bfd_ar_spacepad): Use K&R style as rest of file. * bfd/archive64.c (bfd_elf64_archive_write_armap): Use _bfd_ar_spacepad.
This commit is contained in:
parent
681f013ef9
commit
449a4bb122
|
@ -121,7 +121,7 @@ DESCRIPTION
|
|||
|
||||
Regular files with long names (or embedded spaces, for BSD variants):
|
||||
"/18 " - SVR4 style, name at offset 18 in name table.
|
||||
"#1/23 " - Long name (or embedded paces) 23 characters long,
|
||||
"#1/23 " - Long name (or embedded spaces) 23 characters long,
|
||||
BSD 4.4 style, full name follows header.
|
||||
Implemented for reading, not writing.
|
||||
" 18 " - Long name 18 characters long, extended pseudo-BSD.
|
||||
|
@ -174,7 +174,11 @@ static struct areltdata *bfd_ar_hdr_from_filesystem
|
|||
PARAMS ((bfd *abfd, const char *, bfd *member));
|
||||
|
||||
void
|
||||
_bfd_ar_spacepad (char *p, size_t n, const char *fmt, long val)
|
||||
_bfd_ar_spacepad (p, n, fmt, val)
|
||||
char *p;
|
||||
size_t n;
|
||||
const char *fmt;
|
||||
long val;
|
||||
{
|
||||
static char buf[20];
|
||||
size_t len;
|
||||
|
|
|
@ -158,7 +158,6 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
|
|||
bfd *current = arch->archive_head;
|
||||
unsigned int count;
|
||||
struct ar_hdr hdr;
|
||||
unsigned int i;
|
||||
int padding;
|
||||
bfd_byte buf[8];
|
||||
|
||||
|
@ -171,19 +170,17 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
|
|||
+ sizeof (struct ar_hdr)
|
||||
+ SARMAG);
|
||||
|
||||
memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
|
||||
strcpy (hdr.ar_name, "/SYM64/");
|
||||
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
|
||||
sprintf (hdr.ar_date, "%ld", (long) time (NULL));
|
||||
memset (&hdr, ' ', sizeof (struct ar_hdr));
|
||||
memcpy (hdr.ar_name, "/SYM64/", strlen ("/SYM64/"));
|
||||
_bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
|
||||
mapsize);
|
||||
_bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
|
||||
time (NULL));
|
||||
/* This, at least, is what Intel coff sets the values to.: */
|
||||
sprintf ((hdr.ar_uid), "%d", 0);
|
||||
sprintf ((hdr.ar_gid), "%d", 0);
|
||||
sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
|
||||
strncpy (hdr.ar_fmag, ARFMAG, 2);
|
||||
|
||||
for (i = 0; i < sizeof (struct ar_hdr); i++)
|
||||
if (((char *) (&hdr))[i] == '\0')
|
||||
(((char *) (&hdr))[i]) = ' ';
|
||||
_bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", 0);
|
||||
_bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", 0);
|
||||
_bfd_ar_spacepad (hdr.ar_mode, sizeof (hdr.ar_mode), "%-7lo", 0);
|
||||
memcpy (hdr.ar_fmag, ARFMAG, 2);
|
||||
|
||||
/* Write the ar header for this item and the number of symbols */
|
||||
|
||||
|
|
|
@ -173,6 +173,8 @@ bfd_boolean coff_write_armap
|
|||
|
||||
extern PTR _bfd_generic_read_ar_hdr
|
||||
PARAMS ((bfd *));
|
||||
extern void _bfd_ar_spacepad
|
||||
PARAMS ((char *, size_t, const char *, long));
|
||||
|
||||
extern PTR _bfd_generic_read_ar_hdr_mag
|
||||
PARAMS ((bfd *, const char *));
|
||||
|
|
|
@ -178,6 +178,8 @@ bfd_boolean coff_write_armap
|
|||
|
||||
extern PTR _bfd_generic_read_ar_hdr
|
||||
PARAMS ((bfd *));
|
||||
extern void _bfd_ar_spacepad
|
||||
PARAMS ((char *, size_t, const char *, long));
|
||||
|
||||
extern PTR _bfd_generic_read_ar_hdr_mag
|
||||
PARAMS ((bfd *, const char *));
|
||||
|
|
Loading…
Reference in New Issue