This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
readelf and archive
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Fri, 8 Aug 2003 17:02:50 -0700
- Subject: readelf and archive
I am trying to get readelf to work on archive. I ran into a problem.
readelf.c has
#if __GNUC__ >= 2
/* Define BFD64 here, even if our default architecture is 32 bit ELF
as this will allow us to read in and parse 64bit and 32bit ELF files.
Only do this if we believe that the compiler can support a 64 bit
data type. For now we only rely on GCC being able to do this. */
#define BFD64
#endif
That means it can't use any BFD functions if BFD64 is not enabled
since BFD function prototypes will mismatch. I need
extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
extern int bfd_seek (bfd *, file_ptr, int);
extern ufile_ptr bfd_tell (bfd *);
What is the best way to fix it? Their propotypes should be host
specific, not target specific. I am thinking
typedef long file_ptr;
typedef unsigned long ufile_ptr;
typedef unsigned long bfd_host_size_type;
extern bfd_host_size_type bfd_bread (void *, bfd_host_size_type, bfd *);
extern bfd_host_size_type bfd_bwrite (const void *, bfd_host_size_type, bfd *);
extern int bfd_seek (bfd *, file_ptr, int);
extern ufile_ptr bfd_tell (bfd *);
BTW, fseek/ftell work on long, not off_t.
H.J.