struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / sdbinutils / binutils / elfcomm.c
blobb772176496b5cc6d20b8059876227579f12c9fe9
1 /* elfcomm.c -- common code for ELF format file.
2 Copyright (C) 2010-2022 Free Software Foundation, Inc.
4 Originally developed by Eric Youngdale <eric@andante.jic.com>
5 Modifications by Nick Clifton <nickc@redhat.com>
7 This file is part of GNU Binutils.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
22 02110-1301, USA. */
24 /* Do not include bfd.h in this file. Functions in this file are used
25 by readelf.c and elfedit.c which define BFD64, and by objdump.c
26 which doesn't. */
28 #include "sysdep.h"
29 #include "libiberty.h"
30 #include "bfd.h"
31 #include "filenames.h"
32 #include "aout/ar.h"
33 #include "elfcomm.h"
34 #include <assert.h>
36 extern char *program_name;
38 void
39 error (const char *message, ...)
41 va_list args;
43 /* Try to keep error messages in sync with the program's normal output. */
44 fflush (stdout);
46 va_start (args, message);
47 fprintf (stderr, _("%s: Error: "), program_name);
48 vfprintf (stderr, message, args);
49 va_end (args);
52 void
53 warn (const char *message, ...)
55 va_list args;
57 /* Try to keep warning messages in sync with the program's normal output. */
58 fflush (stdout);
60 va_start (args, message);
61 fprintf (stderr, _("%s: Warning: "), program_name);
62 vfprintf (stderr, message, args);
63 va_end (args);
66 void (*byte_put) (unsigned char *, elf_vma, unsigned int);
68 void
69 byte_put_little_endian (unsigned char * field, elf_vma value, unsigned int size)
71 if (size > sizeof (elf_vma))
73 error (_("Unhandled data length: %d\n"), size);
74 abort ();
76 while (size--)
78 *field++ = value & 0xff;
79 value >>= 8;
83 void
84 byte_put_big_endian (unsigned char * field, elf_vma value, unsigned int size)
86 if (size > sizeof (elf_vma))
88 error (_("Unhandled data length: %d\n"), size);
89 abort ();
91 while (size--)
93 field[size] = value & 0xff;
94 value >>= 8;
98 elf_vma (*byte_get) (const unsigned char *, unsigned int);
100 elf_vma
101 byte_get_little_endian (const unsigned char *field, unsigned int size)
103 switch (size)
105 case 1:
106 return *field;
108 case 2:
109 return ((unsigned int) (field[0]))
110 | (((unsigned int) (field[1])) << 8);
112 case 3:
113 return ((unsigned long) (field[0]))
114 | (((unsigned long) (field[1])) << 8)
115 | (((unsigned long) (field[2])) << 16);
117 case 4:
118 return ((unsigned long) (field[0]))
119 | (((unsigned long) (field[1])) << 8)
120 | (((unsigned long) (field[2])) << 16)
121 | (((unsigned long) (field[3])) << 24);
123 case 5:
124 if (sizeof (elf_vma) >= 8)
125 return ((elf_vma) (field[0]))
126 | (((elf_vma) (field[1])) << 8)
127 | (((elf_vma) (field[2])) << 16)
128 | (((elf_vma) (field[3])) << 24)
129 | (((elf_vma) (field[4])) << 32);
130 /* Fall through. */
132 case 6:
133 if (sizeof (elf_vma) >= 8)
134 return ((elf_vma) (field[0]))
135 | (((elf_vma) (field[1])) << 8)
136 | (((elf_vma) (field[2])) << 16)
137 | (((elf_vma) (field[3])) << 24)
138 | (((elf_vma) (field[4])) << 32)
139 | (((elf_vma) (field[5])) << 40);
140 /* Fall through. */
142 case 7:
143 if (sizeof (elf_vma) >= 8)
144 return ((elf_vma) (field[0]))
145 | (((elf_vma) (field[1])) << 8)
146 | (((elf_vma) (field[2])) << 16)
147 | (((elf_vma) (field[3])) << 24)
148 | (((elf_vma) (field[4])) << 32)
149 | (((elf_vma) (field[5])) << 40)
150 | (((elf_vma) (field[6])) << 48);
151 /* Fall through. */
153 case 8:
154 if (sizeof (elf_vma) >= 8)
155 return ((elf_vma) (field[0]))
156 | (((elf_vma) (field[1])) << 8)
157 | (((elf_vma) (field[2])) << 16)
158 | (((elf_vma) (field[3])) << 24)
159 | (((elf_vma) (field[4])) << 32)
160 | (((elf_vma) (field[5])) << 40)
161 | (((elf_vma) (field[6])) << 48)
162 | (((elf_vma) (field[7])) << 56);
163 /* Fall through. */
165 default:
166 error (_("Unhandled data length: %d\n"), size);
167 abort ();
171 elf_vma
172 byte_get_big_endian (const unsigned char *field, unsigned int size)
174 switch (size)
176 case 1:
177 return *field;
179 case 2:
180 return ((unsigned int) (field[1])) | (((int) (field[0])) << 8);
182 case 3:
183 return ((unsigned long) (field[2]))
184 | (((unsigned long) (field[1])) << 8)
185 | (((unsigned long) (field[0])) << 16);
187 case 4:
188 return ((unsigned long) (field[3]))
189 | (((unsigned long) (field[2])) << 8)
190 | (((unsigned long) (field[1])) << 16)
191 | (((unsigned long) (field[0])) << 24);
193 case 5:
194 if (sizeof (elf_vma) >= 8)
195 return ((elf_vma) (field[4]))
196 | (((elf_vma) (field[3])) << 8)
197 | (((elf_vma) (field[2])) << 16)
198 | (((elf_vma) (field[1])) << 24)
199 | (((elf_vma) (field[0])) << 32);
200 /* Fall through. */
202 case 6:
203 if (sizeof (elf_vma) >= 8)
204 return ((elf_vma) (field[5]))
205 | (((elf_vma) (field[4])) << 8)
206 | (((elf_vma) (field[3])) << 16)
207 | (((elf_vma) (field[2])) << 24)
208 | (((elf_vma) (field[1])) << 32)
209 | (((elf_vma) (field[0])) << 40);
210 /* Fall through. */
212 case 7:
213 if (sizeof (elf_vma) >= 8)
214 return ((elf_vma) (field[6]))
215 | (((elf_vma) (field[5])) << 8)
216 | (((elf_vma) (field[4])) << 16)
217 | (((elf_vma) (field[3])) << 24)
218 | (((elf_vma) (field[2])) << 32)
219 | (((elf_vma) (field[1])) << 40)
220 | (((elf_vma) (field[0])) << 48);
221 /* Fall through. */
223 case 8:
224 if (sizeof (elf_vma) >= 8)
225 return ((elf_vma) (field[7]))
226 | (((elf_vma) (field[6])) << 8)
227 | (((elf_vma) (field[5])) << 16)
228 | (((elf_vma) (field[4])) << 24)
229 | (((elf_vma) (field[3])) << 32)
230 | (((elf_vma) (field[2])) << 40)
231 | (((elf_vma) (field[1])) << 48)
232 | (((elf_vma) (field[0])) << 56);
233 /* Fall through. */
235 default:
236 error (_("Unhandled data length: %d\n"), size);
237 abort ();
241 elf_vma
242 byte_get_signed (const unsigned char *field, unsigned int size)
244 elf_vma x = byte_get (field, size);
246 switch (size)
248 case 1:
249 return (x ^ 0x80) - 0x80;
250 case 2:
251 return (x ^ 0x8000) - 0x8000;
252 case 3:
253 return (x ^ 0x800000) - 0x800000;
254 case 4:
255 return (x ^ 0x80000000) - 0x80000000;
256 case 5:
257 case 6:
258 case 7:
259 case 8:
260 /* Reads of 5-, 6-, and 7-byte numbers are the result of
261 trying to read past the end of a buffer, and will therefore
262 not have meaningful values, so we don't try to deal with
263 the sign in these cases. */
264 return x;
265 default:
266 abort ();
270 /* Return the path name for a proxy entry in a thin archive, adjusted
271 relative to the path name of the thin archive itself if necessary.
272 Always returns a pointer to malloc'ed memory. */
274 char *
275 adjust_relative_path (const char *file_name, const char *name,
276 unsigned long name_len)
278 char * member_file_name;
279 const char * base_name = lbasename (file_name);
280 size_t amt;
282 /* This is a proxy entry for a thin archive member.
283 If the extended name table contains an absolute path
284 name, or if the archive is in the current directory,
285 use the path name as given. Otherwise, we need to
286 find the member relative to the directory where the
287 archive is located. */
288 if (IS_ABSOLUTE_PATH (name) || base_name == file_name)
290 amt = name_len + 1;
291 if (amt == 0)
292 return NULL;
293 member_file_name = (char *) malloc (amt);
294 if (member_file_name == NULL)
296 error (_("Out of memory\n"));
297 return NULL;
299 memcpy (member_file_name, name, name_len);
300 member_file_name[name_len] = '\0';
302 else
304 /* Concatenate the path components of the archive file name
305 to the relative path name from the extended name table. */
306 size_t prefix_len = base_name - file_name;
308 amt = prefix_len + name_len + 1;
309 /* PR 17531: file: 2896dc8b
310 Catch wraparound. */
311 if (amt < prefix_len || amt < name_len)
313 error (_("Abnormal length of thin archive member name: %lx\n"),
314 name_len);
315 return NULL;
318 member_file_name = (char *) malloc (amt);
319 if (member_file_name == NULL)
321 error (_("Out of memory\n"));
322 return NULL;
324 memcpy (member_file_name, file_name, prefix_len);
325 memcpy (member_file_name + prefix_len, name, name_len);
326 member_file_name[prefix_len + name_len] = '\0';
328 return member_file_name;
331 /* Processes the archive index table and symbol table in ARCH.
332 Entries in the index table are SIZEOF_AR_INDEX bytes long.
333 Fills in ARCH->next_arhdr_offset and ARCH->arhdr.
334 If READ_SYMBOLS is true then fills in ARCH->index_num, ARCH->index_array,
335 ARCH->sym_size and ARCH->sym_table.
336 It is the caller's responsibility to free ARCH->index_array and
337 ARCH->sym_table.
338 Returns 1 upon success, 0 otherwise.
339 If failure occurs an error message is printed. */
341 static int
342 process_archive_index_and_symbols (struct archive_info *arch,
343 unsigned int sizeof_ar_index,
344 int read_symbols)
346 size_t got;
347 unsigned long size;
348 char fmag_save;
350 fmag_save = arch->arhdr.ar_fmag[0];
351 arch->arhdr.ar_fmag[0] = 0;
352 size = strtoul (arch->arhdr.ar_size, NULL, 10);
353 arch->arhdr.ar_fmag[0] = fmag_save;
354 /* PR 17531: file: 912bd7de. */
355 if ((signed long) size < 0)
357 error (_("%s: invalid archive header size: %ld\n"),
358 arch->file_name, size);
359 return 0;
362 size = size + (size & 1);
364 arch->next_arhdr_offset += sizeof arch->arhdr + size;
366 if (! read_symbols)
368 if (fseek (arch->file, size, SEEK_CUR) != 0)
370 error (_("%s: failed to skip archive symbol table\n"),
371 arch->file_name);
372 return 0;
375 else
377 unsigned long i;
378 /* A buffer used to hold numbers read in from an archive index.
379 These are always SIZEOF_AR_INDEX bytes long and stored in
380 big-endian format. */
381 unsigned char integer_buffer[sizeof arch->index_num];
382 unsigned char * index_buffer;
384 assert (sizeof_ar_index <= sizeof integer_buffer);
386 /* Check the size of the archive index. */
387 if (size < sizeof_ar_index)
389 error (_("%s: the archive index is empty\n"), arch->file_name);
390 return 0;
393 /* Read the number of entries in the archive index. */
394 got = fread (integer_buffer, 1, sizeof_ar_index, arch->file);
395 if (got != sizeof_ar_index)
397 error (_("%s: failed to read archive index\n"), arch->file_name);
398 return 0;
401 arch->index_num = byte_get_big_endian (integer_buffer, sizeof_ar_index);
402 size -= sizeof_ar_index;
404 if (size < arch->index_num * sizeof_ar_index
405 /* PR 17531: file: 585515d1. */
406 || size < arch->index_num)
408 error (_("%s: the archive index is supposed to have 0x%lx entries of %d bytes, but the size is only 0x%lx\n"),
409 arch->file_name, (long) arch->index_num, sizeof_ar_index, size);
410 return 0;
413 /* Read in the archive index. */
414 index_buffer = (unsigned char *)
415 malloc (arch->index_num * sizeof_ar_index);
416 if (index_buffer == NULL)
418 error (_("Out of memory whilst trying to read archive symbol index\n"));
419 return 0;
422 got = fread (index_buffer, sizeof_ar_index, arch->index_num, arch->file);
423 if (got != arch->index_num)
425 free (index_buffer);
426 error (_("%s: failed to read archive index\n"), arch->file_name);
427 return 0;
430 size -= arch->index_num * sizeof_ar_index;
432 /* Convert the index numbers into the host's numeric format. */
433 arch->index_array = (elf_vma *)
434 malloc (arch->index_num * sizeof (* arch->index_array));
435 if (arch->index_array == NULL)
437 free (index_buffer);
438 error (_("Out of memory whilst trying to convert the archive symbol index\n"));
439 return 0;
442 for (i = 0; i < arch->index_num; i++)
443 arch->index_array[i] =
444 byte_get_big_endian ((unsigned char *) (index_buffer + (i * sizeof_ar_index)),
445 sizeof_ar_index);
446 free (index_buffer);
448 /* The remaining space in the header is taken up by the symbol table. */
449 if (size < 1)
451 error (_("%s: the archive has an index but no symbols\n"),
452 arch->file_name);
453 return 0;
456 arch->sym_table = (char *) malloc (size);
457 if (arch->sym_table == NULL)
459 error (_("Out of memory whilst trying to read archive index symbol table\n"));
460 return 0;
463 arch->sym_size = size;
464 got = fread (arch->sym_table, 1, size, arch->file);
465 if (got != size)
467 error (_("%s: failed to read archive index symbol table\n"),
468 arch->file_name);
469 return 0;
473 /* Read the next archive header. */
474 got = fread (&arch->arhdr, 1, sizeof arch->arhdr, arch->file);
475 if (got != sizeof arch->arhdr && got != 0)
477 error (_("%s: failed to read archive header following archive index\n"),
478 arch->file_name);
479 return 0;
482 return 1;
485 /* Read the symbol table and long-name table from an archive. */
488 setup_archive (struct archive_info *arch, const char *file_name,
489 FILE *file, off_t file_size,
490 int is_thin_archive, int read_symbols)
492 size_t got;
494 arch->file_name = strdup (file_name);
495 arch->file = file;
496 arch->index_num = 0;
497 arch->index_array = NULL;
498 arch->sym_table = NULL;
499 arch->sym_size = 0;
500 arch->longnames = NULL;
501 arch->longnames_size = 0;
502 arch->nested_member_origin = 0;
503 arch->is_thin_archive = is_thin_archive;
504 arch->uses_64bit_indices = 0;
505 arch->next_arhdr_offset = SARMAG;
507 /* Read the first archive member header. */
508 if (fseek (file, SARMAG, SEEK_SET) != 0)
510 error (_("%s: failed to seek to first archive header\n"), file_name);
511 return 1;
513 got = fread (&arch->arhdr, 1, sizeof arch->arhdr, file);
514 if (got != sizeof arch->arhdr)
516 if (got == 0)
517 return 0;
519 error (_("%s: failed to read archive header\n"), file_name);
520 return 1;
523 /* See if this is the archive symbol table. */
524 if (startswith (arch->arhdr.ar_name, "/ "))
526 if (! process_archive_index_and_symbols (arch, 4, read_symbols))
527 return 1;
529 else if (startswith (arch->arhdr.ar_name, "/SYM64/ "))
531 arch->uses_64bit_indices = 1;
532 if (! process_archive_index_and_symbols (arch, 8, read_symbols))
533 return 1;
535 else if (read_symbols)
536 printf (_("%s has no archive index\n"), file_name);
538 if (startswith (arch->arhdr.ar_name, "// "))
540 /* This is the archive string table holding long member names. */
541 char fmag_save = arch->arhdr.ar_fmag[0];
542 arch->arhdr.ar_fmag[0] = 0;
543 arch->longnames_size = strtoul (arch->arhdr.ar_size, NULL, 10);
544 arch->arhdr.ar_fmag[0] = fmag_save;
545 /* PR 17531: file: 01068045. */
546 if (arch->longnames_size < 8)
548 error (_("%s: long name table is too small, (size = %ld)\n"),
549 file_name, arch->longnames_size);
550 return 1;
552 /* PR 17531: file: 639d6a26. */
553 if ((off_t) arch->longnames_size > file_size
554 || (signed long) arch->longnames_size < 0)
556 error (_("%s: long name table is too big, (size = 0x%lx)\n"),
557 file_name, arch->longnames_size);
558 return 1;
561 arch->next_arhdr_offset += sizeof arch->arhdr + arch->longnames_size;
563 /* Plus one to allow for a string terminator. */
564 arch->longnames = (char *) malloc (arch->longnames_size + 1);
565 if (arch->longnames == NULL)
567 error (_("Out of memory reading long symbol names in archive\n"));
568 return 1;
571 if (fread (arch->longnames, arch->longnames_size, 1, file) != 1)
573 free (arch->longnames);
574 arch->longnames = NULL;
575 error (_("%s: failed to read long symbol name string table\n"),
576 file_name);
577 return 1;
580 if ((arch->longnames_size & 1) != 0)
581 getc (file);
583 arch->longnames[arch->longnames_size] = 0;
586 return 0;
589 /* Open and setup a nested archive, if not already open. */
592 setup_nested_archive (struct archive_info *nested_arch,
593 const char *member_file_name)
595 FILE * member_file;
596 struct stat statbuf;
598 /* Have we already setup this archive? */
599 if (nested_arch->file_name != NULL
600 && streq (nested_arch->file_name, member_file_name))
601 return 0;
603 /* Close previous file and discard cached information. */
604 if (nested_arch->file != NULL)
606 fclose (nested_arch->file);
607 nested_arch->file = NULL;
609 release_archive (nested_arch);
611 member_file = fopen (member_file_name, "rb");
612 if (member_file == NULL)
613 return 1;
614 if (fstat (fileno (member_file), &statbuf) < 0)
615 return 1;
616 return setup_archive (nested_arch, member_file_name, member_file,
617 statbuf.st_size, 0, 0);
620 /* Release the memory used for the archive information. */
622 void
623 release_archive (struct archive_info * arch)
625 free (arch->file_name);
626 free (arch->index_array);
627 free (arch->sym_table);
628 free (arch->longnames);
629 arch->file_name = NULL;
630 arch->index_array = NULL;
631 arch->sym_table = NULL;
632 arch->longnames = NULL;
635 /* Get the name of an archive member from the current archive header.
636 For simple names, this will modify the ar_name field of the current
637 archive header. For long names, it will return a pointer to the
638 longnames table. For nested archives, it will open the nested archive
639 and get the name recursively. NESTED_ARCH is a single-entry cache so
640 we don't keep rereading the same information from a nested archive. */
642 char *
643 get_archive_member_name (struct archive_info *arch,
644 struct archive_info *nested_arch)
646 unsigned long j, k;
648 if (arch->arhdr.ar_name[0] == '/')
650 /* We have a long name. */
651 char *endp;
652 char *member_file_name;
653 char *member_name;
654 char fmag_save;
656 if (arch->longnames == NULL || arch->longnames_size == 0)
658 error (_("Archive member uses long names, but no longname table found\n"));
659 return NULL;
662 arch->nested_member_origin = 0;
663 fmag_save = arch->arhdr.ar_fmag[0];
664 arch->arhdr.ar_fmag[0] = 0;
665 k = j = strtoul (arch->arhdr.ar_name + 1, &endp, 10);
666 if (arch->is_thin_archive && endp != NULL && * endp == ':')
667 arch->nested_member_origin = strtoul (endp + 1, NULL, 10);
668 arch->arhdr.ar_fmag[0] = fmag_save;
670 if (j > arch->longnames_size)
672 error (_("Found long name index (%ld) beyond end of long name table\n"),j);
673 return NULL;
675 while ((j < arch->longnames_size)
676 && (arch->longnames[j] != '\n')
677 && (arch->longnames[j] != '\0'))
678 j++;
679 if (j > 0 && arch->longnames[j-1] == '/')
680 j--;
681 if (j > arch->longnames_size)
682 j = arch->longnames_size;
683 arch->longnames[j] = '\0';
685 if (!arch->is_thin_archive || arch->nested_member_origin == 0)
686 return xstrdup (arch->longnames + k);
688 /* PR 17531: file: 2896dc8b. */
689 if (k >= j)
691 error (_("Invalid Thin archive member name\n"));
692 return NULL;
695 /* This is a proxy for a member of a nested archive.
696 Find the name of the member in that archive. */
697 member_file_name = adjust_relative_path (arch->file_name,
698 arch->longnames + k, j - k);
699 if (member_file_name != NULL
700 && setup_nested_archive (nested_arch, member_file_name) == 0)
702 member_name = get_archive_member_name_at (nested_arch,
703 arch->nested_member_origin,
704 NULL);
705 if (member_name != NULL)
707 free (member_file_name);
708 return member_name;
711 free (member_file_name);
713 /* Last resort: just return the name of the nested archive. */
714 return xstrdup (arch->longnames + k);
717 /* We have a normal (short) name. */
718 for (j = 0; j < sizeof (arch->arhdr.ar_name); j++)
719 if (arch->arhdr.ar_name[j] == '/')
721 arch->arhdr.ar_name[j] = '\0';
722 return xstrdup (arch->arhdr.ar_name);
725 /* The full ar_name field is used. Don't rely on ar_date starting
726 with a zero byte. */
728 char *name = xmalloc (sizeof (arch->arhdr.ar_name) + 1);
729 memcpy (name, arch->arhdr.ar_name, sizeof (arch->arhdr.ar_name));
730 name[sizeof (arch->arhdr.ar_name)] = '\0';
731 return name;
735 /* Get the name of an archive member at a given OFFSET within an archive
736 ARCH. */
738 char *
739 get_archive_member_name_at (struct archive_info *arch,
740 unsigned long offset,
741 struct archive_info *nested_arch)
743 size_t got;
745 if (fseek (arch->file, offset, SEEK_SET) != 0)
747 error (_("%s: failed to seek to next file name\n"), arch->file_name);
748 return NULL;
750 got = fread (&arch->arhdr, 1, sizeof arch->arhdr, arch->file);
751 if (got != sizeof arch->arhdr)
753 error (_("%s: failed to read archive header\n"), arch->file_name);
754 return NULL;
756 if (memcmp (arch->arhdr.ar_fmag, ARFMAG, 2) != 0)
758 error (_("%s: did not find a valid archive header\n"),
759 arch->file_name);
760 return NULL;
763 return get_archive_member_name (arch, nested_arch);
766 /* Construct a string showing the name of the archive member, qualified
767 with the name of the containing archive file. For thin archives, we
768 use square brackets to denote the indirection. For nested archives,
769 we show the qualified name of the external member inside the square
770 brackets (e.g., "thin.a[normal.a(foo.o)]"). */
772 char *
773 make_qualified_name (struct archive_info * arch,
774 struct archive_info * nested_arch,
775 const char *member_name)
777 const char * error_name = _("<corrupt>");
778 size_t len;
779 char * name;
781 len = strlen (arch->file_name) + strlen (member_name) + 3;
782 if (arch->is_thin_archive
783 && arch->nested_member_origin != 0)
785 /* PR 15140: Allow for corrupt thin archives. */
786 if (nested_arch->file_name)
787 len += strlen (nested_arch->file_name) + 2;
788 else
789 len += strlen (error_name) + 2;
792 name = (char *) malloc (len);
793 if (name == NULL)
795 error (_("Out of memory\n"));
796 return NULL;
799 if (arch->is_thin_archive
800 && arch->nested_member_origin != 0)
802 if (nested_arch->file_name)
803 snprintf (name, len, "%s[%s(%s)]", arch->file_name,
804 nested_arch->file_name, member_name);
805 else
806 snprintf (name, len, "%s[%s(%s)]", arch->file_name,
807 error_name, member_name);
809 else if (arch->is_thin_archive)
810 snprintf (name, len, "%s[%s]", arch->file_name, member_name);
811 else
812 snprintf (name, len, "%s(%s)", arch->file_name, member_name);
814 return name;