From: shrimpx@gmail.com
To: gdb@sourceware.org
Subject: trying to understand some BFD code
Date: Tue, 02 Oct 2007 22:31:00 -0000 [thread overview]
Message-ID: <f72a771a0710021531m67607b08mc84361bf4a4ee25c@mail.gmail.com> (raw)
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
next reply other threads:[~2007-10-02 22:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-02 22:31 shrimpx [this message]
2007-10-02 22:39 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f72a771a0710021531m67607b08mc84361bf4a4ee25c@mail.gmail.com \
--to=shrimpx@gmail.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox