* configure.in (AC_C_BIGENDIAN): Invoke.

* configure: Regenerate.
	* write.c (write_object_file <!BFD_ASSEMBLER>): Don't use sizeof
	host variable to set string header size.
	* config/obj-aout.c (obj_header_append): Don't use host structs.
	(obj_symbol_to_chars): Likewise.
	(obj_emit_strings): Likewise.  Use the passed in output pointer.
	* config/obj-aout.h (H_GET_FILE_SIZE): Include H_GET_LINENO_SIZE.
	* config/obj-bout.c (obj_emit_relocations): Use md_reloc_size,
	not sizeof host struct.
	(obj_header_append, obj_symbol_to_chars): Don't use host structs.
	(obj_emit_strings): Likewise.
	* config/obj-bout.h (EXEC_BYTES_SIZE): Define.
	(N_TXTOFF, H_GET_FILE_SIZE, H_GET_HEADER_SIZE): Use instead of
	sizeof host struct.
	(H_SET_SYMBOL_TABLE_SIZE): Hard code sym size rather than using
	sizeof host struct.
	(host_number_to_chars): Define.
	* config/obj-hp300.c (hp300_header_append): Don't use sizeof
	host internal struct to set header sizes.
	* config/tc-i960.c (md_number_to_field): Warning fix.
	(md_ri_to_chars): Use host byte order.
	(get_cdisp, md_apply_fix3): Warning fix.
This commit is contained in:
Alan Modra 2005-03-01 00:43:58 +00:00
parent 70bfececf5
commit 44f2f9d2a3
10 changed files with 388 additions and 122 deletions

View file

@ -1,3 +1,29 @@
2005-03-01 Alan Modra <amodra@bigpond.net.au>
* configure.in (AC_C_BIGENDIAN): Invoke.
* configure: Regenerate.
* write.c (write_object_file <!BFD_ASSEMBLER>): Don't use sizeof
host variable to set string header size.
* config/obj-aout.c (obj_header_append): Don't use host structs.
(obj_symbol_to_chars): Likewise.
(obj_emit_strings): Likewise. Use the passed in output pointer.
* config/obj-aout.h (H_GET_FILE_SIZE): Include H_GET_LINENO_SIZE.
* config/obj-bout.c (obj_emit_relocations): Use md_reloc_size,
not sizeof host struct.
(obj_header_append, obj_symbol_to_chars): Don't use host structs.
(obj_emit_strings): Likewise.
* config/obj-bout.h (EXEC_BYTES_SIZE): Define.
(N_TXTOFF, H_GET_FILE_SIZE, H_GET_HEADER_SIZE): Use instead of
sizeof host struct.
(H_SET_SYMBOL_TABLE_SIZE): Hard code sym size rather than using
sizeof host struct.
(host_number_to_chars): Define.
* config/obj-hp300.c (hp300_header_append): Don't use sizeof
host internal struct to set header sizes.
* config/tc-i960.c (md_number_to_field): Warning fix.
(md_ri_to_chars): Use host byte order.
(get_cdisp, md_apply_fix3): Warning fix.
2005-02-28 Ramana Radhakrishnan <ramana.radhakrishnan@codito.com>
* doc/c-arc.texi: Update documentation about ARC's extension

View file

