public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* JUMP_TABLES_IN_TEXT_SECTION
@ 1998-02-20 12:26 Bernd Schmidt
  1998-04-04 14:20 ` JUMP_TABLES_IN_TEXT_SECTION Jeffrey A Law
  0 siblings, 1 reply; 10+ messages in thread
From: Bernd Schmidt @ 1998-02-20 12:26 UTC (permalink / raw)
  To: egcs

The optimization manuals for Intel and AMD CPUs advise to put jump tables
into the data section.  To implement this, I've changed
JUMP_TABLES_IN_TEXT_SECTION to have a value.  For ix86-linux, the patch
sets it to (flag_pic), which is probably appropriate for ix86-*bsd as well.
I didn't change it, since I can't test those configurations.
The MIPS port may also be worth looking at, it appears to kludge around the
fact that the macro did not have a value until now.

Bernd

	* final.c: Define JUMP_TABLES_IN_TEXT_SECTION to a default value
	of 0 if it isn't defined.
	(get_attr_length, shorten_branches, final_scan_insn): Test value
	of JUMP_TABLES_IN_TEXT_SECTION instead of just testing whether it
	is defined.

	* arc/arc.h: Define JUMP_TABLES_IN_TEXT_SECTION to 0.
	* m32r/m32r.h: Likewise.
	* rs6000/sysv4.h: Likewise.
	* arm/coff.h: Define JUMP_TABLES_IN_TEXT_SECTION to 1.
	* 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.
	* i386/linux.h: Define JUMP_TABLES_IN_TEXT_SECTION to (flag_pic).
	
Index: final.c
diff -c -p -r1.1.3.11 final.c
*** final.c	1998/02/16 19:03:55	1.1.3.11
--- final.c	1998/02/16 21:09:29
*************** Boston, MA 02111-1307, USA.  */
*** 126,131 ****
--- 126,135 ----
  #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == ';')
  #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. 
     This variable exists to be examined in FUNCTION_PROLOGUE
     and FUNCTION_EPILOGUE.  Always zero, unless set by some action.  */
*************** get_attr_length (insn)
*** 667,681 ****
          if (GET_CODE (body) == ADDR_VEC || GET_CODE (body) == ADDR_DIFF_VEC)
  	  {
  	    /* This only takes room if jump tables go into the text section.  */
! #if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION)
! 	    length = (XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC)
! 		      * GET_MODE_SIZE (GET_MODE (body)));
! 
! 	    /* Be pessimistic and assume worst-case alignment.  */
! 	    length += (GET_MODE_SIZE (GET_MODE (body)) - 1);
! #else
! 	    return 0;
  #endif
  	  }
  	else
  	  length = insn_default_length (insn);
--- 671,690 ----
          if (GET_CODE (body) == ADDR_VEC || GET_CODE (body) == ADDR_DIFF_VEC)
  	  {
  	    /* This only takes room if jump tables go into the text section.  */
! 	    if (JUMP_TABLES_IN_TEXT_SECTION
! #if !defined READONLY_DATA_SECTION
! 		|| 1
  #endif
+ 		)
+ 	      {
+ 		length = (XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC)
+ 			  * GET_MODE_SIZE (GET_MODE (body)));
+ 
+ 		/* Be pessimistic and assume worst-case alignment.  */
+ 		length += (GET_MODE_SIZE (GET_MODE (body)) - 1);
+ 	      }
+ 	    else
+ 	      return 0;
  	  }
  	else
  	  length = insn_default_length (insn);
*************** shorten_branches (first)
*** 767,787 ****
  	{
  	  /* This only takes room if read-only data goes into the text
  	     section.  */
! #if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION)
! 	  int unitsize = GET_MODE_SIZE (GET_MODE (body));
! 
! 	  insn_lengths[uid] = (XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC)
! 			       * GET_MODE_SIZE (GET_MODE (body)));
! 
! 	  /* We don't know what address the ADDR_VEC/ADDR_DIFF_VEC will end
! 	     up at after branch shortening.  As a result, it is impossible
! 	     to determine how much padding we need at this point.  Therefore,
! 	     assume worst possible alignment.  */
! 	  insn_lengths[uid] += unitsize - 1;
! 
! #else
! 	  ;
  #endif
  	}
        else if (asm_noperands (body) >= 0)
  	insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
--- 776,798 ----
  	{
  	  /* This only takes room if read-only data goes into the text
  	     section.  */
! 	  if (JUMP_TABLES_IN_TEXT_SECTION
! #if !defined READONLY_DATA_SECTION
! 	      || 1
  #endif
+ 	      )
+ 	    {
+ 	      int unitsize = GET_MODE_SIZE (GET_MODE (body));
+ 
+ 	      insn_lengths[uid] = (XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC)
+ 				   * GET_MODE_SIZE (GET_MODE (body)));
+ 	      
+ 	      /* We don't know what address the ADDR_VEC/ADDR_DIFF_VEC will end
+ 	       up at after branch shortening.  As a result, it is impossible
+ 	       to determine how much padding we need at this point.  Therefore,
+ 	       assume worst possible alignment.  */
+ 	      insn_lengths[uid] += unitsize - 1;
+ 	    }	  
  	}
        else if (asm_noperands (body) >= 0)
  	insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
*************** final_scan_insn (insn, file, optimize, p
*** 1675,1690 ****
  	  if (GET_CODE (nextbody) == ADDR_VEC
  	      || GET_CODE (nextbody) == ADDR_DIFF_VEC)
  	    {
! #ifndef JUMP_TABLES_IN_TEXT_SECTION
! 	      readonly_data_section ();
  #ifdef READONLY_DATA_SECTION
! 	      ASM_OUTPUT_ALIGN (file,
! 				exact_log2 (BIGGEST_ALIGNMENT
! 					    / BITS_PER_UNIT));
  #endif /* READONLY_DATA_SECTION */
! #else /* JUMP_TABLES_IN_TEXT_SECTION */
! 	      function_section (current_function_decl);
! #endif /* JUMP_TABLES_IN_TEXT_SECTION */
  #ifdef ASM_OUTPUT_CASE_LABEL
  	      ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
  				     NEXT_INSN (insn));
--- 1686,1703 ----
  	  if (GET_CODE (nextbody) == ADDR_VEC
  	      || GET_CODE (nextbody) == ADDR_DIFF_VEC)
  	    {
! 	      if (! JUMP_TABLES_IN_TEXT_SECTION)
! 		{
! 		  readonly_data_section ();
  #ifdef READONLY_DATA_SECTION
! 		  ASM_OUTPUT_ALIGN (file,
! 				    exact_log2 (BIGGEST_ALIGNMENT
! 						/ BITS_PER_UNIT));
  #endif /* READONLY_DATA_SECTION */
! 		}
! 	      else
! 		function_section (current_function_decl);
! 
  #ifdef ASM_OUTPUT_CASE_LABEL
  	      ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
  				     NEXT_INSN (insn));
Index: tm.texi
diff -c -p -r1.1.3.8 tm.texi
*** tm.texi	1998/02/05 16:43:54	1.1.3.8
--- tm.texi	1998/02/16 21:17:22
*************** data section.
*** 4716,4724 ****
  
  @findex JUMP_TABLES_IN_TEXT_SECTION
  @item JUMP_TABLES_IN_TEXT_SECTION
! Define this macro if jump tables (for @code{tablejump} insns) should be
! output in the text 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.
  
--- 4716,4725 ----
  
  @findex JUMP_TABLES_IN_TEXT_SECTION
  @item JUMP_TABLES_IN_TEXT_SECTION
! Define this macro to be an expression with a non-zero value if jump 
! tables (for @code{tablejump} insns) should be output in the text
! 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.
  
Index: config/arc/arc.h
diff -c -p -r1.1.3.3 arc.h
*** config/arc/arc.h	1998/02/05 16:09:36	1.1.3.3
--- config/arc/arc.h	1998/02/16 21:13:54
*************** extern char *arc_text_section,*arc_data_
*** 1173,1179 ****
     output in the text 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.  */
! /*#define JUMP_TABLES_IN_TEXT_SECTION*/
  
  /* Define this macro if references to a symbol must be treated
     differently depending on something about the variable or
--- 1173,1179 ----
     output in the text 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.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 0
  
  /* Define this macro if references to a symbol must be treated
     differently depending on something about the variable or
Index: config/arm/coff.h
diff -c -p -r1.1.3.2 coff.h
*** config/arm/coff.h	1998/02/05 15:48:53	1.1.3.2
--- config/arm/coff.h	1998/02/16 21:13:43
*************** do {								\
*** 104,110 ****
  /* Define this macro if jump tables (for `tablejump' insns) should be
     output in the text section, along with the assembler instructions.
     Otherwise, the readonly data section is used.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  #undef READONLY_DATA_SECTION
  #define READONLY_DATA_SECTION	rdata_section
