This is the mail archive of the 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]

bfd question

Hi all,

I am trying to understand some stuff in how BFD works, for a research
project I'm working on. Help would be much appreciated! (I am not on
the list; please include me in the replies.)

In include/aout/aout64.h there is this type declaration:

struct reloc_std_external
 bfd_byte r_address[BYTES_IN_WORD];    /* Offset of of data to relocate.  */
 bfd_byte r_index[3] ;                 /* Symbol table index of symbol.  */
 bfd_byte r_type[1];                /* Relocation type.  */

It seems that most uses of this struct in the code are guarded by a


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?

Is it fundamentally tied to the endianness of binary formats? If so,
why are the *bits* inside r_type[0] reversed? To my knowledge,
bfd_header_big_endian() indicates the byte-endianness of the format.

Or is it a high-level programming pattern that helps BFD programmers
work with this code in a way that is harder otherwise?

Thanks very much! Any pointers would be much appreciated.


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