@ -1,6 +1,6 @@
/* a.out object file format
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000,
2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@ -265,36 +265,39 @@ obj_emit_relocations (where, fixP, segment_address_in_file)
#ifndef obj_header_append
/* Aout file generation & utilities */
/* An AOUT header on disk is laid out in target byte order. */
void
obj_header_append (where, headers)
char **where;
object_headers *headers;
{
char *p;
tc_headers_hook (headers);
#ifdef CROSS_COMPILE
md_number_to_chars (*where, headers->header.a_info, sizeof (headers->header.a_info));
*where += sizeof (headers->header.a_info);
md_number_to_chars (*where, headers->header.a_text, sizeof (headers->header.a_text));
*where += sizeof (headers->header.a_text);
md_number_to_chars (*where, headers->header.a_data, sizeof (headers->header.a_data));
*where += sizeof (headers->header.a_data);
md_number_to_chars (*where, headers->header.a_bss, sizeof (headers->header.a_bss));
*where += sizeof (headers->header.a_bss);
md_number_to_chars (*where, headers->header.a_syms, sizeof (headers->header.a_syms));
*where += sizeof (headers->header.a_syms);
md_number_to_chars (*where, headers->header.a_entry, sizeof (headers->header.a_entry));
*where += sizeof (headers->header.a_entry);
md_number_to_chars (*where, headers->header.a_trsize, sizeof (headers->header.a_trsize));
*where += sizeof (headers->header.a_trsize);
md_number_to_chars (*where, headers->header.a_drsize, sizeof (headers->header.a_drsize));
*where += sizeof (headers->header.a_drsize);
#else /* CROSS_COMPILE */
append (where, (char *) &headers->header, sizeof (headers->header));
#endif /* CROSS_COMPILE */
#ifdef __A_OUT_GNU_H__
#define SIZEOF_HEADER(PIECE) (sizeof (((struct exec_bytes *) 0)->PIECE))
#else
#define SIZEOF_HEADER(PIECE) 4
#endif
#define DO(PIECE) \
md_number_to_chars (p, headers->header.PIECE, SIZEOF_HEADER (PIECE)); \
p += SIZEOF_HEADER (PIECE);
p = *where;
DO (a_info);
DO (a_text);
DO (a_data);
DO (a_bss);
DO (a_syms);
DO (a_entry);
DO (a_trsize);
DO (a_drsize);
*where = p;
#undef DO
#undef SIZEOF_HEADER
}
#endif /* ! defined (obj_header_append) */
@ -303,11 +306,17 @@ obj_symbol_to_chars (where, symbolP)
char **where;
symbolS *symbolP;
{
md_number_to_chars ((char *) &(S_GET_OFFSET (symbolP)), S_GET_OFFSET (symbolP), sizeof (S_GET_OFFSET (symbolP)));
md_number_to_chars ((char *) &(S_GET_DESC (symbolP)), S_GET_DESC (symbolP), sizeof (S_GET_DESC (symbolP)));
md_number_to_chars ((char *) &(symbolP->sy_symbol.n_value), S_GET_VALUE (symbolP), sizeof (symbolP->sy_symbol.n_value));
append (where, (char *) &symbolP->sy_symbol, sizeof (obj_symbol_type));
char *p = *where;
md_number_to_chars (p, S_GET_OFFSET (symbolP), 4);
p += 4;
/* Can't use S_GET_TYPE here as it masks. */
*p++ = symbolP->sy_symbol.n_type;
*p++ = symbolP->sy_symbol.n_other;
md_number_to_chars (p, S_GET_DESC (symbolP), 2);
p += 2;
md_number_to_chars (p, S_GET_VALUE (symbolP), 4);
p += 4;
*where = p;
}
void
@ -538,18 +547,13 @@ obj_emit_strings (where)
{
symbolS *symbolP;
#ifdef CROSS_COMPILE
/* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
md_number_to_chars (*where, string_byte_count, sizeof (string_byte_count));
*where += sizeof (string_byte_count);
#else /* CROSS_COMPILE */
append (where, (char *) &string_byte_count, (unsigned long) sizeof (string_byte_count));
#endif /* CROSS_COMPILE */
md_number_to_chars (*where, string_byte_count, 4);
*where += 4;
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{
if (S_GET_NAME (symbolP))
append (&next_object_file_charP, S_GET_NAME (symbolP),
append (where, S_GET_NAME (symbolP),
(unsigned long) (strlen (S_GET_NAME (symbolP)) + 1));
} /* walk symbol chain */
}

View file

@ -1,6 +1,6 @@
/* obj-aout.h, a.out object file format for gas, the assembler.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000,
2002, 2003 Free Software Foundation, Inc.
2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@ -177,9 +177,10 @@ extern void obj_aout_frob_file_before_fix PARAMS ((void));
#define H_GET_FILE_SIZE(h) (H_GET_HEADER_SIZE(h) \
+ H_GET_TEXT_SIZE(h) \
+ H_GET_DATA_SIZE(h) \
+ H_GET_SYMBOL_TABLE_SIZE(h) \
+ H_GET_TEXT_RELOCATION_SIZE(h) \
+ H_GET_DATA_RELOCATION_SIZE(h) \
+ H_GET_LINENO_SIZE(h) \
+ H_GET_SYMBOL_TABLE_SIZE(h) \
+ H_GET_STRING_SIZE(h))
#define H_GET_HEADER_SIZE(h) (EXEC_BYTES_SIZE)

View file

@ -1,6 +1,6 @@
/* b.out object file format
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002
Free Software Foundation, Inc.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002,
2005 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@ -105,7 +105,7 @@ obj_emit_relocations (where, fixP, segment_address_in_file)
fixP->fx_addsy = sym;
tc_bout_fix_to_chars (*where, fixP, segment_address_in_file);
*where += sizeof (struct relocation_info);
*where += md_reloc_size;
} /* if there's a symbol */
} /* for each fixup */
}
@ -120,6 +120,7 @@ obj_header_append (where, headers)
object_headers *headers;
{
/* Always leave in host byte order. */
char *p;
headers->header.a_talign = section_alignment[SEG_TEXT];
@ -138,38 +139,32 @@ obj_header_append (where, headers)
headers->header.a_relaxable = linkrelax;
#ifdef CROSS_COMPILE
md_number_to_chars (*where, headers->header.a_magic, sizeof (headers->header.a_magic));
*where += sizeof (headers->header.a_magic);
md_number_to_chars (*where, headers->header.a_text, sizeof (headers->header.a_text));
*where += sizeof (headers->header.a_text);
md_number_to_chars (*where, headers->header.a_data, sizeof (headers->header.a_data));
*where += sizeof (headers->header.a_data);
md_number_to_chars (*where, headers->header.a_bss, sizeof (headers->header.a_bss));
*where += sizeof (headers->header.a_bss);
md_number_to_chars (*where, headers->header.a_syms, sizeof (headers->header.a_syms));
*where += sizeof (headers->header.a_syms);
md_number_to_chars (*where, headers->header.a_entry, sizeof (headers->header.a_entry));
*where += sizeof (headers->header.a_entry);
md_number_to_chars (*where, headers->header.a_trsize, sizeof (headers->header.a_trsize));
*where += sizeof (headers->header.a_trsize);
md_number_to_chars (*where, headers->header.a_drsize, sizeof (headers->header.a_drsize));
*where += sizeof (headers->header.a_drsize);
md_number_to_chars (*where, headers->header.a_tload, sizeof (headers->header.a_tload));
*where += sizeof (headers->header.a_tload);
md_number_to_chars (*where, headers->header.a_dload, sizeof (headers->header.a_dload));
*where += sizeof (headers->header.a_dload);
md_number_to_chars (*where, headers->header.a_talign, sizeof (headers->header.a_talign));
*where += sizeof (headers->header.a_talign);
md_number_to_chars (*where, headers->header.a_dalign, sizeof (headers->header.a_dalign));
*where += sizeof (headers->header.a_dalign);
md_number_to_chars (*where, headers->header.a_balign, sizeof (headers->header.a_balign));
*where += sizeof (headers->header.a_balign);
md_number_to_chars (*where, headers->header.a_relaxable, sizeof (headers->header.a_relaxable));
*where += sizeof (headers->header.a_relaxable);
#else /* ! CROSS_COMPILE */
append (where, (char *) &headers->header, sizeof (headers->header));
#endif /* ! CROSS_COMPILE */
p = *where;
host_number_to_chars (p, headers->header.a_magic, 4);
p += 4;
host_number_to_chars (p, headers->header.a_text, 4);
p += 4;
host_number_to_chars (p, headers->header.a_data, 4);
p += 4;
host_number_to_chars (p, headers->header.a_bss, 4);
p += 4;
host_number_to_chars (p, headers->header.a_syms, 4);
p += 4;
host_number_to_chars (p, headers->header.a_entry, 4);
p += 4;
host_number_to_chars (p, headers->header.a_trsize, 4);
p += 4;
host_number_to_chars (p, headers->header.a_drsize, 4);
p += 4;
host_number_to_chars (p, headers->header.a_tload, 4);
p += 4;
host_number_to_chars (p, headers->header.a_dload, 4);
p += 4;
*p++ = headers->header.a_talign;
*p++ = headers->header.a_dalign;
*p++ = headers->header.a_balign;
*p++ = headers->header.a_relaxable;
*where = p;
}
void
@ -177,19 +172,17 @@ obj_symbol_to_chars (where, symbolP)
char **where;
symbolS *symbolP;
{
md_number_to_chars ((char *) &(S_GET_OFFSET (symbolP)),
S_GET_OFFSET (symbolP),
sizeof (S_GET_OFFSET (symbolP)));
md_number_to_chars ((char *) &(S_GET_DESC (symbolP)),
S_GET_DESC (symbolP),
sizeof (S_GET_DESC (symbolP)));
md_number_to_chars ((char *) &symbolP->sy_symbol.n_value,
S_GET_VALUE (symbolP),
sizeof (symbolP->sy_symbol.n_value));
append (where, (char *) &symbolP->sy_symbol, sizeof (obj_symbol_type));
char *p = *where;
host_number_to_chars (p, S_GET_OFFSET (symbolP), 4);
p += 4;
/* Can't use S_GET_TYPE here as it masks. */
*p++ = symbolP->sy_symbol.n_type;
*p++ = symbolP->sy_symbol.n_other;
host_number_to_chars (p, S_GET_DESC (symbolP), 2);
p += 2;
host_number_to_chars (p, S_GET_VALUE (symbolP), 4);
p += 4;
*where = p;
}
void
@ -336,14 +329,8 @@ obj_emit_strings (where)
{
symbolS *symbolP;
#ifdef CROSS_COMPILE
/* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
md_number_to_chars (*where, string_byte_count, sizeof (string_byte_count));
*where += sizeof (string_byte_count);
#else /* CROSS_COMPILE */
append (where, (char *) &string_byte_count,
(unsigned long) sizeof (string_byte_count));
#endif /* CROSS_COMPILE */
md_number_to_chars (*where, string_byte_count, 4);
*where += 4;
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{

View file

@ -1,6 +1,6 @@
/* b.out object file format
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000,
2002, 2003 Free Software Foundation, Inc.
2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@ -106,8 +106,10 @@ struct exec
unsigned char a_relaxable; /* Contains enough info to relax */
};
#define EXEC_BYTES_SIZE (10 * 4 + 4 * 1)
#define N_BADMAG(x) (((x).a_magic)!=BMAGIC)
#define N_TXTOFF(x) ( sizeof (struct exec) )
#define N_TXTOFF(x) EXEC_BYTES_SIZE
#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text )
#define N_TROFF(x) ( N_DATOFF(x) + (x).a_data )
#define N_DROFF(x) ( N_TROFF(x) + (x).a_trsize )
@ -245,14 +247,14 @@ struct relocation_info
/* File header macro and type definition */
#define H_GET_FILE_SIZE(h) (sizeof (struct exec) + \
#define H_GET_FILE_SIZE(h) (EXEC_BYTES_SIZE + \
H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
H_GET_SYMBOL_TABLE_SIZE(h) + \
H_GET_TEXT_RELOCATION_SIZE(h) + \
H_GET_DATA_RELOCATION_SIZE(h) + \
(h)->string_table_size)
#define H_GET_HEADER_SIZE(h) (sizeof (struct exec))
#define H_GET_HEADER_SIZE(h) EXEC_BYTES_SIZE
#define H_GET_TEXT_SIZE(h) ((h)->header.a_text)
#define H_GET_DATA_SIZE(h) ((h)->header.a_data)
#define H_GET_BSS_SIZE(h) ((h)->header.a_bss)
@ -280,8 +282,7 @@ struct relocation_info
#define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v))
#define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v))
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \
sizeof (struct nlist))
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * 12)
#define H_SET_MAGIC_NUMBER(h,v) ((h)->header.a_magic = (v))
@ -306,6 +307,12 @@ object_headers;
#define OBJ_EMIT_LINENO(a, b, c) {;}
#define obj_pre_write_hook(a) {;}
#if WORDS_BIGENDIAN
#define host_number_to_chars number_to_chars_bigendian
#else
#define host_number_to_chars number_to_chars_littleendian
#endif
#if __STDC__
struct fix;
#endif

