* a question
@ 2007-08-16 0:20 Marius Nita
2007-08-16 0:30 ` Daniel Jacobowitz
0 siblings, 1 reply; 5+ messages in thread
From: Marius Nita @ 2007-08-16 0:20 UTC (permalink / raw)
To: gdb
Hi, I am trying to understand some endian-specific code in GDB (well,
BFD for the purpose of this message). I would greatly appreciate any
help.
I have a rather specific question regarding the code below, which is
in bfd/aout-arm.c line 420. This code seems to deal with bit-level
endianness. E.g. a "char" address holding a bit pattern 00010000
represents 0x10 on one endianness and 0x08 on the other. The r_length
left-shift below shifts data by 5 bits on big-endian and 1 bit on
little-endian. The r_length data will end up occupying 2 bits in the
natptr->r_type[0] byte. On big-endian, they'll be bits 6 and 7, and on
little-endian, they are bits 2 and 3.
My question is: why aren't the bits in r_length "reversed" to conform
with bit-level endianness? For example, if the r_length bits are "10",
this left-shift results in "0100 0000" on big-endian and "0000 0100"
on little-endian. These bit strings are clearly not the reverse of
each other.
Any help would be much appreciated!
Thank you!
-m
if (bfd_header_big_endian (abfd))
{
natptr->r_index[0] = r_index >> 16;
natptr->r_index[1] = r_index >> 8;
natptr->r_index[2] = r_index;
natptr->r_type[0] =
( (r_extern ? RELOC_STD_BITS_EXTERN_BIG: 0)
| (r_pcrel ? RELOC_STD_BITS_PCREL_BIG: 0)
| (r_neg ? RELOC_ARM_BITS_NEG_BIG: 0)
| (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
}
else
{
natptr->r_index[2] = r_index >> 16;
natptr->r_index[1] = r_index >> 8;
natptr->r_index[0] = r_index;
natptr->r_type[0] =
( (r_extern ? RELOC_STD_BITS_EXTERN_LITTLE: 0)
| (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE: 0)
| (r_neg ? RELOC_ARM_BITS_NEG_LITTLE: 0)
| (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
}
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: a question
2007-08-16 0:20 a question Marius Nita
@ 2007-08-16 0:30 ` Daniel Jacobowitz
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-08-16 0:30 UTC (permalink / raw)
To: Marius Nita; +Cc: gdb
On Wed, Aug 15, 2007 at 05:20:23PM -0700, Marius Nita wrote:
> I have a rather specific question regarding the code below, which is
> in bfd/aout-arm.c line 420. This code seems to deal with bit-level
> endianness. E.g. a "char" address holding a bit pattern 00010000
> represents 0x10 on one endianness and 0x08 on the other. The r_length
> left-shift below shifts data by 5 bits on big-endian and 1 bit on
> little-endian. The r_length data will end up occupying 2 bits in the
> natptr->r_type[0] byte. On big-endian, they'll be bits 6 and 7, and on
> little-endian, they are bits 2 and 3.
>
> My question is: why aren't the bits in r_length "reversed" to conform
> with bit-level endianness? For example, if the r_length bits are "10",
> this left-shift results in "0100 0000" on big-endian and "0000 0100"
> on little-endian. These bit strings are clearly not the reverse of
> each other.
Each byte is written out, one at a time. At that point there is no
definition of "endianness". Bitfields are always special, since they
are at finer than byte resolution. Try writing the obvious C struct
equivalent of the data type, and think about how it's laid out in each
endianness.
I don't want to know what you're doing that involves ARM and a.out;
whatever it is, use ELF instead :-)
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 5+ messages in thread
* A Question
@ 2014-02-04 18:06 Thomas Dineen
2014-02-04 19:07 ` Eli Zaretskii
2014-02-05 0:55 ` Christopher Faylor
0 siblings, 2 replies; 5+ messages in thread
From: Thomas Dineen @ 2014-02-04 18:06 UTC (permalink / raw)
To: gdb, Thomas Dineen
Gentlepeople:
Is there the equivalent of a core file on Windows?
If yes where is it found?
Do you have to generate one?
Thank You
Thomas Dineen
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-05 0:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-16 0:20 a question Marius Nita
2007-08-16 0:30 ` Daniel Jacobowitz
2014-02-04 18:06 A Question Thomas Dineen
2014-02-04 19:07 ` Eli Zaretskii
2014-02-05 0:55 ` Christopher Faylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox