head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.48 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.46 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.44 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.42 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.40 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.2.0.38 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.36 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.34 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.2.0.32 pkgsrc-2008Q2-base:1.2 pkgsrc-2008Q1:1.2.0.30 pkgsrc-2008Q1-base:1.2 pkgsrc-2007Q4:1.2.0.28 pkgsrc-2007Q4-base:1.2 pkgsrc-2007Q3:1.2.0.26 pkgsrc-2007Q3-base:1.2 pkgsrc-2007Q2:1.2.0.24 pkgsrc-2007Q2-base:1.2 pkgsrc-2007Q1:1.2.0.22 pkgsrc-2007Q1-base:1.2 pkgsrc-2006Q4:1.2.0.20 pkgsrc-2006Q4-base:1.2 pkgsrc-2006Q3:1.2.0.18 pkgsrc-2006Q3-base:1.2 pkgsrc-2006Q2:1.2.0.16 pkgsrc-2006Q2-base:1.2 pkgsrc-2006Q1:1.2.0.14 pkgsrc-2006Q1-base:1.2 pkgsrc-2005Q4:1.2.0.12 pkgsrc-2005Q4-base:1.2 pkgsrc-2005Q3:1.2.0.10 pkgsrc-2005Q3-base:1.2 pkgsrc-2005Q2:1.2.0.8 pkgsrc-2005Q2-base:1.2 pkgsrc-2005Q1:1.2.0.6 pkgsrc-2005Q1-base:1.2 pkgsrc-2004Q4:1.2.0.4 pkgsrc-2004Q4-base:1.2 pkgsrc-2004Q3:1.2.0.2 pkgsrc-2004Q3-base:1.2 pkgsrc-2004Q2:1.1.0.14 pkgsrc-2004Q2-base:1.1 pkgsrc-2004Q1:1.1.0.12 pkgsrc-2004Q1-base:1.1 pkgsrc-2003Q4:1.1.0.10 pkgsrc-2003Q4-base:1.1 netbsd-1-6-1:1.1.0.6 netbsd-1-6-1-base:1.1 netbsd-1-6:1.1.0.8 netbsd-1-6-RELEASE-base:1.1 pkgviews:1.1.0.4 pkgviews-base:1.1 buildlink2:1.1.0.2 buildlink2-base:1.1 netbsd-1-5-PATCH003:1.1 netbsd-1-5-PATCH001:1.1 netbsd-1-5-RELEASE:1.1 netbsd-1-4-PATCH003:1.1 netbsd-1-4-PATCH002:1.1 comdex-fall-1999:1.1 netbsd-1-4-PATCH001:1.1 netbsd-1-4-RELEASE:1.1; locks; strict; comment @# @; 1.2 date 2004.07.09.20.43.48; author kristerw; state dead; branches; next 1.1; 1.1 date 99.01.04.22.37.32; author tv; state Exp; branches; next ; desc @@ 1.2 log @Update to binutils-2.15. Changes since binutils-2.9 are not easy to summarize, since it represent more than 6 years of active development... Solves PR pkg/13442. @ text @$NetBSD: patch-archive,v 1.1 1999/01/04 22:37:32 tv Exp $ --- ./bfd/archive.c.orig Fri May 1 11:48:01 1998 +++ ./bfd/archive.c Mon Dec 28 17:43:17 1998 @@@@ -595,7 +595,9 @@@@ Note that last_file->origin can be odd in the case of BSD-4.4-style element with a long odd size. */ filestart = last_file->origin + size; - filestart += filestart % 2; + if (!strncmp(arch_hdr (last_file)->ar_name, "#1/", 3)) + size += strlen(normalize(last_file, last_file->filename)); + filestart += size % 2; } return _bfd_get_elt_at_filepos (archive, filestart); @@@@ -1202,6 +1204,44 @@@@ return _bfd_construct_extended_name_table (abfd, false, tabloc, tablen); } +/* 4.4BSD: frob short names, but leave extended name until write time. */ + +boolean +_bfd_archive_bsd44_construct_extended_name_table (abfd, tabloc, tablen, name) + bfd *abfd; + char **tabloc; + bfd_size_type *tablen; + const char **name; +{ + unsigned int maxname = abfd->xvec->ar_max_namelen; + bfd *current; + + for (current = abfd->archive_head; current != NULL; current = current->next) + { + const char *normal; + unsigned int thislen; + + normal = normalize (current, current->filename); + if (normal == NULL) + return false; + + thislen = strlen (normal); + if (((thislen > maxname) || (strchr(normal, ' ') != NULL)) + && ((bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) == 0)) + { + struct ar_hdr *hdr = arch_hdr (current); + sprintf ((hdr->ar_name), "#1/%-12ld", (long) thislen); + hdr->ar_name[15] = ' '; + sprintf ((hdr->ar_size), "%-9ld", (long) arelt_size(current) + thislen); + hdr->ar_size[9] = ' '; + } + } + + *name = *tabloc = NULL; + *tablen = 0; + return true; +} + /* Build an SVR4 style extended name table. */ boolean @@@@ -1371,8 +1411,12 @@@@ /* Goddamned sprintf doesn't permit MAXIMUM field lengths */ sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime); - sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid); - sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid); + if (status.st_uid > 65535U) + fprintf (stderr, "%s: uid %ld truncated to 16 bits\n", filename, status.st_uid); + sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid & 0xffffU); + if (status.st_gid > 65535U) + fprintf (stderr, "%s: gid %ld truncated to 16 bits\n", filename, status.st_gid); + sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid & 0xffffU); sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode); sprintf ((hdr->ar_size), "%-10ld", (long) status.st_size); /* Correct for a lossage in sprintf whereby it null-terminates. I cannot @@@@ -1654,12 +1698,22 @@@@ for (current = arch->archive_head; current; current = current->next) { char buffer[DEFAULT_BUFFERSIZE]; - unsigned int remaining = arelt_size (current); + unsigned int saved_size = arelt_size (current); + unsigned int remaining = saved_size; struct ar_hdr *hdr = arch_hdr (current); /* write ar header */ if (bfd_write ((char *) hdr, 1, sizeof (*hdr), arch) != sizeof (*hdr)) return false; + /* write filename if it is a 4.4BSD extended file, and add to size */ + if (!strncmp (hdr->ar_name, "#1/", 3)) + { + const char *normal = normalize (current, current->filename); + unsigned int thislen = strlen (normal); + if (bfd_write (normal, 1, thislen, arch) != thislen) + return false; + saved_size += thislen; + } if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0) return false; while (remaining) @@@@ -1678,7 +1732,7 @@@@ return false; remaining -= amt; } - if ((arelt_size (current) % 2) == 1) + if ((saved_size % 2) == 1) { if (bfd_write ("\012", 1, 1, arch) != 1) return false; @@@@ -1914,8 +1968,11 @@@@ { do { - firstreal += arelt_size (current) + sizeof (struct ar_hdr); - firstreal += firstreal % 2; + unsigned int size = arelt_size (current); + if (!strncmp(arch_hdr (current)->ar_name, "#1/", 3)) + size += strlen(normalize(current, current->filename)); + firstreal += size + sizeof (struct ar_hdr); + firstreal += size % 2; current = current->next; } while (current != (bfd *) (map[count]).pos); --- ./bfd/libbfd-in.h.orig Fri May 1 11:48:12 1998 +++ ./bfd/libbfd-in.h Mon Dec 28 17:43:21 1998 @@@@ -219,6 +219,8 @@@@ _bfd_slurp_extended_name_table extern boolean _bfd_archive_bsd_construct_extended_name_table PARAMS ((bfd *, char **, bfd_size_type *, const char **)); +extern boolean _bfd_archive_bsd44_construct_extended_name_table + PARAMS ((bfd *, char **, bfd_size_type *, const char **)); #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname #define _bfd_archive_bsd_write_armap bsd_write_armap #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr --- ./bfd/libbfd.h.orig Fri May 1 11:48:12 1998 +++ ./bfd/libbfd.h Mon Dec 28 17:43:21 1998 @@@@ -219,6 +219,8 @@@@ _bfd_slurp_extended_name_table extern boolean _bfd_archive_bsd_construct_extended_name_table PARAMS ((bfd *, char **, bfd_size_type *, const char **)); +extern boolean _bfd_archive_bsd44_construct_extended_name_table + PARAMS ((bfd *, char **, bfd_size_type *, const char **)); #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname #define _bfd_archive_bsd_write_armap bsd_write_armap #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr --- bfd/netbsd.h.orig Mon Jan 4 09:58:12 1999 +++ bfd/netbsd.h Mon Jan 4 09:58:37 1999 @@@@ -66,6 +66,8 @@@@ #define MY_write_object_contents MY(write_object_contents) static boolean MY(write_object_contents) PARAMS ((bfd *abfd)); #define MY_text_includes_header 1 +#define MY_construct_extended_name_table \ + _bfd_archive_bsd44_construct_extended_name_table #include "aout-target.h" @ 1.1 log @Major `cross' category overhaul. Clean up the shared Makefiles; move all binutils stuff (except gas) to a shared, multiple-target binutils build; reduce extract and compile times by being more specific with files and targets; update to egcs 1.1.1 with a diffball from NetBSD's src/gnu/dist tree; add 4.4BSD a.out archive support to binutils. @ text @d1 1 a1 1 $NetBSD$ @