aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2007-02-05 16:37:05 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2007-02-05 16:37:05 +0000
commit8d0510ddbd6631df4b2b811b19b5d315ad52c82f (patch)
tree87b962c7a9de181ad20de86cd29557f0a5db48f0 /gcc
parentcd5c235734cbd984d135eeba66315313e8a633b7 (diff)
downloadgcc-8d0510ddbd6631df4b2b811b19b5d315ad52c82f.zip
gcc-8d0510ddbd6631df4b2b811b19b5d315ad52c82f.tar.gz
gcc-8d0510ddbd6631df4b2b811b19b5d315ad52c82f.tar.bz2
mips-tfile.c (initialize_init_file): Correct endianness test.
* mips-tfile.c (initialize_init_file): Correct endianness test. From-SVN: r121602
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/mips-tfile.c21
2 files changed, 21 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6fff2ea..165cfeb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2007-02-05 Roger Sayle <roger@eyesopen.com>
+
+ * mips-tfile.c (initialize_init_file): Correct endianness test.
+
2007-02-05 Kazu Hirata <kazu@codesourcery.com>
* config/m68k/m68k.md (pushdi-1, pushdi, movsi+1): Don't use
diff --git a/gcc/mips-tfile.c b/gcc/mips-tfile.c
index c543f97..ac70300 100644
--- a/gcc/mips-tfile.c
+++ b/gcc/mips-tfile.c
@@ -3,7 +3,7 @@
in the form of comments (the mips assembler does not support
assembly access to debug information).
Copyright (C) 1991, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Michael Meissner (meissner@cygnus.com).
This file is part of GCC.
@@ -2352,15 +2352,28 @@ add_procedure (const char *func_start, /* 1st byte of func name */
STATIC void
initialize_init_file (void)
{
+ union {
+ unsigned char c[4];
+ int i;
+ } endian_test;
+
memset (&init_file, 0, sizeof (init_file));
init_file.fdr.lang = langC;
init_file.fdr.fMerge = 1;
init_file.fdr.glevel = GLEVEL_2;
-#ifdef WORDS_BIG_ENDIAN
- init_file.fdr.fBigendian = 1;
-#endif
+ /* mips-tfile doesn't attempt to perform byte swapping and always writes
+ out integers in its native ordering. For cross-compilers, this need
+ not be the same as either the host or the target. The simplest thing
+ to do is skip the configury and perform an introspective test. */
+ /* ??? Despite the name, mips-tfile is currently only used on alpha/Tru64
+ and would/may require significant work to be used in cross-compiler
+ configurations, so we could simply admit defeat and hard code this as
+ little-endian, i.e. init_file.fdr.fBigendian = 0. */
+ endian_test.i = 1;
+ if (endian_test.c[3])
+ init_file.fdr.fBigendian = 1;
INITIALIZE_VARRAY (&init_file.strings, char);
INITIALIZE_VARRAY (&init_file.symbols, SYMR);