From: Ian Lance Taylor Date: Tue, 4 Jul 1995 20:22:43 +0000 (+0000) Subject: * archive.c (_bfd_construct_extended_name_table): If X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=27b1ec94784b837c366ebd3a2cfa754f07620368;p=binutils-gdb.git * archive.c (_bfd_construct_extended_name_table): If BFD_TRADITIONAL_FORMAT is set, limit the length of all file names to ar_max_namelen. (bfd_dont_truncate_arname): If BFD_TRADITIONAL_FORMAT is set, call bfd_bsd_truncate_arname. PR 6888. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5f98d966ac4..62273d2b6eb 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,6 +1,11 @@ Tue Jul 4 12:22:21 1995 Ian Lance Taylor - * archive.c (_bfd_write_archive_contents): Revert June 1 change. + * archive.c (_bfd_construct_extended_name_table): If + BFD_TRADITIONAL_FORMAT is set, limit the length of all file names + to ar_max_namelen. + (bfd_dont_truncate_arname): If BFD_TRADITIONAL_FORMAT is set, call + bfd_bsd_truncate_arname. + (_bfd_write_archive_contents): Revert June 1 change. * elfcode.h (NAME(bfd_elf,record_link_assignment)): Add provide argument. diff --git a/bfd/archive.c b/bfd/archive.c index 53de8fc7d97..44cad84c59f 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -1240,6 +1240,11 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen) return false; thislen = strlen (normal); + + if (thislen > maxname + && (bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0) + thislen = maxname; + if (thislen > maxname) { /* Add one to leave room for \n. */ @@ -1449,6 +1454,12 @@ bfd_dont_truncate_arname (abfd, pathname, arhdr) const char *filename; int maxlen = ar_maxnamelen (abfd); + if ((bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0) + { + bfd_bsd_truncate_arname (abfd, pathname, arhdr); + return; + } + filename = normalize (abfd, pathname); if (filename == NULL) { @@ -1592,14 +1603,6 @@ _bfd_write_archive_contents (arch) } } - /* @@ This leads to archives that are incompatible with the native - AR on many systems, such as HP/UX and SunOS. [Cygnus PR - binutils/6888] It's a nice extension, but unless it can be made - optional, we shouldn't use it. This is a lame fix, but I don't - have time to fix it right just now. KR 1995/06/01 */ - /* Turning it off is a disaster for the many people who rely upon - it. We should make it optional, but since that is evidently not - happening soon it needs to be used by default. ILT 1995/07/04. */ if (!BFD_SEND (arch, _bfd_construct_extended_name_table, (arch, &etable, &elength, &ename))) return false;