This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA:] sim-config.c: When having a bfd, don't just check bfd_little_endian
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: gdb-patches at gcc dot gnu dot org
- Date: Tue, 9 Nov 2004 23:01:57 +0100
- Subject: [RFA:] sim-config.c: When having a bfd, don't just check bfd_little_endian
The testcase for this bug looks like this:
---------------------
# mach: crisv32
# output: 0\n0\n4\n42\n
# sim: --cris-naked --target binary --architecture crisv32
# ld: --oformat binary
; Check that we can run a naked binary with the same expected
; results as an ELF "executable".
.include "bare1.ms"
---------------------
That is, we try and run a binary file with a specified
architecture and test output as with the ELF. Current behaviour
is to emit:
Target (LITTLE_ENDIAN) and specified (BIG_ENDIAN) byte order in conflict
0
0
4
42
which is clearly wrong; BIG_ENDIAN isn't *specified* neither
should it be perceived as such for a binary file.
Ok to commit?
2004-11-09 Hans-Peter Nilsson <hp@axis.com>
* sim-config.c (sim_config): Recognize when a bfd has unspecified
endian information.
Index: sim-config.c
===================================================================
RCS file: /cvs/src/src/sim/common/sim-config.c,v
retrieving revision 1.2
diff -c -p -r1.2 sim-config.c
*** sim-config.c 23 Nov 2002 01:12:05 -0000 1.2
--- sim-config.c 9 Nov 2004 19:41:07 -0000
*************** sim_config (SIM_DESC sd)
*** 146,152 ****
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
/* extract all relevant information */
! if (STATE_PROG_BFD (sd) == NULL)
prefered_target_byte_order = 0;
else
prefered_target_byte_order = (bfd_little_endian(STATE_PROG_BFD (sd))
--- 146,156 ----
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
/* extract all relevant information */
! if (STATE_PROG_BFD (sd) == NULL
! /* If we have a binary input file (presumably with specified
! "--architecture"), it'll have no endianness. */
! || (!bfd_little_endian (STATE_PROG_BFD (sd))
! && !bfd_big_endian (STATE_PROG_BFD (sd))))
prefered_target_byte_order = 0;
else
prefered_target_byte_order = (bfd_little_endian(STATE_PROG_BFD (sd))
brgds, H-P