Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* trying to understand some BFD code
@ 2007-10-02 22:31 shrimpx
  2007-10-02 22:39 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: shrimpx @ 2007-10-02 22:31 UTC (permalink / raw)
  To: gdb

Hi all,

I've asked a similar question before, but I'm still trying to
understand some stuff in how BFD works, for a research project I'm
working on. Help would be much appreciated!

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

  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 explain 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 GDB programmers
work with this code in a way that is harder otherwise?

Thanks very much!

-m


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-02 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-02 22:31 trying to understand some BFD code shrimpx
2007-10-02 22:39 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox