aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-10-21 12:54:06 +1030
committerAlan Modra <amodra@gmail.com>2019-10-21 16:13:39 +1030
commit95cc7c169c4bbb6f10e630184f527b20b83fc5c3 (patch)
tree926d50d0829027a0804a62450fcbf6396c85da72 /bfd/archive.c
parent54d83b8d3920eea4a0d545f1ff7ac2923d938e6c (diff)
downloadgdb-95cc7c169c4bbb6f10e630184f527b20b83fc5c3.zip
gdb-95cc7c169c4bbb6f10e630184f527b20b83fc5c3.tar.gz
gdb-95cc7c169c4bbb6f10e630184f527b20b83fc5c3.tar.bz2
ar P support
This patch extends "ar P" to allow creation of normal (as distinct from thin) archives with full path names. PR 452 PR 25104 bfd/ * archive.c (normalize): Return file unchanged when BFD_ARCHIVE_FULL_PATH. (_bfd_construct_extended_name_table): Pass abfd, the output bfd, to normalize. (_bfd_archive_bsd44_construct_extended_name_table): Likewise. * bfd.c (struct bfd): Make flags a full flagword. (BFD_ARCHIVE_FULL_PATH): Define. * bfd-in2.h: Regenerate. binutils/ * ar.c (write_archive): Set BFD_ARCHIVE_FULL_PATH. * doc/binutils.texi (extract from archive): Mention restrictions when extracting from archives with full paths. (ar P): Update to current P support. (ar -X32_64): Fix spelling.
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index ccc09ad..6b7a78c 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1299,6 +1299,9 @@ normalize (bfd *abfd, const char *file)
const char *last;
char *copy;
+ if (abfd->flags & BFD_ARCHIVE_FULL_PATH)
+ return file;
+
first = file + strlen (file) - 1;
last = first + 1;
@@ -1326,8 +1329,10 @@ normalize (bfd *abfd, const char *file)
#else
static const char *
-normalize (bfd *abfd ATTRIBUTE_UNUSED, const char *file)
+normalize (bfd *abfd, const char *file)
{
+ if (abfd->flags & BFD_ARCHIVE_FULL_PATH)
+ return file;
return lbasename (file);
}
#endif
@@ -1562,7 +1567,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
continue;
}
- normal = normalize (current, current->filename);
+ normal = normalize (abfd, current->filename);
if (normal == NULL)
return FALSE;
@@ -1643,7 +1648,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
}
else
{
- normal = normalize (current, filename);
+ normal = normalize (abfd, filename);
if (normal == NULL)
return FALSE;
}
@@ -1714,7 +1719,7 @@ _bfd_archive_bsd44_construct_extended_name_table (bfd *abfd,
current != NULL;
current = current->archive_next)
{
- const char *normal = normalize (current, current->filename);
+ const char *normal = normalize (abfd, current->filename);
int has_space = 0;
unsigned int len;