Commit 75197b37 by Bernd Schmidt Committed by Jeff Law

final.c (JUMP_TABLES_IN_TEXT_SECTION): Provide a default value.

        * final.c (JUMP_TABLES_IN_TEXT_SECTION): Provide a default value.
        (shorten_branches, final_scan_insn): Test value of
        JUMP_TABLES_IN_TEXT_SECTION instead of just testing whether it
        is defined.
        * tm.texi (JUMP_TABLES_IN_TEXT_SECTION): Corresponding changes.
        * arm/coff.h: Define JUMP_TABLES_IN_TEXT_SECTION to 1.
        coff.h: Likewise.
        * i386/386bsd.h: Likewise.
        * i386/freebsd-elf.h: Likewise.
        * i386/freebsd.h: Likewise.
        * i386/netbsd.h: Likewise.
        * i386/ptx4-i.h: Likewise.
        * i386/sysv4.h: Likewise.
        * pa/pa.h: Likewise.
        * rs6000/linux.h: Likewise.
        * rs6000/rs6000.h: Likewise.
        * sh/sh.h: Likewise.
        * sparc/sp64-elf.h: Likewise.
        * v850/v850.h: Likewise.
        * rs6000/sysv4.h: Define JUMP_TABLES_IN_TEXT_SECTION to 0.
        * i386/linux.h: Define JUMP_TABLES_IN_TEXT_SECTION to (flag_pic).

