public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Adam Nemet <anemet@caviumnetworks.com>
To: binutils@sourceware.org
Subject: [PATCH, MIPS] readelf: deal with 64-bit armaps
Date: Thu, 26 Jul 2007 21:20:00 -0000	[thread overview]
Message-ID: <18088.64921.637370.539132@localhost.localdomain> (raw)

For Irix 6-style armaps, the fake file name /SYM64/ is not recognized
in readelf as an archive symbol table and you get:

  readelf: Error: s.a: invalid archive string table offset 0

Right now we just skip symbol tables so the patch below adds this name
to the possible symbol table names.

I also added some more comments in bfd that would have helped me while
working on this.

OK to install?

binutils/

	* readelf.c (process_archive): Also skip Irix6-style archive symbol
	tables.

bfd/

	* archive.c (do_slurp_bsd_armap, do_slurp_coff_armap,
	bfd_slurp_armap): Improve function comment.


Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.370
diff -F^\([(a-zA-Z0-9_]\|#define\) -u -p -r1.370 readelf.c
--- binutils/readelf.c	9 Jul 2007 21:19:51 -0000	1.370
+++ binutils/readelf.c	26 Jul 2007 19:47:40 -0000
@@ -9680,7 +9680,8 @@ process_archive (char *file_name, FILE *
       return 1;
     }
 
-  if (const_strneq (arhdr.ar_name, "/               "))
+  if (const_strneq (arhdr.ar_name, "/               ")
+      || const_strneq (arhdr.ar_name, "/SYM64/         "))
     {
       /* This is the archive symbol table.  Skip it.
 	 FIXME: We should have an option to dump it.  */
Index: bfd/archive.c
===================================================================
RCS file: /cvs/src/src/bfd/archive.c,v
retrieving revision 1.50
diff -F^\([(a-zA-Z0-9_]\|#define\) -u -p -r1.50 archive.c
--- bfd/archive.c	3 Jul 2007 14:26:39 -0000	1.50
+++ bfd/archive.c	26 Jul 2007 19:47:40 -0000
@@ -698,7 +698,8 @@ #define BSD_SYMDEF_COUNT_SIZE 4
 /* The size of the string count.  */
 #define BSD_STRING_COUNT_SIZE 4
 
-/* Returns FALSE on error, TRUE otherwise.  */
+/* Read a BSD-style archive symbol table.  Returns FALSE on error,
+   TRUE otherwise.  */
 
 static bfd_boolean
 do_slurp_bsd_armap (bfd *abfd)
@@ -768,7 +769,8 @@ do_slurp_bsd_armap (bfd *abfd)
   return TRUE;
 }
 
-/* Returns FALSE on error, TRUE otherwise.  */
+/* Read a COFF archive symbol table.  Returns FALSE on error, TRUE
+   otherwise.  */
 
 static bfd_boolean
 do_slurp_coff_armap (bfd *abfd)
@@ -895,8 +897,8 @@ release_symdefs:
   return FALSE;
 }
 
-/* This routine can handle either coff-style or bsd-style armaps.
-   Returns FALSE on error, TRUE otherwise */
+/* This routine can handle either coff-style or bsd-style armaps
+   (archive symbol table).  Returns FALSE on error, TRUE otherwise */
 
 bfd_boolean
 bfd_slurp_armap (bfd *abfd)

             reply	other threads:[~2007-07-26 20:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 21:20 Adam Nemet [this message]
2007-07-27  0:27 ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18088.64921.637370.539132@localhost.localdomain \
    --to=anemet@caviumnetworks.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).