This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]