From-SVN: r19940
parent 37433f49
Fri May 22 00:57:00 1998 Bernd Schmidt (crux@pool.informatik.rwth-aachen.de>
* final.c (JUMP_TABLES_IN_TEXT_SECTION): Provide a default value.
(shorten_branches, final_scan_insn): Test value of
JUMP_TABLES_IN_TEXT_SECTION instead of just testing whether it
is defined.
* tm.texi (JUMP_TABLES_IN_TEXT_SECTION): Corresponding changes.
* arm/coff.h: Define JUMP_TABLES_IN_TEXT_SECTION to 1.
coff.h: Likewise.
* i386/386bsd.h: Likewise.
* i386/freebsd-elf.h: Likewise.
* i386/freebsd.h: Likewise.
* i386/netbsd.h: Likewise.
* i386/ptx4-i.h: Likewise.
* i386/sysv4.h: Likewise.
* pa/pa.h: Likewise.
* rs6000/linux.h: Likewise.
* rs6000/rs6000.h: Likewise.
* sh/sh.h: Likewise.
* sparc/sp64-elf.h: Likewise.
* v850/v850.h: Likewise.
* rs6000/sysv4.h: Define JUMP_TABLES_IN_TEXT_SECTION to 0.
* i386/linux.h: Define JUMP_TABLES_IN_TEXT_SECTION to (flag_pic).
Thu May 21 19:50:13 1998 J"orn Rennecke <amylaar@cygnus.co.uk> Thu May 21 19:50:13 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* regmove.c (gen_add3_insn): New function. * regmove.c (gen_add3_insn): New function.
......
...@@ -30,7 +30,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -30,7 +30,7 @@ Boston, MA 02111-1307, USA. */
point the default. NOT --nfp! --with{enable?} is supposed to replace it point the default. NOT --nfp! --with{enable?} is supposed to replace it
(right?), so let's stop using it. */ (right?), so let's stop using it. */
#undef TARGET_DEFAULT #undef TARGET_DEFAULT
#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT /*+ TARGET_CPU_DEFAULT*/) #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32)
/* ??? Is a big-endian default intended to be supported? */ /* ??? Is a big-endian default intended to be supported? */
#if 0 /*TARGET_CPU_DEFAULT & ARM_FLAG_BIG_END*/ #if 0 /*TARGET_CPU_DEFAULT & ARM_FLAG_BIG_END*/
...@@ -104,7 +104,7 @@ do { \ ...@@ -104,7 +104,7 @@ do { \
/* Define this macro if jump tables (for `tablejump' insns) should be /* Define this macro if jump tables (for `tablejump' insns) should be
output in the text section, along with the assembler instructions. output in the text section, along with the assembler instructions.
Otherwise, the readonly data section is used. */ Otherwise, the readonly data section is used. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
#undef READONLY_DATA_SECTION #undef READONLY_DATA_SECTION
#define READONLY_DATA_SECTION rdata_section #define READONLY_DATA_SECTION rdata_section
......
...@@ -87,7 +87,7 @@ do { \ ...@@ -87,7 +87,7 @@ do { \
/* Define this macro if jump tables (for `tablejump' insns) should be /* Define this macro if jump tables (for `tablejump' insns) should be
output in the text section, along with the assembler instructions. output in the text section, along with the assembler instructions.
Otherwise, the readonly data section is used. */ Otherwise, the readonly data section is used. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
#undef READONLY_DATA_SECTION #undef READONLY_DATA_SECTION
#define READONLY_DATA_SECTION rdata_section #define READONLY_DATA_SECTION rdata_section
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
/* Indicate that jump tables go in the text section. This is /* Indicate that jump tables go in the text section. This is
necessary when compiling PIC code. */ necessary when compiling PIC code. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
/* Don't default to pcc-struct-return, because gcc is the only compiler, and /* Don't default to pcc-struct-return, because gcc is the only compiler, and
we want to retain compatibility with older gcc versions. */ we want to retain compatibility with older gcc versions. */
......
...@@ -38,7 +38,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -38,7 +38,7 @@ Boston, MA 02111-1307, USA. */
/* Indicate that jump tables go in the text section. This is /* Indicate that jump tables go in the text section. This is
necessary when compiling PIC code. */ necessary when compiling PIC code. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
/* Copy this from the svr4 specifications... */ /* Copy this from the svr4 specifications... */
/* Define the register numbers to be used in Dwarf debugging information. /* Define the register numbers to be used in Dwarf debugging information.
......
...@@ -84,7 +84,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -84,7 +84,7 @@ Boston, MA 02111-1307, USA. */
/* Indicate that jump tables go in the text section. This is /* Indicate that jump tables go in the text section. This is
necessary when compiling PIC code. */ necessary when compiling PIC code. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
/* Don't default to pcc-struct-return, because gcc is the only compiler, and /* Don't default to pcc-struct-return, because gcc is the only compiler, and
we want to retain compatibility with older gcc versions. */ we want to retain compatibility with older gcc versions. */
......
...@@ -49,7 +49,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -49,7 +49,7 @@ Boston, MA 02111-1307, USA. */
/* Indicate that jump tables go in the text section. This is /* Indicate that jump tables go in the text section. This is
necessary when compiling PIC code. */ necessary when compiling PIC code. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
/* Copy this from the svr4 specifications... */ /* Copy this from the svr4 specifications... */
/* Define the register numbers to be used in Dwarf debugging information. /* Define the register numbers to be used in Dwarf debugging information.
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
/* Indicate that jump tables go in the text section. This is /* Indicate that jump tables go in the text section. This is
necessary when compiling PIC code. */ necessary when compiling PIC code. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
/* Don't default to pcc-struct-return, because gcc is the only compiler, and /* Don't default to pcc-struct-return, because gcc is the only compiler, and
we want to retain compatibility with older gcc versions. */ we want to retain compatibility with older gcc versions. */
......
...@@ -244,4 +244,4 @@ do { long value[3]; \ ...@@ -244,4 +244,4 @@ do { long value[3]; \
/* Indicate that jump tables go in the text section. This is /* Indicate that jump tables go in the text section. This is
necessary when compiling PIC code. */ necessary when compiling PIC code. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
...@@ -242,7 +242,7 @@ do { long value[3]; \ ...@@ -242,7 +242,7 @@ do { long value[3]; \
/* Indicate that jump tables go in the text section. This is /* Indicate that jump tables go in the text section. This is
necessary when compiling PIC code. */ necessary when compiling PIC code. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
/* A C statement (sans semicolon) to output to the stdio stream /* A C statement (sans semicolon) to output to the stdio stream
FILE the assembler definition of uninitialized global DECL named FILE the assembler definition of uninitialized global DECL named
......
...@@ -2321,7 +2321,7 @@ DTORS_SECTION_FUNCTION ...@@ -2321,7 +2321,7 @@ DTORS_SECTION_FUNCTION
fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE) fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
/* Jump tables are executable code and live in the TEXT section on the PA. */ /* Jump tables are executable code and live in the TEXT section on the PA. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
/* This is how to output an element of a case-vector that is relative. /* This is how to output an element of a case-vector that is relative.
This must be defined correctly as it is used when generating PIC code. This must be defined correctly as it is used when generating PIC code.
......
...@@ -69,4 +69,4 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -69,4 +69,4 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#endif #endif
#undef JUMP_TABLES_IN_TEXT_SECTION #undef JUMP_TABLES_IN_TEXT_SECTION
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
...@@ -2375,7 +2375,7 @@ extern int rs6000_trunc_used; ...@@ -2375,7 +2375,7 @@ extern int rs6000_trunc_used;
/* Indicate that jump tables go in the text section. */ /* Indicate that jump tables go in the text section. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
/* Define the routines to implement these extra sections. */ /* Define the routines to implement these extra sections. */
......
...@@ -331,6 +331,7 @@ do { \ ...@@ -331,6 +331,7 @@ do { \
/* Put jump tables in read-only memory, rather than in .text. */ /* Put jump tables in read-only memory, rather than in .text. */
#undef JUMP_TABLES_IN_TEXT_SECTION #undef JUMP_TABLES_IN_TEXT_SECTION
#define JUMP_TABLES_IN_TEXT_SECTION 0
/* Disable AIX-ism that disables turning -B into -L if the argument specifies a /* Disable AIX-ism that disables turning -B into -L if the argument specifies a
relative file name. This breaks setting GCC_EXEC_PREFIX to D:\path under relative file name. This breaks setting GCC_EXEC_PREFIX to D:\path under
......
...@@ -1518,7 +1518,7 @@ dtors_section() \ ...@@ -1518,7 +1518,7 @@ dtors_section() \
/* Define this so that jump tables go in same section as the current function, /* Define this so that jump tables go in same section as the current function,
which could be text or it could be a user defined section. */ which could be text or it could be a user defined section. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
/* A C statement to output something to the assembler file to switch to section /* A C statement to output something to the assembler file to switch to section
NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
......
...@@ -104,7 +104,7 @@ crtbegin.o%s \ ...@@ -104,7 +104,7 @@ crtbegin.o%s \
tables from other label refs (when we need to). */ tables from other label refs (when we need to). */
/* ??? Revisit this. */ /* ??? Revisit this. */
#undef JUMP_TABLES_IN_TEXT_SECTION #undef JUMP_TABLES_IN_TEXT_SECTION
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
/* System V Release 4 uses DWARF debugging info. /* System V Release 4 uses DWARF debugging info.
GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF
......
...@@ -1326,7 +1326,7 @@ do { char dstr[30]; \ ...@@ -1326,7 +1326,7 @@ do { char dstr[30]; \
/* The switch instruction requires that the jump table immediately follow /* The switch instruction requires that the jump table immediately follow
it. */ it. */
#define JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 1
/* svr4.h defines this assuming that 4 byte alignment is required. */ /* svr4.h defines this assuming that 4 byte alignment is required. */
#undef ASM_OUTPUT_BEFORE_CASE_LABEL #undef ASM_OUTPUT_BEFORE_CASE_LABEL
......
...@@ -130,6 +130,10 @@ Boston, MA 02111-1307, USA. */ ...@@ -130,6 +130,10 @@ Boston, MA 02111-1307, USA. */
#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == ';') #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == ';')
#endif #endif
#ifndef JUMP_TABLES_IN_TEXT_SECTION
#define JUMP_TABLES_IN_TEXT_SECTION 0
#endif
/* Nonzero means this function is a leaf function, with no function calls. /* Nonzero means this function is a leaf function, with no function calls.
This variable exists to be examined in FUNCTION_PROLOGUE This variable exists to be examined in FUNCTION_PROLOGUE
and FUNCTION_EPILOGUE. Always zero, unless set by some action. */ and FUNCTION_EPILOGUE. Always zero, unless set by some action. */
...@@ -1062,23 +1066,27 @@ shorten_branches (first) ...@@ -1062,23 +1066,27 @@ shorten_branches (first)
max_skip = LABEL_ALIGN_MAX_SKIP; max_skip = LABEL_ALIGN_MAX_SKIP;
} }
next = NEXT_INSN (insn); next = NEXT_INSN (insn);
/* ADDR_VECs only take room if read-only data goes into the text section. */ /* ADDR_VECs only take room if read-only data goes into the text
#if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION) section. */
if (next && GET_CODE (next) == JUMP_INSN) if (JUMP_TABLES_IN_TEXT_SECTION
{ #if !defined(READONLY_DATA_SECTION)
rtx nextbody = PATTERN (next); || 1
if (GET_CODE (nextbody) == ADDR_VEC
|| GET_CODE (nextbody) == ADDR_DIFF_VEC)
{
log = ADDR_VEC_ALIGN (next);
if (max_log < log)
{
max_log = log;
max_skip = LABEL_ALIGN_MAX_SKIP;
}
}
}
#endif #endif
)
if (next && GET_CODE (next) == JUMP_INSN)
{
rtx nextbody = PATTERN (next);
if (GET_CODE (nextbody) == ADDR_VEC
|| GET_CODE (nextbody) == ADDR_DIFF_VEC)
{
log = ADDR_VEC_ALIGN (next);
if (max_log < log)
{
max_log = log;
max_skip = LABEL_ALIGN_MAX_SKIP;
}
}
}
LABEL_TO_ALIGNMENT (insn) = max_log; LABEL_TO_ALIGNMENT (insn) = max_log;
LABEL_TO_MAX_SKIP (insn) = max_skip; LABEL_TO_MAX_SKIP (insn) = max_skip;
max_log = 0; max_log = 0;
...@@ -1254,11 +1262,15 @@ shorten_branches (first) ...@@ -1254,11 +1262,15 @@ shorten_branches (first)
{ {
/* This only takes room if read-only data goes into the text /* This only takes room if read-only data goes into the text
section. */ section. */
#if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION) if (JUMP_TABLES_IN_TEXT_SECTION
insn_lengths[uid] = (XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC) #if !defined(READONLY_DATA_SECTION)
* GET_MODE_SIZE (GET_MODE (body))); || 1
#endif
)
insn_lengths[uid] = (XVECLEN (body,
GET_CODE (body) == ADDR_DIFF_VEC)
* GET_MODE_SIZE (GET_MODE (body)));
/* Alignment is handled by ADDR_VEC_ALIGN. */ /* Alignment is handled by ADDR_VEC_ALIGN. */
#endif
} }
else if (asm_noperands (body) >= 0) else if (asm_noperands (body) >= 0)
insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn); insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
...@@ -1449,13 +1461,19 @@ shorten_branches (first) ...@@ -1449,13 +1461,19 @@ shorten_branches (first)
PUT_MODE (body, CASE_VECTOR_SHORTEN_MODE (min_addr - rel_addr, PUT_MODE (body, CASE_VECTOR_SHORTEN_MODE (min_addr - rel_addr,
max_addr - rel_addr, max_addr - rel_addr,
body)); body));
#if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION) if (JUMP_TABLES_IN_TEXT_SECTION
insn_lengths[uid] #if !defined(READONLY_DATA_SECTION)
= (XVECLEN (body, 1) * GET_MODE_SIZE (GET_MODE (body))); || 1
insn_current_address += insn_lengths[uid];
if (insn_lengths[uid] != old_length)
something_changed = 1;
#endif #endif
)
{
insn_lengths[uid]
= (XVECLEN (body, 1) * GET_MODE_SIZE (GET_MODE (body)));
insn_current_address += insn_lengths[uid];
if (insn_lengths[uid] != old_length)
something_changed = 1;
}
continue; continue;
} }
#endif /* CASE_VECTOR_SHORTEN_MODE */ #endif /* CASE_VECTOR_SHORTEN_MODE */
...@@ -2307,16 +2325,18 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -2307,16 +2325,18 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
if (GET_CODE (nextbody) == ADDR_VEC if (GET_CODE (nextbody) == ADDR_VEC
|| GET_CODE (nextbody) == ADDR_DIFF_VEC) || GET_CODE (nextbody) == ADDR_DIFF_VEC)
{ {
#ifndef JUMP_TABLES_IN_TEXT_SECTION if (! JUMP_TABLES_IN_TEXT_SECTION)
readonly_data_section (); {
readonly_data_section ();
#ifdef READONLY_DATA_SECTION #ifdef READONLY_DATA_SECTION
ASM_OUTPUT_ALIGN (file, ASM_OUTPUT_ALIGN (file,
exact_log2 (BIGGEST_ALIGNMENT exact_log2 (BIGGEST_ALIGNMENT
/ BITS_PER_UNIT)); / BITS_PER_UNIT));
#endif /* READONLY_DATA_SECTION */ #endif /* READONLY_DATA_SECTION */
#else /* JUMP_TABLES_IN_TEXT_SECTION */ }
function_section (current_function_decl); else
#endif /* JUMP_TABLES_IN_TEXT_SECTION */ function_section (current_function_decl);
#ifdef ASM_OUTPUT_CASE_LABEL #ifdef ASM_OUTPUT_CASE_LABEL
ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn), ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
NEXT_INSN (insn)); NEXT_INSN (insn));
......
...@@ -4826,9 +4826,10 @@ data section. ...@@ -4826,9 +4826,10 @@ data section.
@findex JUMP_TABLES_IN_TEXT_SECTION @findex JUMP_TABLES_IN_TEXT_SECTION
@item JUMP_TABLES_IN_TEXT_SECTION @item JUMP_TABLES_IN_TEXT_SECTION
Define this macro if jump tables (for @code{tablejump} insns) should be Define this macro to be an expression with a non-zero value if jump
output in the text section, along with the assembler instructions. tables (for @code{tablejump} insns) should be output in the text
Otherwise, the readonly data section is used. section, along with the assembler instructions. Otherwise, the
readonly data section is used.
This macro is irrelevant if there is no separate readonly data section. This macro is irrelevant if there is no separate readonly data section.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment