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]

Re: readelf and archive


On Fri, Aug 08, 2003 at 10:39:03PM -0700, Ian Lance Taylor wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
> 
> > That means it can't use any BFD functions if BFD64 is not enabled
> > since BFD function prototypes will mismatch.
> 
> Good, since it shouldn't use them anyhow.
> 
> > 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.
> 
> Hmmm.  At first I thought that was correct, but now I'm not sure.
> When reading a 64-bit object file on a 32-bit host, it seems at least
> conceivable that these functions will be called with 64 bit values.
> While it's true that they don't handle such values correctly now, that
> by itself doesn't mean that the BFD interface should be changed to
> preclude it.
> 
> > typedef long file_ptr;
> > typedef unsigned long ufile_ptr;
> > typedef unsigned long bfd_host_size_type;
> 
> Even if we go with using host types, this doesn't seem right--it
> should be more like off_t and size_t.

They are not 100% correct. They can't handle >2GB 64bit object files
on a 32bit host. But they are more correct than the current one.

> 
> > BTW, fseek/ftell work on long, not off_t.
> 
> True, but maybe BFD should use fseeko and ftello when available.

That is the only way to correctly read all 64-bit object files on
a 32-bit host.


H.J.


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