This is the mail archive of the binutils@sourceware.org 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: bfd question


shrimpx@gmail.com writes:

> It seems that most uses of this struct in the code are guarded by a
>
>  bfd_header_big_endian(...)
>
> check. E.g. line 420 in bfd/aout-arm.c. If bfd_header_big_endian() is
> true, it's assumed that the three bytes in r_index are laid out
> right-to-left. When it's false, they are left-to-right. Also,
> depending on the value of bfd_header_big_endian(), the *bits* in
> r_type[0] are laid out differently -- right to left vs left to right.
>
> Could someone help me understand why this is the case?

Don't try to understand a.out, it is mostly defined by legacy. :-)

> Is it fundamentally tied to the endianness of binary formats? If so,
> why are the *bits* inside r_type[0] reversed?

r_type is actually a bitfield, and bitfield endianess on most targets
coincides with byte endianess.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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