diff options
author | Ant Bikeneev <ant.bikineev@gmail.com> | 2018-05-30 17:06:26 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2018-05-30 17:08:03 +0100 |
commit | 1869e86f2eb13a9e1d1c42b97cdb98fef88afd83 (patch) | |
tree | 18f71cb0a58e06370f41152a3393130306b163fd /binutils/bucomm.c | |
parent | fdbe37e35fed48091296434652101a63fa4360cf (diff) | |
download | gdb-1869e86f2eb13a9e1d1c42b97cdb98fef88afd83.zip gdb-1869e86f2eb13a9e1d1c42b97cdb98fef88afd83.tar.gz gdb-1869e86f2eb13a9e1d1c42b97cdb98fef88afd83.tar.bz2 |
Add option to ar's 't' command to display the offset of elements within the archive.
PR 23107
* ar.c (display_offsets): New variable.
(usage): Add description of 'O' operator.
(decode_option): Handle 'O' operator.
(print_descr): Pass display_offsets to print_arelt_descr.
* arsup.c: Update call to printy_arelt_descr.
* objdump.c: Likewise.
* bucomm.c (print_arelt_descr): If offsets parameter is true then
display offset of archive element within the archive.
* bucomm.h: Update prototype for print_arelt_descr.
* doc/binutils.texi: Update description of ar command.
* NEWS: Mention the new feature.
* testsuite/binutils-all/ar.exp: Add text of new feature.
Diffstat (limited to 'binutils/bucomm.c')
-rw-r--r-- | binutils/bucomm.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/binutils/bucomm.c b/binutils/bucomm.c index d3a8d2d..8269c8d 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -427,7 +427,7 @@ display_info (void) Mode User\tGroup\tSize\tDate Name */ void -print_arelt_descr (FILE *file, bfd *abfd, bfd_boolean verbose) +print_arelt_descr (FILE *file, bfd *abfd, bfd_boolean verbose, bfd_boolean offsets) { struct stat buf; @@ -458,7 +458,17 @@ print_arelt_descr (FILE *file, bfd *abfd, bfd_boolean verbose) } } - fprintf (file, "%s\n", bfd_get_filename (abfd)); + fprintf (file, "%s", bfd_get_filename (abfd)); + + if (offsets) + { + if (bfd_is_thin_archive (abfd) && abfd->proxy_origin) + fprintf (file, " 0x%lx", (unsigned long) abfd->proxy_origin); + else if (!bfd_is_thin_archive (abfd) && abfd->origin) + fprintf (file, " 0x%lx", (unsigned long) abfd->origin); + } + + fprintf (file, "\n"); } /* Return a path for a new temporary file in the same directory |