View file

@ -1,5 +1,5 @@
/* This file is obj-hp300.h
Copyright 1993, 2000 Free Software Foundation, Inc.
Copyright 1993, 2000, 2005 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@ -30,8 +30,9 @@ hp300_header_append (where, headers)
#define DO(FIELD) \
{ \
md_number_to_chars (*where, headers->header.FIELD, sizeof (headers->header.FIELD)); \
*where += sizeof (headers->header.FIELD); \
md_number_to_chars (*where, headers->header.FIELD, \
sizeof (((struct exec_bytes *) 0)->FIELD)); \
*where += sizeof (((struct exec_bytes *) 0)->FIELD); \
}
DO (a_info);

View file

@ -859,7 +859,7 @@ md_number_to_field (instrP, val, bfixP)
/* Surprise! -- we stored the number of bits to be modified rather
than a pointer to a structure. */
numbits = (int) bfixP;
numbits = (int) (size_t) bfixP;
if (numbits == 1)
{
/* This is a no-op, stuck here by reloc_callj() */
@ -1116,9 +1116,6 @@ md_estimate_size_before_relax (fragP, segment_type)
executable code is actually downloaded to the i80960). Therefore,
we leave it in host byte order.
The above comment is no longer true. This routine now really
does do the reordering (Ian Taylor 28 Aug 92).
*************************************************************************** */
static void md_ri_to_chars PARAMS ((char *, struct relocation_info *));
@ -1127,17 +1124,25 @@ md_ri_to_chars (where, ri)
char *where;
struct relocation_info *ri;
{
md_number_to_chars (where, ri->r_address,
sizeof (ri->r_address));
where[4] = ri->r_index & 0x0ff;
where[5] = (ri->r_index >> 8) & 0x0ff;
where[6] = (ri->r_index >> 16) & 0x0ff;
where[7] = ((ri->r_pcrel << 0)
| (ri->r_length << 1)
| (ri->r_extern << 3)
| (ri->r_bsr << 4)
| (ri->r_disp << 5)
| (ri->r_callj << 6));
host_number_to_chars (where, ri->r_address, 4);
host_number_to_chars (where + 4, ri->r_index, 3);
#if WORDS_BIGENDIAN
where[7] = (ri->r_pcrel << 7
| ri->r_length << 5
| ri->r_extern << 4
| ri->r_bsr << 3
| ri->r_disp << 2
| ri->r_callj << 1
| ri->nuthin << 0);
#else
where[7] = (ri->r_pcrel << 0
| ri->r_length << 1
| ri->r_extern << 3
| ri->r_bsr << 4
| ri->r_disp << 5
| ri->r_callj << 6
| ri->nuthin << 7);
#endif
}
#endif /* defined(OBJ_AOUT) | defined(OBJ_BOUT) */
@ -1508,7 +1513,7 @@ get_cdisp (dispP, ifmtP, instr, numbits, var_frag, callj)
* bit_fix structure. So we're going to lie and store
* the number of bits affected instead of a pointer.
*/
fixP->fx_bit_fixP = (bit_fixS *) numbits;
fixP->fx_bit_fixP = (bit_fixS *) (size_t) numbits;
}
}
else
@ -2832,7 +2837,7 @@ md_apply_fix3 (fixP, valP, seg)
md_number_to_imm (place, val, fixP->fx_size);
}
else if ((int) fixP->fx_bit_fixP == 13
else if ((int) (size_t) fixP->fx_bit_fixP == 13
&& fixP->fx_addsy != NULL
&& S_GET_SEGMENT (fixP->fx_addsy) == undefined_section)
{

232
gas/configure vendored
View file

@ -4129,6 +4129,238 @@ case "${host}" in
esac
#We need this for the host. BOUT header is in host order.
echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
if test "${ac_cv_c_bigendian+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# See if sys/param.h defines the BYTE_ORDER macro.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/param.h>
int
main ()
{
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
# It does; now see whether it defined to BIG_ENDIAN or not.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/param.h>
int
main ()
{
#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_c_bigendian=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_c_bigendian=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# It does not; compile a test program.
if test "$cross_compiling" = yes; then
# try to guess the endianness by grepping values into an object file
ac_cv_c_bigendian=unknown
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
int
main ()
{
_ascii (); _ebcdic ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
ac_cv_c_bigendian=yes
fi
if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
if test "$ac_cv_c_bigendian" = unknown; then
ac_cv_c_bigendian=no
else
# finding both strings is unlikely to happen, but who knows?
ac_cv_c_bigendian=unknown
fi
fi
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
/* Are we little or big endian? From Harbison&Steele. */
union
{
long l;
char c[sizeof (long)];
} u;
u.l = 1;
exit (u.c[sizeof (long) - 1] == 1);
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_c_bigendian=no
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_c_bigendian=yes
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
echo "${ECHO_T}$ac_cv_c_bigendian" >&6
case $ac_cv_c_bigendian in
yes)
cat >>confdefs.h <<\_ACEOF
#define WORDS_BIGENDIAN 1
_ACEOF
;;
no)
;;
*)
{ { echo "$as_me:$LINENO: error: unknown endianness
presetting ac_cv_c_bigendian=no (or yes) will help" >&5
echo "$as_me: error: unknown endianness
presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
te_file=generic
# Makefile target for installing gas in $(tooldir)/bin.

View file

@ -86,6 +86,9 @@ case "${host}" in
esac
AC_SUBST(GDBINIT)
#We need this for the host. BOUT header is in host order.
AC_C_BIGENDIAN
te_file=generic
# Makefile target for installing gas in $(tooldir)/bin.

View file

@ -1569,11 +1569,11 @@ write_object_file (void)
Count the number of string-table chars we will emit.
Put this info into the headers as appropriate. */
know (zero_address_frag.fr_address == 0);
string_byte_count = sizeof (string_byte_count);
string_byte_count = 4;
obj_crawl_symbol_chain (&headers);
if (string_byte_count == sizeof (string_byte_count))
if (string_byte_count == 4)
string_byte_count = 0;
H_SET_STRING_SIZE (&headers, string_byte_count);