--- 104,110 ----
  /* Define this macro if jump tables (for `tablejump' insns) should be
     output in the text section, along with the assembler instructions.
     Otherwise, the readonly data section is used.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  #undef READONLY_DATA_SECTION
  #define READONLY_DATA_SECTION	rdata_section
Index: config/i386/386bsd.h
diff -c -p -r1.1.3.1 386bsd.h
*** config/i386/386bsd.h	1998/02/05 12:32:18	1.1.3.1
--- config/i386/386bsd.h	1998/02/16 21:13:32
***************
*** 69,75 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
--- 69,75 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
Index: config/i386/freebsd-elf.h
diff -c -p -r1.1.3.2 freebsd-elf.h
*** config/i386/freebsd-elf.h	1998/02/05 15:49:16	1.1.3.2
--- config/i386/freebsd-elf.h	1998/02/16 21:13:27
*************** Boston, MA 02111-1307, USA.  */
*** 38,44 ****
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
--- 38,44 ----
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
Index: config/i386/freebsd.h
diff -c -p -r1.1.3.4 freebsd.h
*** config/i386/freebsd.h	1998/02/05 16:44:34	1.1.3.4
--- config/i386/freebsd.h	1998/02/16 21:13:24
*************** Boston, MA 02111-1307, USA.  */
*** 81,87 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
--- 81,87 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
Index: config/i386/linux.h
diff -c -p -r1.1.3.3 linux.h
*** config/i386/linux.h	1998/02/05 16:01:30	1.1.3.3
--- config/i386/linux.h	1998/02/16 21:13:13
*************** Boston, MA 02111-1307, USA.  */
*** 46,52 ****
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
--- 46,52 ----
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
Index: config/i386/netbsd.h
diff -c -p -r1.1.3.2 netbsd.h
*** config/i386/netbsd.h	1998/02/05 16:17:03	1.1.3.2
--- config/i386/netbsd.h	1998/02/16 21:12:55
***************
*** 50,56 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
--- 50,56 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
Index: config/i386/ptx4-i.h
diff -c -p -r1.1.3.1 ptx4-i.h
*** config/i386/ptx4-i.h	1998/02/05 12:32:21	1.1.3.1
--- config/i386/ptx4-i.h	1998/02/16 21:12:48
*************** do { long value[3];							\
*** 244,247 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
--- 244,247 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
Index: config/i386/sysv4.h
diff -c -p -r1.1.3.1 sysv4.h
*** config/i386/sysv4.h	1998/02/05 12:32:24	1.1.3.1
--- config/i386/sysv4.h	1998/02/16 21:12:41
*************** do { long value[3];							\
*** 242,248 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* A C statement (sans semicolon) to output to the stdio stream
     FILE the assembler definition of uninitialized global DECL named
--- 242,248 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* A C statement (sans semicolon) to output to the stdio stream
     FILE the assembler definition of uninitialized global DECL named
Index: config/m32r/m32r.h
diff -c -p -r1.1.3.3 m32r.h
*** config/m32r/m32r.h	1998/02/05 16:08:57	1.1.3.3
--- config/m32r/m32r.h	1998/02/16 21:12:36
*************** extern void m32r_select_section ();
*** 1390,1396 ****
     output in the text 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.  */
! /*#define JUMP_TABLES_IN_TEXT_SECTION*/
  
  /* Define this macro if references to a symbol must be treated
     differently depending on something about the variable or
--- 1390,1396 ----
     output in the text 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.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 0
  
  /* Define this macro if references to a symbol must be treated
     differently depending on something about the variable or
Index: config/pa/pa.h
diff -c -p -r1.1.3.6 pa.h
*** config/pa/pa.h	1998/02/05 16:17:37	1.1.3.6
--- config/pa/pa.h	1998/02/16 21:11:05
*************** DTORS_SECTION_FUNCTION
*** 2243,2249 ****
      fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
  
  /* Jump tables are executable code and live in the TEXT section on the PA.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* 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.
--- 2243,2249 ----
      fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
  
  /* Jump tables are executable code and live in the TEXT section on the PA.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* 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.
Index: config/rs6000/linux.h
diff -c -p -r1.1.3.6 linux.h
*** config/rs6000/linux.h	1998/02/06 12:06:56	1.1.3.6
--- config/rs6000/linux.h	1998/02/16 21:10:55
*************** the Free Software Foundation, 675 Mass A
*** 67,70 ****
  #define DEFAULT_VTABLE_THUNKS 1
  
  #undef JUMP_TABLES_IN_TEXT_SECTION
! #define JUMP_TABLES_IN_TEXT_SECTION
--- 67,70 ----
  #define DEFAULT_VTABLE_THUNKS 1
  
  #undef JUMP_TABLES_IN_TEXT_SECTION
! #define JUMP_TABLES_IN_TEXT_SECTION 1
Index: config/rs6000/rs6000.h
diff -c -p -r1.1.3.6 rs6000.h
*** config/rs6000/rs6000.h	1998/02/05 16:09:23	1.1.3.6
--- config/rs6000/rs6000.h	1998/02/16 21:10:50
*************** extern int rs6000_trunc_used;
*** 2371,2377 ****
  
  /* Indicate that jump tables go in the text section.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Define the routines to implement these extra sections.  */
  
--- 2371,2377 ----
  
  /* Indicate that jump tables go in the text section.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Define the routines to implement these extra sections.  */
  
Index: config/rs6000/sysv4.h
diff -c -p -r1.1.3.5 sysv4.h
*** config/rs6000/sysv4.h	1998/02/16 19:06:15	1.1.3.5
--- config/rs6000/sysv4.h	1998/02/16 21:10:44
*************** do {									\
*** 330,336 ****
  #undef ASM_OUTPUT_EXTERNAL
  
  /* Put jump tables in read-only memory, rather than in .text.  */
! #undef JUMP_TABLES_IN_TEXT_SECTION
  
  /* Undefine some things which are defined by the generic svr4.h.  */
  
--- 330,336 ----
  #undef ASM_OUTPUT_EXTERNAL
  
  /* Put jump tables in read-only memory, rather than in .text.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 0
  
  /* Undefine some things which are defined by the generic svr4.h.  */
  
Index: config/sh/sh.h
diff -c -p -r1.1.3.5 sh.h
*** config/sh/sh.h	1998/02/05 16:09:26	1.1.3.5
--- config/sh/sh.h	1998/02/16 21:10:30
*************** dtors_section()							\
*** 1407,1413 ****
  
  /* 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.  */
! #define JUMP_TABLES_IN_TEXT_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
--- 1407,1413 ----
  
  /* 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.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* 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
Index: config/sparc/sp64-elf.h
diff -c -p -r1.1.3.2 sp64-elf.h
*** config/sparc/sp64-elf.h	1998/02/05 14:32:55	1.1.3.2
--- config/sparc/sp64-elf.h	1998/02/16 21:10:26
*************** crtbegin.o%s \
*** 109,115 ****
     tables from other label refs (when we need to).  */
  /* ??? Revisit this.  */
  #undef JUMP_TABLES_IN_TEXT_SECTION
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* System V Release 4 uses DWARF debugging info.
     GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF
--- 109,115 ----
     tables from other label refs (when we need to).  */
  /* ??? Revisit this.  */
  #undef JUMP_TABLES_IN_TEXT_SECTION
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* System V Release 4 uses DWARF debugging info.
     GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF
Index: config/v850/v850.h
diff -c -p -r1.1.3.7 v850.h
*** config/v850/v850.h	1998/02/05 16:45:58	1.1.3.7
--- config/v850/v850.h	1998/02/16 21:10:07
*************** do { char dstr[30];					\
*** 1326,1332 ****
  
  /* The switch instruction requires that the jump table immediately follow
     it. */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* svr4.h defines this assuming that 4 byte alignment is required.  */
  #undef ASM_OUTPUT_BEFORE_CASE_LABEL
--- 1326,1332 ----
  
  /* The switch instruction requires that the jump table immediately follow
     it. */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* svr4.h defines this assuming that 4 byte alignment is required.  */
  #undef ASM_OUTPUT_BEFORE_CASE_LABEL

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: JUMP_TABLES_IN_TEXT_SECTION
  1998-02-20 12:26 JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
@ 1998-04-04 14:20 ` Jeffrey A Law
  1998-04-06 15:25   ` JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Jeffrey A Law @ 1998-04-04 14:20 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: egcs, wilson

  In message <Pine.SOL.3.90.980220112632.20928E-100000@clouseau.informatik.rwth
-aachen.de>you write:
  > The optimization manuals for Intel and AMD CPUs advise to put jump tables
  > into the data section.  To implement this, I've changed
  > JUMP_TABLES_IN_TEXT_SECTION to have a value.  For ix86-linux, the patch
  > sets it to (flag_pic), which is probably appropriate for ix86-*bsd as well.
  > I didn't change it, since I can't test those configurations.
  > The MIPS port may also be worth looking at, it appears to kludge around the
  > fact that the macro did not have a value until now.
  > 
  > Bernd
  > 
  > 	* final.c: Define JUMP_TABLES_IN_TEXT_SECTION to a default value
  > 	of 0 if it isn't defined.
  > 	(get_attr_length, shorten_branches, final_scan_insn): Test value
  > 	of JUMP_TABLES_IN_TEXT_SECTION instead of just testing whether it
  > 	is defined.
  > 
  > 	* arc/arc.h: Define JUMP_TABLES_IN_TEXT_SECTION to 0.
  > 	* m32r/m32r.h: Likewise.
  > 	* rs6000/sysv4.h: Likewise.
  > 	* arm/coff.h: Define JUMP_TABLES_IN_TEXT_SECTION to 1.
  > 	* 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.
  > 	* i386/linux.h: Define JUMP_TABLES_IN_TEXT_SECTION to (flag_pic).
The code in shorten_branches went through a major revision about a
week after you sent this patch.  As a result the patch needs to be
revised to work with the new shorten_branches code.

If you make that update and resend the patch, I'll install it.

Thanks,
jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: JUMP_TABLES_IN_TEXT_SECTION
  1998-04-04 14:20 ` JUMP_TABLES_IN_TEXT_SECTION Jeffrey A Law
@ 1998-04-06 15:25   ` Bernd Schmidt
  1998-04-06 17:35     ` JUMP_TABLES_IN_TEXT_SECTION Joern Rennecke
                       ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Bernd Schmidt @ 1998-04-06 15:25 UTC (permalink / raw)
  To: Jeffrey A Law; +Cc: egcs

> The code in shorten_branches went through a major revision about a
> week after you sent this patch.  As a result the patch needs to be
> revised to work with the new shorten_branches code.
> 
> If you make that update and resend the patch, I'll install it.

Here it is. I've minimally tested it by bootstrapping, make check, and
compiling a small test program with -fpic and without.
The patch is against egcs-980328.

Bernd
        * final.c: Define JUMP_TABLES_IN_TEXT_SECTION to a default value
        of 0 if it isn't defined.
        (shorten_branches, final_scan_insn): Test value
        of JUMP_TABLES_IN_TEXT_SECTION instead of just testing whether it
        is defined.

        * arc/arc.h: Define JUMP_TABLES_IN_TEXT_SECTION to 0.
        * m32r/m32r.h: Likewise.
        * rs6000/sysv4.h: Likewise.
        * arm/coff.h: Define JUMP_TABLES_IN_TEXT_SECTION to 1.
        * 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.
        * i386/linux.h: Define JUMP_TABLES_IN_TEXT_SECTION to (flag_pic).

Index: final.c
diff -c -p -r1.1.1.23 final.c
*** final.c	1998/04/04 16:10:06	1.1.1.23
--- final.c	1998/04/05 11:45:45
*************** Boston, MA 02111-1307, USA.  */
*** 115,120 ****
--- 115,124 ----
  #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == ';')
  #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. 
     This variable exists to be examined in FUNCTION_PROLOGUE
     and FUNCTION_EPILOGUE.  Always zero, unless set by some action.  */
*************** shorten_branches (first)
*** 997,1016 ****
  	  if (max_log < log)
  	    max_log = log;
  	  next = NEXT_INSN (insn);
! /* ADDR_VECs only take room if read-only data goes into the text section.  */
! #if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION)
! 	  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;
! 		}
! 	    }
  #endif
  	  LABEL_TO_ALIGNMENT (insn) = max_log;
  	  max_log = 0;
  	}
--- 1001,1025 ----
  	  if (max_log < log)
  	    max_log = log;
  	  next = NEXT_INSN (insn);
! 	  /* ADDR_VECs only take room if read-only data goes into the text
! 	     section.  */
! 	  if (JUMP_TABLES_IN_TEXT_SECTION
! #if !defined(READONLY_DATA_SECTION)
! 	      || 1
  #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;
+ 		  }
+ 	      }
+ 
  	  LABEL_TO_ALIGNMENT (insn) = max_log;
  	  max_log = 0;
  	}
*************** shorten_branches (first)
*** 1184,1194 ****
  	{
  	  /* This only takes room if read-only data goes into the text
  	     section.  */
! #if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION)
! 	  insn_lengths[uid] = (XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC)
! 			       * GET_MODE_SIZE (GET_MODE (body)));
  	  /* Alignment is handled by ADDR_VEC_ALIGN.  */
- #endif
  	}
        else if (asm_noperands (body) >= 0)
  	insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
--- 1193,1207 ----
  	{
  	  /* This only takes room if read-only data goes into the text
  	     section.  */
! 	  if (JUMP_TABLES_IN_TEXT_SECTION
! #if !defined(READONLY_DATA_SECTION)
! 	      || 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.  */
  	}
        else if (asm_noperands (body) >= 0)
  	insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
*************** shorten_branches (first)
*** 1379,1391 ****
  	      PUT_MODE (body, CASE_VECTOR_SHORTEN_MODE (min_addr - rel_addr,
  							max_addr - rel_addr,
  							body));
! #if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION)
! 	      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;
  #endif
  	      continue;
  	    }
  #endif /* CASE_VECTOR_SHORTEN_MODE */
--- 1392,1410 ----
  	      PUT_MODE (body, CASE_VECTOR_SHORTEN_MODE (min_addr - rel_addr,
  							max_addr - rel_addr,
  							body));
! 	      if (JUMP_TABLES_IN_TEXT_SECTION
! #if !defined(READONLY_DATA_SECTION)
! 		  || 1
  #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;
  	    }
  #endif /* CASE_VECTOR_SHORTEN_MODE */
*************** final_scan_insn (insn, file, optimize, p
*** 2227,2242 ****
  	  if (GET_CODE (nextbody) == ADDR_VEC
  	      || GET_CODE (nextbody) == ADDR_DIFF_VEC)
  	    {
! #ifndef JUMP_TABLES_IN_TEXT_SECTION
! 	      readonly_data_section ();
  #ifdef READONLY_DATA_SECTION
! 	      ASM_OUTPUT_ALIGN (file,
! 				exact_log2 (BIGGEST_ALIGNMENT
! 					    / BITS_PER_UNIT));
  #endif /* READONLY_DATA_SECTION */
! #else /* JUMP_TABLES_IN_TEXT_SECTION */
! 	      function_section (current_function_decl);
! #endif /* JUMP_TABLES_IN_TEXT_SECTION */
  #ifdef ASM_OUTPUT_CASE_LABEL
  	      ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
  				     NEXT_INSN (insn));
--- 2246,2263 ----
  	  if (GET_CODE (nextbody) == ADDR_VEC
  	      || GET_CODE (nextbody) == ADDR_DIFF_VEC)
  	    {
! 	      if (! JUMP_TABLES_IN_TEXT_SECTION)
! 		{
! 		  readonly_data_section ();
  #ifdef READONLY_DATA_SECTION
! 		  ASM_OUTPUT_ALIGN (file,
! 				    exact_log2 (BIGGEST_ALIGNMENT
! 						/ BITS_PER_UNIT));
  #endif /* READONLY_DATA_SECTION */
! 		}
! 	      else
! 		function_section (current_function_decl);
! 
  #ifdef ASM_OUTPUT_CASE_LABEL
  	      ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
  				     NEXT_INSN (insn));
Index: tm.texi
diff -c -p -r1.1.3.8 tm.texi
*** tm.texi	1998/02/05 16:43:54	1.1.3.8
--- tm.texi	1998/02/16 21:17:22
*************** data section.
*** 4716,4724 ****
  
  @findex JUMP_TABLES_IN_TEXT_SECTION
  @item JUMP_TABLES_IN_TEXT_SECTION
! Define this macro if jump tables (for @code{tablejump} insns) should be
! output in the text 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.
  
--- 4716,4725 ----
  
  @findex JUMP_TABLES_IN_TEXT_SECTION
  @item JUMP_TABLES_IN_TEXT_SECTION
! Define this macro to be an expression with a non-zero value if jump 
! tables (for @code{tablejump} insns) should be output in the text
! 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.
  
Index: config/arc/arc.h
diff -c -p -r1.1.3.3 arc.h
*** config/arc/arc.h	1998/02/05 16:09:36	1.1.3.3
--- config/arc/arc.h	1998/02/16 21:13:54
*************** extern char *arc_text_section,*arc_data_
*** 1173,1179 ****
     output in the text 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.  */
! /*#define JUMP_TABLES_IN_TEXT_SECTION*/
  
  /* Define this macro if references to a symbol must be treated
     differently depending on something about the variable or
--- 1173,1179 ----
     output in the text 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.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 0
  
  /* Define this macro if references to a symbol must be treated
     differently depending on something about the variable or
Index: config/arm/coff.h
diff -c -p -r1.1.3.2 coff.h
*** config/arm/coff.h	1998/02/05 15:48:53	1.1.3.2
--- config/arm/coff.h	1998/02/16 21:13:43
*************** do {								\
*** 104,110 ****
  /* Define this macro if jump tables (for `tablejump' insns) should be
     output in the text section, along with the assembler instructions.
     Otherwise, the readonly data section is used.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  #undef READONLY_DATA_SECTION
  #define READONLY_DATA_SECTION	rdata_section
--- 104,110 ----
  /* Define this macro if jump tables (for `tablejump' insns) should be
     output in the text section, along with the assembler instructions.
     Otherwise, the readonly data section is used.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  #undef READONLY_DATA_SECTION
  #define READONLY_DATA_SECTION	rdata_section
Index: config/i386/386bsd.h
diff -c -p -r1.1.3.1 386bsd.h
*** config/i386/386bsd.h	1998/02/05 12:32:18	1.1.3.1
--- config/i386/386bsd.h	1998/02/16 21:13:32
***************
*** 69,75 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
--- 69,75 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
Index: config/i386/freebsd-elf.h
diff -c -p -r1.1.3.2 freebsd-elf.h
*** config/i386/freebsd-elf.h	1998/02/05 15:49:16	1.1.3.2
--- config/i386/freebsd-elf.h	1998/02/16 21:13:27
*************** Boston, MA 02111-1307, USA.  */
*** 38,44 ****
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
--- 38,44 ----
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
Index: config/i386/freebsd.h
diff -c -p -r1.1.3.4 freebsd.h
*** config/i386/freebsd.h	1998/02/05 16:44:34	1.1.3.4
--- config/i386/freebsd.h	1998/02/16 21:13:24
*************** Boston, MA 02111-1307, USA.  */
*** 81,87 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
--- 81,87 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
Index: config/i386/linux.h
diff -c -p -r1.1.3.3 linux.h
*** config/i386/linux.h	1998/02/05 16:01:30	1.1.3.3
--- config/i386/linux.h	1998/02/16 21:13:13
*************** Boston, MA 02111-1307, USA.  */
*** 46,52 ****
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
--- 46,52 ----
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
Index: config/i386/netbsd.h
diff -c -p -r1.1.3.2 netbsd.h
*** config/i386/netbsd.h	1998/02/05 16:17:03	1.1.3.2
--- config/i386/netbsd.h	1998/02/16 21:12:55
***************
*** 50,56 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
--- 50,56 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
Index: config/i386/ptx4-i.h
diff -c -p -r1.1.3.1 ptx4-i.h
*** config/i386/ptx4-i.h	1998/02/05 12:32:21	1.1.3.1
--- config/i386/ptx4-i.h	1998/02/16 21:12:48
*************** do { long value[3];							\
*** 244,247 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
--- 244,247 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
Index: config/i386/sysv4.h
diff -c -p -r1.1.3.1 sysv4.h
*** config/i386/sysv4.h	1998/02/05 12:32:24	1.1.3.1
--- config/i386/sysv4.h	1998/02/16 21:12:41
*************** do { long value[3];							\
*** 242,248 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* A C statement (sans semicolon) to output to the stdio stream
     FILE the assembler definition of uninitialized global DECL named
--- 242,248 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* A C statement (sans semicolon) to output to the stdio stream
     FILE the assembler definition of uninitialized global DECL named
Index: config/m32r/m32r.h
diff -c -p -r1.1.3.3 m32r.h
*** config/m32r/m32r.h	1998/02/05 16:08:57	1.1.3.3
--- config/m32r/m32r.h	1998/02/16 21:12:36
*************** extern void m32r_select_section ();
*** 1390,1396 ****
     output in the text 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.  */
! /*#define JUMP_TABLES_IN_TEXT_SECTION*/
  
  /* Define this macro if references to a symbol must be treated
     differently depending on something about the variable or
--- 1390,1396 ----
     output in the text 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.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 0
  
  /* Define this macro if references to a symbol must be treated
     differently depending on something about the variable or
Index: config/pa/pa.h
diff -c -p -r1.1.3.6 pa.h
*** config/pa/pa.h	1998/02/05 16:17:37	1.1.3.6
--- config/pa/pa.h	1998/02/16 21:11:05
*************** DTORS_SECTION_FUNCTION
*** 2243,2249 ****
      fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
  
  /* Jump tables are executable code and live in the TEXT section on the PA.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* 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.
--- 2243,2249 ----
      fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
  
  /* Jump tables are executable code and live in the TEXT section on the PA.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* 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.
Index: config/rs6000/linux.h
*** config/rs6000/linux.h	1998/04/04 15:45:35	1.1.1.8
--- config/rs6000/linux.h	1998/04/05 11:42:46
*************** the Free Software Foundation, 675 Mass A
*** 67,72 ****
  #ifndef USE_GNULIBC_1
  #define DEFAULT_VTABLE_THUNKS 1
  #endif
! 
  #undef JUMP_TABLES_IN_TEXT_SECTION
  #define JUMP_TABLES_IN_TEXT_SECTION
--- 67,72 ----
  #ifndef USE_GNULIBC_1
  #define DEFAULT_VTABLE_THUNKS 1
  #endif
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  #undef JUMP_TABLES_IN_TEXT_SECTION
  #define JUMP_TABLES_IN_TEXT_SECTION
Index: config/rs6000/rs6000.h
diff -c -p -r1.1.3.6 rs6000.h
*** config/rs6000/rs6000.h	1998/02/05 16:09:23	1.1.3.6
--- config/rs6000/rs6000.h	1998/02/16 21:10:50
*************** extern int rs6000_trunc_used;
*** 2371,2377 ****
  
  /* Indicate that jump tables go in the text section.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Define the routines to implement these extra sections.  */
  
--- 2371,2377 ----
  
  /* Indicate that jump tables go in the text section.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Define the routines to implement these extra sections.  */
  
Index: config/rs6000/sysv4.h
diff -c -p -r1.1.1.9 sysv4.h
*** config/rs6000/sysv4.h	1998/04/04 16:12:27	1.1.1.9
--- config/rs6000/sysv4.h	1998/04/05 15:27:09
*************** do {									\
*** 330,336 ****
  #undef ASM_OUTPUT_EXTERNAL
  
  /* Put jump tables in read-only memory, rather than in .text.  */
! #undef JUMP_TABLES_IN_TEXT_SECTION
  
  /* 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
--- 330,336 ----
  #undef ASM_OUTPUT_EXTERNAL
  
  /* Put jump tables in read-only memory, rather than in .text.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 0
  
  /* 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
Index: config/sh/sh.h
diff -c -p -r1.1.3.5 sh.h
*** config/sh/sh.h	1998/02/05 16:09:26	1.1.3.5
--- config/sh/sh.h	1998/02/16 21:10:30
*************** dtors_section()							\
*** 1407,1413 ****
  
  /* 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.  */
! #define JUMP_TABLES_IN_TEXT_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
--- 1407,1413 ----
  
  /* 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.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* 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
Index: config/sparc/sp64-elf.h
diff -c -p -r1.1.3.2 sp64-elf.h
*** config/sparc/sp64-elf.h	1998/02/05 14:32:55	1.1.3.2
--- config/sparc/sp64-elf.h	1998/02/16 21:10:26
*************** crtbegin.o%s \
*** 109,115 ****
     tables from other label refs (when we need to).  */
  /* ??? Revisit this.  */
  #undef JUMP_TABLES_IN_TEXT_SECTION
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* System V Release 4 uses DWARF debugging info.
     GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF
--- 109,115 ----
     tables from other label refs (when we need to).  */
  /* ??? Revisit this.  */
  #undef JUMP_TABLES_IN_TEXT_SECTION
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* System V Release 4 uses DWARF debugging info.
     GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF
Index: config/v850/v850.h
diff -c -p -r1.1.3.7 v850.h
*** config/v850/v850.h	1998/02/05 16:45:58	1.1.3.7
--- config/v850/v850.h	1998/02/16 21:10:07
*************** do { char dstr[30];					\
*** 1326,1332 ****
  
  /* The switch instruction requires that the jump table immediately follow
     it. */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* svr4.h defines this assuming that 4 byte alignment is required.  */
  #undef ASM_OUTPUT_BEFORE_CASE_LABEL
--- 1326,1332 ----
  
  /* The switch instruction requires that the jump table immediately follow
     it. */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* svr4.h defines this assuming that 4 byte alignment is required.  */
  #undef ASM_OUTPUT_BEFORE_CASE_LABEL

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: JUMP_TABLES_IN_TEXT_SECTION
  1998-04-06 15:25   ` JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
  1998-04-06 17:35     ` JUMP_TABLES_IN_TEXT_SECTION Joern Rennecke
@ 1998-04-06 17:35     ` David Edelsohn
  1998-04-08  4:34       ` JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
  1998-04-07  6:54     ` JUMP_TABLES_IN_TEXT_SECTION John Carr
  2 siblings, 1 reply; 10+ messages in thread
From: David Edelsohn @ 1998-04-06 17:35 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: Jeffrey A Law, egcs

	The rs6000 patches seem very odd:

Index: config/rs6000/linux.h
*** config/rs6000/linux.h       1998/04/04 15:45:35     1.1.1.8
--- config/rs6000/linux.h       1998/04/05 11:42:46
*************** the Free Software Foundation, 675 Mass A
*** 67,72 ****
  #ifndef USE_GNULIBC_1
  #define DEFAULT_VTABLE_THUNKS 1
  #endif
!
  #undef JUMP_TABLES_IN_TEXT_SECTION
  #define JUMP_TABLES_IN_TEXT_SECTION
--- 67,72 ----
  #ifndef USE_GNULIBC_1
  #define DEFAULT_VTABLE_THUNKS 1
  #endif
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  #undef JUMP_TABLES_IN_TEXT_SECTION
  #define JUMP_TABLES_IN_TEXT_SECTION

You insert JUMP_TABLES_IN_TEXT_SECTION just before it is undefined and
redefined as empty?

Index: config/rs6000/sysv4.h
diff -c -p -r1.1.1.9 sysv4.h
*** config/rs6000/sysv4.h       1998/04/04 16:12:27     1.1.1.9
--- config/rs6000/sysv4.h       1998/04/05 15:27:09
*************** do {
        \
*** 330,336 ****
  #undef ASM_OUTPUT_EXTERNAL

  /* Put jump tables in read-only memory, rather than in .text.  */
! #undef JUMP_TABLES_IN_TEXT_SECTION

  /* 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
--- 330,336 ----
  #undef ASM_OUTPUT_EXTERNAL

  /* Put jump tables in read-only memory, rather than in .text.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 0

The original version undefined this macro.  If you want to redefine it,
you must first undefine it and then define it to avoid warnings about
redefinition.  I believe that you need to do this for all places that
previously explicitly undefined the macro.

David


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: JUMP_TABLES_IN_TEXT_SECTION
  1998-04-06 15:25   ` JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
@ 1998-04-06 17:35     ` Joern Rennecke
  1998-04-07 19:34       ` JUMP_TABLES_IN_TEXT_SECTION Jeffrey A Law
  1998-04-06 17:35     ` JUMP_TABLES_IN_TEXT_SECTION David Edelsohn
  1998-04-07  6:54     ` JUMP_TABLES_IN_TEXT_SECTION John Carr
  2 siblings, 1 reply; 10+ messages in thread
From: Joern Rennecke @ 1998-04-06 17:35 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: law, egcs

> ! 	  if (JUMP_TABLES_IN_TEXT_SECTION
> ! #if !defined(READONLY_DATA_SECTION)
> ! 	      || 1
>   #endif
> + 	      )
> + 	    if (next && GET_CODE (next) == JUMP_INSN)
> + 	      {

I think that would look much nicer if you also changed READONLY_DATA_SECTION
to have a value and be always defined.
Then you could write:

	  if ((JUMP_TABLES_IN_TEXT_SECTION || ! READONLY_DATA_SECTION)
	      && next && GET_CODE (next) == JUMP_INSN)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: JUMP_TABLES_IN_TEXT_SECTION
  1998-04-06 15:25   ` JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
  1998-04-06 17:35     ` JUMP_TABLES_IN_TEXT_SECTION Joern Rennecke
  1998-04-06 17:35     ` JUMP_TABLES_IN_TEXT_SECTION David Edelsohn
@ 1998-04-07  6:54     ` John Carr
  2 siblings, 0 replies; 10+ messages in thread
From: John Carr @ 1998-04-07  6:54 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: egcs

Instead of

	  if (JUMP_TABLES_IN_TEXT_SECTION
#if !defined(READONLY_DATA_SECTION)
	      || 1
#endif
	      )

the following would be shorter and easier to read:

#if defined(READONLY_DATA_SECTION)
	  if (JUMP_TABLES_IN_TEXT_SECTION)
#endif


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: JUMP_TABLES_IN_TEXT_SECTION
  1998-04-06 17:35     ` JUMP_TABLES_IN_TEXT_SECTION Joern Rennecke
@ 1998-04-07 19:34       ` Jeffrey A Law
  1998-04-09  5:08         ` JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Jeffrey A Law @ 1998-04-07 19:34 UTC (permalink / raw)
  To: Joern Rennecke; +Cc: Bernd Schmidt, egcs

  In message < 199804070035.BAA00222@phal.cygnus.co.uk >you write:
  > > ! 	  if (JUMP_TABLES_IN_TEXT_SECTION
  > > ! #if !defined(READONLY_DATA_SECTION)
  > > ! 	      || 1
  > >   #endif
  > > + 	      )
  > > + 	    if (next && GET_CODE (next) == JUMP_INSN)
  > > + 	      {
  > 
  > I think that would look much nicer if you also changed READONLY_DATA_SECTION
  > to have a value and be always defined.
  > Then you could write:
  > 
  > 	  if ((JUMP_TABLES_IN_TEXT_SECTION || ! READONLY_DATA_SECTION)
  > 	      && next && GET_CODE (next) == JUMP_INSN)
Agreed.  And just define a default value (0) so that you only have to
change ports which actually want jump tables in the text section.

jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: JUMP_TABLES_IN_TEXT_SECTION
  1998-04-06 17:35     ` JUMP_TABLES_IN_TEXT_SECTION David Edelsohn
@ 1998-04-08  4:34       ` Bernd Schmidt
  0 siblings, 0 replies; 10+ messages in thread
From: Bernd Schmidt @ 1998-04-08  4:34 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Jeffrey A Law, egcs

> 	The rs6000 patches seem very odd:
[snip]
> You insert JUMP_TABLES_IN_TEXT_SECTION just before it is undefined and
> redefined as empty?

Strange. Either I was asleep while changing that file, or the file changed
recently and this part of the old patch got mis-applied.
Okay, disregard this patch. I'll check all of it again and send an updated
one.

Bernd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: JUMP_TABLES_IN_TEXT_SECTION
  1998-04-07 19:34       ` JUMP_TABLES_IN_TEXT_SECTION Jeffrey A Law
@ 1998-04-09  5:08         ` Bernd Schmidt
  1998-05-22  0:32           ` JUMP_TABLES_IN_TEXT_SECTION Jeffrey A Law
  0 siblings, 1 reply; 10+ messages in thread
From: Bernd Schmidt @ 1998-04-09  5:08 UTC (permalink / raw)
  To: Jeffrey A Law; +Cc: Joern Rennecke, egcs

>   > > ! 	  if (JUMP_TABLES_IN_TEXT_SECTION
>   > > ! #if !defined(READONLY_DATA_SECTION)
>   > > ! 	      || 1
>   > >   #endif
>   > > + 	      )
>   > > + 	    if (next && GET_CODE (next) == JUMP_INSN)
>   > > + 	      {
>   > 
>   > I think that would look much nicer if you also changed READONLY_DATA_SECTION
>   > to have a value and be always defined.

Apparently, it is already supposed to have a value if it is defined; there's
a piece of code in varasm.c that looks like this:

#ifdef READONLY_DATA_SECTION
  READONLY_DATA_SECTION ();
#endif

This means I can't implement that suggestion.

Here's the next version of the patch. I hope all the configurations are
changed correctly now, but I can only test ix86-linux (this is also the
reason why I didn't change configurations like freebsd-elf to use flag_pic
as the value, although this would probably work as well).

Bernd
        * final.c: Define JUMP_TABLES_IN_TEXT_SECTION to a default value
        of 0 if it isn't defined.
        (shorten_branches, final_scan_insn): Test value
        of JUMP_TABLES_IN_TEXT_SECTION instead of just testing whether it
        is defined.

        * arm/coff.h: Define JUMP_TABLES_IN_TEXT_SECTION to 1.
	* arm/tcoff.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).


Index: final.c
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/final.c,v
retrieving revision 1.1.1.24
diff -c -p -d -r1.1.1.24 final.c
*** final.c	1998/04/06 17:09:20	1.1.1.24
--- final.c	1998/04/08 18:17:15
*************** Boston, MA 02111-1307, USA.  */
*** 115,120 ****
--- 115,124 ----
  #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == ';')
  #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. 
     This variable exists to be examined in FUNCTION_PROLOGUE
     and FUNCTION_EPILOGUE.  Always zero, unless set by some action.  */
*************** shorten_branches (first)
*** 997,1016 ****
  	  if (max_log < log)
  	    max_log = log;
  	  next = NEXT_INSN (insn);
! /* ADDR_VECs only take room if read-only data goes into the text section.  */
! #if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION)
! 	  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;
! 		}
! 	    }
  #endif
  	  LABEL_TO_ALIGNMENT (insn) = max_log;
  	  max_log = 0;
  	}
--- 1001,1025 ----
  	  if (max_log < log)
  	    max_log = log;
  	  next = NEXT_INSN (insn);
! 	  /* ADDR_VECs only take room if read-only data goes into the text
! 	     section.  */
! 	  if (JUMP_TABLES_IN_TEXT_SECTION
! #if !defined(READONLY_DATA_SECTION)
! 	      || 1
  #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;
+ 		  }
+ 	      }
+ 
  	  LABEL_TO_ALIGNMENT (insn) = max_log;
  	  max_log = 0;
  	}
*************** shorten_branches (first)
*** 1184,1194 ****
  	{
  	  /* This only takes room if read-only data goes into the text
  	     section.  */
! #if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION)
! 	  insn_lengths[uid] = (XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC)
! 			       * GET_MODE_SIZE (GET_MODE (body)));
! 	  /* Alignment is handled by ADDR_VEC_ALIGN.  */
  #endif
  	}
        else if (asm_noperands (body) >= 0)
  	insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
--- 1193,1207 ----
  	{
  	  /* This only takes room if read-only data goes into the text
  	     section.  */
! 	  if (JUMP_TABLES_IN_TEXT_SECTION
! #if !defined(READONLY_DATA_SECTION)
! 	      || 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.  */
  	}
        else if (asm_noperands (body) >= 0)
  	insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
*************** shorten_branches (first)
*** 1379,1391 ****
  	      PUT_MODE (body, CASE_VECTOR_SHORTEN_MODE (min_addr - rel_addr,
  							max_addr - rel_addr,
  							body));
! #if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION)
! 	      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;
  #endif
  	      continue;
  	    }
  #endif /* CASE_VECTOR_SHORTEN_MODE */
--- 1392,1410 ----
  	      PUT_MODE (body, CASE_VECTOR_SHORTEN_MODE (min_addr - rel_addr,
  							max_addr - rel_addr,
  							body));
! 	      if (JUMP_TABLES_IN_TEXT_SECTION
! #if !defined(READONLY_DATA_SECTION)
! 		  || 1
  #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;
  	    }
  #endif /* CASE_VECTOR_SHORTEN_MODE */
*************** final_scan_insn (insn, file, optimize, p
*** 2227,2242 ****
  	  if (GET_CODE (nextbody) == ADDR_VEC
  	      || GET_CODE (nextbody) == ADDR_DIFF_VEC)
  	    {
! #ifndef JUMP_TABLES_IN_TEXT_SECTION
! 	      readonly_data_section ();
  #ifdef READONLY_DATA_SECTION
! 	      ASM_OUTPUT_ALIGN (file,
! 				exact_log2 (BIGGEST_ALIGNMENT
! 					    / BITS_PER_UNIT));
  #endif /* READONLY_DATA_SECTION */
! #else /* JUMP_TABLES_IN_TEXT_SECTION */
! 	      function_section (current_function_decl);
! #endif /* JUMP_TABLES_IN_TEXT_SECTION */
  #ifdef ASM_OUTPUT_CASE_LABEL
  	      ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
  				     NEXT_INSN (insn));
--- 2246,2263 ----
  	  if (GET_CODE (nextbody) == ADDR_VEC
  	      || GET_CODE (nextbody) == ADDR_DIFF_VEC)
  	    {
! 	      if (! JUMP_TABLES_IN_TEXT_SECTION)
! 		{
! 		  readonly_data_section ();
  #ifdef READONLY_DATA_SECTION
! 		  ASM_OUTPUT_ALIGN (file,
! 				    exact_log2 (BIGGEST_ALIGNMENT
! 						/ BITS_PER_UNIT));
  #endif /* READONLY_DATA_SECTION */
! 		}
! 	      else
! 		function_section (current_function_decl);
! 
  #ifdef ASM_OUTPUT_CASE_LABEL
  	      ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
  				     NEXT_INSN (insn));
Index: tm.texi
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/tm.texi,v
retrieving revision 1.1.1.18
diff -c -p -d -r1.1.1.18 tm.texi
*** tm.texi	1998/04/06 17:10:18	1.1.1.18
--- tm.texi	1998/04/08 18:17:15
*************** data section.
*** 4802,4810 ****
  
  @findex JUMP_TABLES_IN_TEXT_SECTION
  @item JUMP_TABLES_IN_TEXT_SECTION
! Define this macro if jump tables (for @code{tablejump} insns) should be
! output in the text 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.
  
--- 4802,4811 ----
  
  @findex JUMP_TABLES_IN_TEXT_SECTION
  @item JUMP_TABLES_IN_TEXT_SECTION
! Define this macro to be an expression with a non-zero value if jump 
! tables (for @code{tablejump} insns) should be output in the text
! 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.
  
Index: config/arm/coff.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/arm/coff.h,v
retrieving revision 1.1.1.4
diff -c -p -d -r1.1.1.4 coff.h
*** config/arm/coff.h	1998/04/04 14:11:17	1.1.1.4
--- config/arm/coff.h	1998/04/08 18:11:14
*************** do {								\
*** 104,110 ****
  /* Define this macro if jump tables (for `tablejump' insns) should be
     output in the text section, along with the assembler instructions.
     Otherwise, the readonly data section is used.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  #undef READONLY_DATA_SECTION
  #define READONLY_DATA_SECTION	rdata_section
--- 104,110 ----
  /* Define this macro if jump tables (for `tablejump' insns) should be
     output in the text section, along with the assembler instructions.
     Otherwise, the readonly data section is used.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  #undef READONLY_DATA_SECTION
  #define READONLY_DATA_SECTION	rdata_section
Index: config/arm/tcoff.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/arm/tcoff.h,v
retrieving revision 1.1.1.1
diff -c -p -d -r1.1.1.1 tcoff.h
*** config/arm/tcoff.h	1998/04/04 16:28:41	1.1.1.1
--- config/arm/tcoff.h	1998/04/08 18:10:45
*************** do {								\
*** 87,93 ****
  /* Define this macro if jump tables (for `tablejump' insns) should be
     output in the text section, along with the assembler instructions.
     Otherwise, the readonly data section is used.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  #undef READONLY_DATA_SECTION
  #define READONLY_DATA_SECTION	rdata_section
--- 87,93 ----
  /* Define this macro if jump tables (for `tablejump' insns) should be
     output in the text section, along with the assembler instructions.
     Otherwise, the readonly data section is used.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  #undef READONLY_DATA_SECTION
  #define READONLY_DATA_SECTION	rdata_section
Index: config/i386/386bsd.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/i386/386bsd.h,v
retrieving revision 1.1.1.2
diff -c -p -d -r1.1.1.2 386bsd.h
*** config/i386/386bsd.h	1998/04/04 15:44:45	1.1.1.2
--- config/i386/386bsd.h	1998/04/08 18:10:39
***************
*** 69,75 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
--- 69,75 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
Index: config/i386/freebsd-elf.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/i386/freebsd-elf.h,v
retrieving revision 1.1.1.5
diff -c -p -d -r1.1.1.5 freebsd-elf.h
*** config/i386/freebsd-elf.h	1998/04/06 17:11:39	1.1.1.5
--- config/i386/freebsd-elf.h	1998/04/08 18:10:34
*************** Boston, MA 02111-1307, USA.  */
*** 38,44 ****
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
--- 38,44 ----
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
Index: config/i386/freebsd.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/i386/freebsd.h,v
retrieving revision 1.1.1.6
diff -c -p -d -r1.1.1.6 freebsd.h
*** config/i386/freebsd.h	1998/04/04 16:28:50	1.1.1.6
--- config/i386/freebsd.h	1998/04/08 18:10:31
*************** Boston, MA 02111-1307, USA.  */
*** 84,90 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
--- 84,90 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
Index: config/i386/linux.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/i386/linux.h,v
retrieving revision 1.1.1.7
diff -c -p -d -r1.1.1.7 linux.h
*** config/i386/linux.h	1998/04/04 15:44:50	1.1.1.7
--- config/i386/linux.h	1998/04/08 18:10:27
*************** Boston, MA 02111-1307, USA.  */
*** 46,52 ****
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
--- 46,52 ----
  
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
! #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
  
  /* Copy this from the svr4 specifications... */
  /* Define the register numbers to be used in Dwarf debugging information.
Index: config/i386/netbsd.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/i386/netbsd.h,v
retrieving revision 1.1.1.4
diff -c -p -d -r1.1.1.4 netbsd.h
*** config/i386/netbsd.h	1998/04/04 16:11:26	1.1.1.4
--- config/i386/netbsd.h	1998/04/08 18:10:17
***************
*** 50,56 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
--- 50,56 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Don't default to pcc-struct-return, because gcc is the only compiler, and
     we want to retain compatibility with older gcc versions.  */
Index: config/i386/ptx4-i.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/i386/ptx4-i.h,v
retrieving revision 1.1.1.2
diff -c -p -d -r1.1.1.2 ptx4-i.h
*** config/i386/ptx4-i.h	1998/04/04 15:44:51	1.1.1.2
--- config/i386/ptx4-i.h	1998/04/08 18:10:12
*************** do { long value[3];							\
*** 244,247 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
--- 244,247 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
Index: config/i386/sysv4.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/i386/sysv4.h,v
retrieving revision 1.1.1.2
diff -c -p -d -r1.1.1.2 sysv4.h
*** config/i386/sysv4.h	1998/04/04 15:44:52	1.1.1.2
--- config/i386/sysv4.h	1998/04/08 18:10:02
*************** do { long value[3];							\
*** 242,248 ****
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* A C statement (sans semicolon) to output to the stdio stream
     FILE the assembler definition of uninitialized global DECL named
--- 242,248 ----
  /* Indicate that jump tables go in the text section.  This is
     necessary when compiling PIC code.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* A C statement (sans semicolon) to output to the stdio stream
     FILE the assembler definition of uninitialized global DECL named
Index: config/pa/pa.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/pa/pa.h,v
retrieving revision 1.1.1.21
diff -c -p -d -r1.1.1.21 pa.h
*** config/pa/pa.h	1998/04/06 17:12:26	1.1.1.21
--- config/pa/pa.h	1998/04/08 18:09:05
*************** DTORS_SECTION_FUNCTION
*** 2257,2263 ****
      fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
  
  /* Jump tables are executable code and live in the TEXT section on the PA.  */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* 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.
--- 2257,2263 ----
      fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
  
  /* Jump tables are executable code and live in the TEXT section on the PA.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* 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.
Index: config/rs6000/linux.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/rs6000/linux.h,v
retrieving revision 1.1.1.8
diff -c -p -d -r1.1.1.8 linux.h
*** config/rs6000/linux.h	1998/04/04 15:45:35	1.1.1.8
--- config/rs6000/linux.h	1998/04/08 18:08:58
*************** the Free Software Foundation, 675 Mass A
*** 69,72 ****
  #endif
  
  #undef JUMP_TABLES_IN_TEXT_SECTION
! #define JUMP_TABLES_IN_TEXT_SECTION
--- 69,72 ----
  #endif
  
  #undef JUMP_TABLES_IN_TEXT_SECTION
! #define JUMP_TABLES_IN_TEXT_SECTION 1
Index: config/rs6000/rs6000.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.1.1.20
diff -c -p -d -r1.1.1.20 rs6000.h
*** config/rs6000/rs6000.h	1998/04/06 17:12:33	1.1.1.20
--- config/rs6000/rs6000.h	1998/04/08 18:08:52
*************** extern int rs6000_trunc_used;
*** 2375,2381 ****
  
  /* Indicate that jump tables go in the text section.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* Define the routines to implement these extra sections.  */
  
--- 2375,2381 ----
  
  /* Indicate that jump tables go in the text section.  */
  
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* Define the routines to implement these extra sections.  */
  
Index: config/rs6000/sysv4.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.1.1.9
diff -c -p -d -r1.1.1.9 sysv4.h
*** config/rs6000/sysv4.h	1998/04/04 16:12:27	1.1.1.9
--- config/rs6000/sysv4.h	1998/04/08 18:08:42
*************** do {									\
*** 331,336 ****
--- 331,337 ----
  
  /* Put jump tables in read-only memory, rather than in .text.  */
  #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
     relative file name.  This breaks setting GCC_EXEC_PREFIX to D:\path under
Index: config/sh/sh.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/sh/sh.h,v
retrieving revision 1.1.1.12
diff -c -p -d -r1.1.1.12 sh.h
*** config/sh/sh.h	1998/04/04 16:29:39	1.1.1.12
--- config/sh/sh.h	1998/04/08 18:08:21
*************** dtors_section()							\
*** 1457,1463 ****
  
  /* 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.  */
! #define JUMP_TABLES_IN_TEXT_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
--- 1457,1463 ----
  
  /* 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.  */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* 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
Index: config/sparc/sp64-elf.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/sparc/sp64-elf.h,v
retrieving revision 1.1.1.2
diff -c -p -d -r1.1.1.2 sp64-elf.h
*** config/sparc/sp64-elf.h	1998/04/03 19:55:20	1.1.1.2
--- config/sparc/sp64-elf.h	1998/04/08 18:08:07
*************** crtbegin.o%s \
*** 109,115 ****
     tables from other label refs (when we need to).  */
  /* ??? Revisit this.  */
  #undef JUMP_TABLES_IN_TEXT_SECTION
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* System V Release 4 uses DWARF debugging info.
     GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF
--- 109,115 ----
     tables from other label refs (when we need to).  */
  /* ??? Revisit this.  */
  #undef JUMP_TABLES_IN_TEXT_SECTION
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* System V Release 4 uses DWARF debugging info.
     GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF
Index: config/v850/v850.h
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/config/v850/v850.h,v
retrieving revision 1.1.1.7
diff -c -p -d -r1.1.1.7 v850.h
*** config/v850/v850.h	1998/04/04 15:45:53	1.1.1.7
--- config/v850/v850.h	1998/04/08 18:07:52
*************** do { char dstr[30];					\
*** 1326,1332 ****
  
  /* The switch instruction requires that the jump table immediately follow
     it. */
! #define JUMP_TABLES_IN_TEXT_SECTION
  
  /* svr4.h defines this assuming that 4 byte alignment is required.  */
  #undef ASM_OUTPUT_BEFORE_CASE_LABEL
--- 1326,1332 ----
  
  /* The switch instruction requires that the jump table immediately follow
     it. */
! #define JUMP_TABLES_IN_TEXT_SECTION 1
  
  /* svr4.h defines this assuming that 4 byte alignment is required.  */
  #undef ASM_OUTPUT_BEFORE_CASE_LABEL


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: JUMP_TABLES_IN_TEXT_SECTION
  1998-04-09  5:08         ` JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
@ 1998-05-22  0:32           ` Jeffrey A Law
  0 siblings, 0 replies; 10+ messages in thread
From: Jeffrey A Law @ 1998-05-22  0:32 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: Joern Rennecke, egcs, wilson

  In message <Pine.SOL.3.90.980409135817.4169D@bond.informatik.rwth-aachen.de>yrite:
  > Here's the next version of the patch. I hope all the configurations are
  > changed correctly now, but I can only test ix86-linux (this is also the
  > reason why I didn't change configurations like freebsd-elf to use flag_pic
  > as the value, although this would probably work as well).
  > 
  > Bernd
  >         * final.c: Define JUMP_TABLES_IN_TEXT_SECTION to a default value
  >         of 0 if it isn't defined.
  >         (shorten_branches, final_scan_insn): Test value
  >         of JUMP_TABLES_IN_TEXT_SECTION instead of just testing whether it
  >         is defined.
  > 
  >         * arm/coff.h: Define JUMP_TABLES_IN_TEXT_SECTION to 1.
  > 	* arm/tcoff.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).
Thanks.  I've installed this patch.  Sorry it took so long to get
back to it.

jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1998-05-22  0:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-20 12:26 JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
1998-04-04 14:20 ` JUMP_TABLES_IN_TEXT_SECTION Jeffrey A Law
1998-04-06 15:25   ` JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
1998-04-06 17:35     ` JUMP_TABLES_IN_TEXT_SECTION Joern Rennecke
1998-04-07 19:34       ` JUMP_TABLES_IN_TEXT_SECTION Jeffrey A Law
1998-04-09  5:08         ` JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
1998-05-22  0:32           ` JUMP_TABLES_IN_TEXT_SECTION Jeffrey A Law
1998-04-06 17:35     ` JUMP_TABLES_IN_TEXT_SECTION David Edelsohn
1998-04-08  4:34       ` JUMP_TABLES_IN_TEXT_SECTION Bernd Schmidt
1998-04-07  6:54     ` JUMP_TABLES_IN_TEXT_SECTION John Carr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).