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 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.
#include <signal.h>
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
#include <a.out.h>
#else
#include "mips/a.out.h"
-#endif /* CROSS_COMPILE */
+#endif /* CROSS_DIRECTORY_STRUCTURE */
#include "gstab.h"
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);
return;
if (debug)
- fprintf (stderr, "\twarray\tvp = " HOST_PTR_PRINTF
- ", offset = %7lu, size = %7lu, %s\n",
+ fprintf (stderr, "\twarray\tvp = %p, offset = %7lu, size = %7lu, %s\n",
(void *) vp, (unsigned long) offset,
vp->num_allocated * vp->object_size, str);
off_t offset;
if (debug)
- fprintf (stderr, "\n\twrite\tvp = " HOST_PTR_PRINTF
- ", offset = %7u, size = %7lu, %s\n",
+ fprintf (stderr, "\n\twrite\tvp = %p, offset = %7u, size = %7lu, %s\n",
(void *) &symbolic_header, 0,
(unsigned long) sizeof (symbolic_header), "symbolic header");
pfatal_with_name (object_name);
if (debug)
- fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF
- ", offset = %7lu, size = %7lu, %s\n",
+ fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n",
(void *) &orig_linenum, (long) symbolic_header.cbLineOffset,
(long) symbolic_header.cbLine, "Line numbers");
pfatal_with_name (object_name);
if (debug)
- fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF
- ", offset = %7lu, size = %7lu, %s\n",
+ fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n",
(void *) &orig_opt_syms, (long) symbolic_header.cbOptOffset,
num_write, "Optimizer symbols");
file_ptr = file_ptr->next_file)
{
if (debug)
- fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF
- ", offset = %7lu, size = %7lu, %s\n",
+ fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n",
(void *) &file_ptr->fdr, file_offset,
(unsigned long) sizeof (FDR), "File header");
pfatal_with_name (object_name);
if (debug)
- fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF
- ", offset = %7lu, size = %7lu, %s\n",
+ fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n",
(void *) &orig_rfds, (long) symbolic_header.cbRfdOffset,
num_write, "Relative file descriptors");
/* Read in each of the sections if they exist in the object file.
- We read things in in the order the mips assembler creates the
+ We read things in the order the mips assembler creates the
sections, so in theory no extra seeks are done.
For simplicity sake, round each read up to a page boundary,
if (version)
{
printf (_("mips-tfile (GCC) %s\n"), version_string);
- fputs ("Copyright (C) 2004 Free Software Foundation, Inc.\n", stdout);
+ fputs ("Copyright (C) 2006 Free Software Foundation, Inc.\n", stdout);
fputs (_("This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"),
stdout);
pfatal_with_name ("allocate_cluster");
if (debug > 3)
- fprintf (stderr, "\talloc\tnpages = %lu, value = " HOST_PTR_PRINTF "\n",
+ fprintf (stderr, "\talloc\tnpages = %lu, value = %p\n",
(unsigned long) npages, (void *) ptr);
return ptr;