aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2003-06-09 06:55:15 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2003-06-09 06:55:15 +0000
commit20db0e3c83848146de105a34a5fc35f7383731b5 (patch)
tree5b78c9b75f15af63343c14de43c1814712f0ee79
parentaa9dc53d0d9d80cd6c77f2db7cb23bfebf3e9c34 (diff)
downloadgcc-20db0e3c83848146de105a34a5fc35f7383731b5.zip
gcc-20db0e3c83848146de105a34a5fc35f7383731b5.tar.gz
gcc-20db0e3c83848146de105a34a5fc35f7383731b5.tar.bz2
re PR target/10913 (mips-elf ICE in text_section at varasm.c: 241)
PR target/10913 * config/mips/mips.h (TARGET_FILE_SWITCHING, NO_DBX_FUNCTION_END, PUT_SDB_SCL, PUT_SDB_INT_VAL, PUT_SDB_VAL, PUT_SDB_ENDEF, PUT_SDB_TYPE, PUT_SDB_SIZE, PUT_SDB_DIM, PUT_SDB_START_DIM, PUT_SDB_NEXT_DIM, PUT_SDB_LAST_DIM, PUT_SDB_TAG, PUT_SDB_SRC_FILE, SDB_GENERATE_FAKE, TEXT_SECTION): Delete. (PUT_SDB_DEF, PUT_SDB_PLAIN_DEF, PUT_SDB_BLOCK_START, PUT_SDB_BLOCK_END, PUT_SDB_FUNCTION_END): Replace use of asm_out_text_file with asm_out_file. * config/mips/iris5gas.h (PUT_SDB_SIZE, PUT_SDB_TYPE): Likewise. * config/mips/elf.h (TEXT_SECTION): Undefine. * config/mips/elf64.h (TEXT_SECION): Undefine. * config/mips/openbsd.h (TEXT_SECION): Undefine. * config/mips/mips.c (asm_out_text_file, asm_out_data_file): Delete. (override_options): Disable small-data optimizations unless using gas or explicit relocations. (mips_asm_file_start, mips_asm_file_end, mips_output_function_epilogue, iris6_asm_named_section, iris6_asm_file_start): Remove code for handling TARGET_FILE_SWITCHING. (copy_file_data): Move into TARGET_IRIX6 block. From-SVN: r67653
-rw-r--r--gcc/ChangeLog23
-rw-r--r--gcc/config/mips/elf.h13
-rw-r--r--gcc/config/mips/elf64.h13
-rw-r--r--gcc/config/mips/iris5gas.h16
-rw-r--r--gcc/config/mips/mips.c95
-rw-r--r--gcc/config/mips/mips.h131
-rw-r--r--gcc/config/mips/openbsd.h13
7 files changed, 71 insertions, 233 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 23a4ae5..da62392 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,26 @@
+2003-06-09 Richard Sandiford <rsandifo@redhat.com>
+
+ PR target/10913
+ * config/mips/mips.h (TARGET_FILE_SWITCHING, NO_DBX_FUNCTION_END,
+ PUT_SDB_SCL, PUT_SDB_INT_VAL, PUT_SDB_VAL, PUT_SDB_ENDEF,
+ PUT_SDB_TYPE, PUT_SDB_SIZE, PUT_SDB_DIM, PUT_SDB_START_DIM,
+ PUT_SDB_NEXT_DIM, PUT_SDB_LAST_DIM, PUT_SDB_TAG, PUT_SDB_SRC_FILE,
+ SDB_GENERATE_FAKE, TEXT_SECTION): Delete.
+ (PUT_SDB_DEF, PUT_SDB_PLAIN_DEF, PUT_SDB_BLOCK_START,
+ PUT_SDB_BLOCK_END, PUT_SDB_FUNCTION_END): Replace use of
+ asm_out_text_file with asm_out_file.
+ * config/mips/iris5gas.h (PUT_SDB_SIZE, PUT_SDB_TYPE): Likewise.
+ * config/mips/elf.h (TEXT_SECTION): Undefine.
+ * config/mips/elf64.h (TEXT_SECION): Undefine.
+ * config/mips/openbsd.h (TEXT_SECION): Undefine.
+ * config/mips/mips.c (asm_out_text_file, asm_out_data_file): Delete.
+ (override_options): Disable small-data optimizations unless using
+ gas or explicit relocations.
+ (mips_asm_file_start, mips_asm_file_end, mips_output_function_epilogue,
+ iris6_asm_named_section, iris6_asm_file_start): Remove code for
+ handling TARGET_FILE_SWITCHING.
+ (copy_file_data): Move into TARGET_IRIX6 block.
+
2003-06-08 Richard Henderson <rth@redhat.com>
* expr.h (EXPAND_MEMORY): New.
diff --git a/gcc/config/mips/elf.h b/gcc/config/mips/elf.h
index 8826fa0..4c3b9cf 100644
--- a/gcc/config/mips/elf.h
+++ b/gcc/config/mips/elf.h
@@ -48,19 +48,6 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_ASM_NAMED_SECTION
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
-/* Given that Irix has it's own headers, not having TARGET_GAS here
- seems a mistake. If we actually need to be prepared for file
- switching, then we need a custom TARGET_ASM_NAMED_SECTION too. */
-
-#undef TEXT_SECTION
-#define TEXT_SECTION() \
-do { \
- if (TARGET_FILE_SWITCHING) \
- abort (); \
- fputs (TEXT_SECTION_ASM_OP, asm_out_file); \
- fputc ('\n', asm_out_file); \
-} while (0)
-
/* The following macro defines the format used to output the second
operand of the .type assembler directive. Different svr4 assemblers
expect various different forms for this operand. The one given here
diff --git a/gcc/config/mips/elf64.h b/gcc/config/mips/elf64.h
index eb12237..9328d47 100644
--- a/gcc/config/mips/elf64.h
+++ b/gcc/config/mips/elf64.h
@@ -45,19 +45,6 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_ASM_NAMED_SECTION
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
-/* Given that Irix has it's own headers, not having TARGET_GAS here
- seems a mistake. If we actually need to be prepared for file
- switching, then we need a custom TARGET_ASM_NAMED_SECTION too. */
-
-#undef TEXT_SECTION
-#define TEXT_SECTION() \
-do { \
- if (TARGET_FILE_SWITCHING) \
- abort (); \
- fputs (TEXT_SECTION_ASM_OP, asm_out_file); \
- fputc ('\n', asm_out_file); \
-} while (0)
-
/* The following macro defines the format used to output the second
operand of the .type assembler directive. Different svr4 assemblers
expect various different forms for this operand. The one given here
diff --git a/gcc/config/mips/iris5gas.h b/gcc/config/mips/iris5gas.h
index 30c3a04..c1ec6eb 100644
--- a/gcc/config/mips/iris5gas.h
+++ b/gcc/config/mips/iris5gas.h
@@ -50,18 +50,16 @@ crtbegin.o%s"
avoid conflicting with ELF directives. These are only recognized
by gas, anyhow, not the native assembler. */
#undef PUT_SDB_SIZE
-#define PUT_SDB_SIZE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.esize\t" HOST_WIDE_INT_PRINT_DEC ";", \
- (HOST_WIDE_INT) (a)); \
+#define PUT_SDB_SIZE(a) \
+do { \
+ fprintf (asm_out_file, "\t.esize\t" HOST_WIDE_INT_PRINT_DEC ";", \
+ (HOST_WIDE_INT) (a)); \
} while (0)
#undef PUT_SDB_TYPE
-#define PUT_SDB_TYPE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
+#define PUT_SDB_TYPE(a) \
+do { \
+ fprintf (asm_out_file, "\t.etype\t0x%x;", (a)); \
} while (0)
/* Switch into a generic section. */
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index af2bbf3..17bfd2b 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -262,8 +262,8 @@ static bool mips_matching_cpu_name_p PARAMS ((const char *,
static const struct mips_cpu_info *mips_parse_cpu PARAMS ((const char *,
const char *));
static const struct mips_cpu_info *mips_cpu_info_from_isa PARAMS ((int));
-static void copy_file_data PARAMS ((FILE *, FILE *));
#ifdef TARGET_IRIX6
+static void copy_file_data PARAMS ((FILE *, FILE *));
static void iris6_asm_named_section_1 PARAMS ((const char *,
unsigned int,
unsigned int));
@@ -448,12 +448,6 @@ int sym_lineno = 0;
handle .files inside of functions. */
int inside_function = 0;
-/* Files to separate the text and the data output, so that all of the data
- can be emitted before the text, which will mean that the assembler will
- generate smaller code, based on the global pointer. */
-FILE *asm_out_data_file;
-FILE *asm_out_text_file;
-
/* Linked list of all externals that are to be emitted when optimizing
for the global pointer if they haven't been declared by the end of
the program with an appropriate .comm or initialization. */
@@ -5411,6 +5405,16 @@ override_options ()
else
mips_abicalls = MIPS_ABICALLS_NO;
+ /* The MIPS and SGI o32 assemblers expect small-data variables to
+ be declared before they are used. Although we once had code to
+ do this, it was very invasive and fragile. It no longer seems
+ worth the effort. */
+ if (!TARGET_EXPLICIT_RELOCS && !TARGET_GAS)
+ {
+ mips_section_threshold = 0;
+ target_flags &= ~MASK_GPOPT;
+ }
+
/* -membedded-pic is a form of PIC code suitable for embedded
systems. All calls are made using PC relative addressing, and
all data is addressed using the $gp register. This requires gas,
@@ -6536,17 +6540,6 @@ mips_asm_file_start (stream)
if (TARGET_MIPS16)
fprintf (stream, "\t.set\tmips16\n");
- /* This code exists so that we can put all externs before all symbol
- references. This is necessary for the MIPS assembler's global pointer
- optimizations to work. */
- if (TARGET_FILE_SWITCHING)
- {
- asm_out_data_file = stream;
- asm_out_text_file = tmpfile ();
- }
- else
- asm_out_data_file = asm_out_text_file = stream;
-
if (flag_verbose_asm)
fprintf (stream, "\n%s -G value = %d, Arch = %s, ISA = %d\n",
ASM_COMMENT_START,
@@ -6589,33 +6582,6 @@ mips_file_end ()
}
}
}
-
- if (TARGET_FILE_SWITCHING)
- {
- fputs ("\n\t.text\n", asm_out_file);
- copy_file_data (asm_out_file, asm_out_text_file);
- }
-}
-
-static void
-copy_file_data (to, from)
- FILE *to, *from;
-{
- char buffer[8192];
- size_t len;
- rewind (from);
- if (ferror (from))
- fatal_error ("can't rewind temp file: %m");
-
- while ((len = fread (buffer, 1, sizeof (buffer), from)) > 0)
- if (fwrite (buffer, 1, len, to) != len)
- fatal_error ("can't write to output file: %m");
-
- if (ferror (from))
- fatal_error ("can't read from temp file: %m");
-
- if (fclose (from))
- fatal_error ("can't close temp file: %m");
}
/* Emit either a label, .comm, or .lcomm directive, and mark that the symbol
@@ -7849,15 +7815,6 @@ mips_output_function_epilogue (file, size)
for (string = mips16_strings; string != 0; string = XEXP (string, 1))
SYMBOL_REF_FLAG (XEXP (string, 0)) = 0;
free_EXPR_LIST_list (&mips16_strings);
-
- /* Restore the output file if optimizing the GP (optimizing the GP causes
- the text to be diverted to a tempfile, so that data decls come before
- references to the data). */
- if (TARGET_FILE_SWITCHING)
- {
- asm_out_file = asm_out_data_file;
- data_section ();
- }
}
/* Expand the epilogue into a bunch of separate insns. SIBCALL_P is true
@@ -10623,8 +10580,6 @@ iris6_asm_named_section (name, flags)
const char *name;
unsigned int flags;
{
- if (TARGET_FILE_SWITCHING && (flags & SECTION_CODE))
- asm_out_file = asm_out_text_file;
iris6_asm_named_section_1 (name, flags, 0);
}
@@ -10691,8 +10646,8 @@ iris6_asm_output_align (file, log)
}
/* The Iris assembler does not record alignment from .align directives,
- but takes it from the first .section directive seen. Play yet more
- file switching games so that we can emit a .section directive at the
+ but takes it from the first .section directive seen. Play file
+ switching games so that we can emit a .section directive at the
beginning of the file with the proper alignment attached. */
void
@@ -10704,9 +10659,6 @@ iris6_asm_file_start (stream)
iris_orig_asm_out_file = asm_out_file;
stream = tmpfile ();
asm_out_file = stream;
- asm_out_data_file = stream;
- if (! TARGET_FILE_SWITCHING)
- asm_out_text_file = stream;
iris_section_align_htab = htab_create (31, iris_section_align_entry_hash,
iris_section_align_entry_eq, NULL);
@@ -10725,6 +10677,27 @@ iris6_section_align_1 (slot, data)
}
static void
+copy_file_data (to, from)
+ FILE *to, *from;
+{
+ char buffer[8192];
+ size_t len;
+ rewind (from);
+ if (ferror (from))
+ fatal_error ("can't rewind temp file: %m");
+
+ while ((len = fread (buffer, 1, sizeof (buffer), from)) > 0)
+ if (fwrite (buffer, 1, len, to) != len)
+ fatal_error ("can't write to output file: %m");
+
+ if (ferror (from))
+ fatal_error ("can't read from temp file: %m");
+
+ if (fclose (from))
+ fatal_error ("can't close temp file: %m");
+}
+
+static void
iris6_file_end ()
{
/* Emit section directives with the proper alignment at the top of the
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index abc3e4f..fc4177a 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -307,12 +307,6 @@ extern void sbss_section PARAMS ((void));
#define TARGET_EXPLICIT_RELOCS (target_flags & MASK_EXPLICIT_RELOCS)
-/* This is true if we must enable the assembly language file switching
- code. */
-
-#define TARGET_FILE_SWITCHING \
- (TARGET_GP_OPT && ! TARGET_GAS && ! TARGET_MIPS16)
-
/* True if the call patterns should be split into a jalr followed by
an instruction to restore $gp. This is only ever true for SVR4 PIC,
in which $gp is call-clobbered. It is only safe to split the load
@@ -342,12 +336,6 @@ extern void sbss_section PARAMS ((void));
#define TARGET_GPWORD (TARGET_ABICALLS && (!TARGET_NEWABI || TARGET_GAS))
-
-/* We must disable the function end stabs when doing the file switching trick,
- because the Lscope stabs end up in the wrong place, making it impossible
- to debug the resulting code. */
-#define NO_DBX_FUNCTION_END TARGET_FILE_SWITCHING
-
/* Generate mips16 code */
#define TARGET_MIPS16 (target_flags & MASK_MIPS16)
@@ -1370,101 +1358,20 @@ extern int mips_abi;
#define FIND_BASE_TERM(X) mips_delegitimize_address (X)
-/* Overrides for the COFF debug format. */
-#define PUT_SDB_SCL(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.scl\t%d;", (a)); \
-} while (0)
-
-#define PUT_SDB_INT_VAL(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.val\t" HOST_WIDE_INT_PRINT_DEC ";", \
- (HOST_WIDE_INT)(a)); \
-} while (0)
-
-#define PUT_SDB_VAL(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fputs ("\t.val\t", asm_out_text_file); \
- output_addr_const (asm_out_text_file, (a)); \
- fputc (';', asm_out_text_file); \
-} while (0)
-
#define PUT_SDB_DEF(a) \
do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t%s.def\t", \
+ fprintf (asm_out_file, "\t%s.def\t", \
(TARGET_GAS) ? "" : "#"); \
- ASM_OUTPUT_LABELREF (asm_out_text_file, a); \
- fputc (';', asm_out_text_file); \
+ ASM_OUTPUT_LABELREF (asm_out_file, a); \
+ fputc (';', asm_out_file); \
} while (0)
#define PUT_SDB_PLAIN_DEF(a) \
do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t%s.def\t.%s;", \
+ fprintf (asm_out_file, "\t%s.def\t.%s;", \
(TARGET_GAS) ? "" : "#", (a)); \
} while (0)
-#define PUT_SDB_ENDEF \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.endef\n"); \
-} while (0)
-
-#define PUT_SDB_TYPE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.type\t0x%x;", (a)); \
-} while (0)
-
-#define PUT_SDB_SIZE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.size\t" HOST_WIDE_INT_PRINT_DEC ";", \
- (HOST_WIDE_INT)(a)); \
-} while (0)
-
-#define PUT_SDB_DIM(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.dim\t%d;", (a)); \
-} while (0)
-
-#ifndef PUT_SDB_START_DIM
-#define PUT_SDB_START_DIM \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.dim\t"); \
-} while (0)
-#endif
-
-#ifndef PUT_SDB_NEXT_DIM
-#define PUT_SDB_NEXT_DIM(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "%d,", a); \
-} while (0)
-#endif
-
-#ifndef PUT_SDB_LAST_DIM
-#define PUT_SDB_LAST_DIM(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "%d;", a); \
-} while (0)
-#endif
-
-#define PUT_SDB_TAG(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.tag\t"); \
- ASM_OUTPUT_LABELREF (asm_out_text_file, a); \
- fputc (';', asm_out_text_file); \
-} while (0)
-
/* For block start and end, we create labels, so that
later we can figure out where the correct offset is.
The normal .ent/.end serve well enough for functions,
@@ -1472,8 +1379,7 @@ do { \
#define PUT_SDB_BLOCK_START(LINE) \
do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, \
+ fprintf (asm_out_file, \
"%sLb%d:\n\t%s.begin\t%sLb%d\t%d\n", \
LOCAL_LABEL_PREFIX, \
sdb_label_count, \
@@ -1486,8 +1392,7 @@ do { \
#define PUT_SDB_BLOCK_END(LINE) \
do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, \
+ fprintf (asm_out_file, \
"%sLe%d:\n\t%s.bend\t%sLe%d\t%d\n", \
LOCAL_LABEL_PREFIX, \
sdb_label_count, \
@@ -1502,21 +1407,11 @@ do { \
#define PUT_SDB_FUNCTION_END(LINE) \
do { \
- extern FILE *asm_out_text_file; \
- ASM_OUTPUT_SOURCE_LINE (asm_out_text_file, LINE + sdb_begin_function_line); \
+ ASM_OUTPUT_SOURCE_LINE (asm_out_file, LINE + sdb_begin_function_line); \
} while (0)
#define PUT_SDB_EPILOGUE_END(NAME)
-#define PUT_SDB_SRC_FILE(FILENAME) \
-do { \
- extern FILE *asm_out_text_file; \
- output_file_directive (asm_out_text_file, (FILENAME));\
-} while (0)
-
-#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
- sprintf ((BUFFER), ".%dfake", (NUMBER));
-
/* Correct the offset of automatic variables and arguments. Note that
the MIPS debug format wants all automatic variables and arguments
to be in terms of the virtual frame pointer (stack pointer before
@@ -3930,18 +3825,6 @@ while (0)
#define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \
mips_output_external(STREAM,DECL,NAME)
-/* Play switch file games if we're optimizing the global pointer. */
-
-#undef TEXT_SECTION
-#define TEXT_SECTION() \
-do { \
- extern FILE *asm_out_text_file; \
- if (TARGET_FILE_SWITCHING) \
- asm_out_file = asm_out_text_file; \
- fputs (TEXT_SECTION_ASM_OP, asm_out_file); \
- fputc ('\n', asm_out_file); \
-} while (0)
-
/* This is how to declare a function name. The actual work of
emitting the label is moved to function_prologue, so that we can
diff --git a/gcc/config/mips/openbsd.h b/gcc/config/mips/openbsd.h
index 8b1c124..a61aac0 100644
--- a/gcc/config/mips/openbsd.h
+++ b/gcc/config/mips/openbsd.h
@@ -110,19 +110,6 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_ASM_NAMED_SECTION
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
-/* Not having TARGET_GAS here seems a mistake. If we actually need to
- be prepared for file switching, then we need a custom
- TARGET_ASM_NAMED_SECTION too. */
-
-#undef TEXT_SECTION
-#define TEXT_SECTION() \
-do { \
- if (TARGET_FILE_SWITCHING) \
- abort (); \
- fputs (TEXT_SECTION_ASM_OP, asm_out_file); \
- fputc ('\n', asm_out_file); \
-} while (0)
-
/* collect2 support (Macros for initialization). */
/* Mips default configuration is COFF-only, and confuses collect2. */