This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Move mips port to in_small_data_p


This patch switches the mips port over to TARGET_IN_SMALL_DATA_P.
It's mostly a cleanup, although it fixes the attached compat test as well.

Lots of niggly details here, sorry...


- The current code isn't consistent in the way it handles strings and
  compound constants.  select_section thinks they should qualify as
  small data but encode_section_info thinks they shouldn't.  That means
  we put the constants in .sdata but access them like normal data.

  For simplicity, it seemed best to allow compound constants in .sdata
  but not allow strings.  (This also seems to be what the alpha port does.)
  Since this change only affects locally-defined constants, it shouldn't
  have any ABI impact.


- The generic code won't use the port-local sdata_section().  This
  causes a bit of difficulty for irix targets since .section .sdata
  needs a special flag to be set.  The patch gets around this by
  overriding TARGET_SECTION_TYPE_FLAGS and setting SECTION_SMALL for
  recognised section names.

  In a way, this is an improvement, since it fixes:

      int x __attribute__((__section__(".sdata")));

  Before the patch, x's .section directive did not have the right flags,
  leading to an assembler error.


- The patch fixes a long-standing bug in the treatment of:

     extern struct s foo __attribute__((__section__(".sdata")));

  There's no syntax for telling the assembler about the section attribute
  so (as far as it's concerned) the usual -G rules apply.  We weren't
  taking this into account within gcc.

  The patch fixes the attached compat test for -mno-explicit-relocs/-O2.


- At first, I was worried about this code in mips_unique_section:

    else if ((TARGET_EMBEDDED_PIC || TARGET_MIPS16)
        && TREE_CODE (decl) == STRING_CST
        && !flag_writable_strings)
      {
        /* For embedded position independent code, put constant
           strings in the text section, because the data section
           is limited to 64K in size.  For mips16 code, put
           strings in the text section so that a PC relative load
           instruction can be used to get their address.  */
        sec = 0;
      }

  but looking at the way the function is used, I don't think it's ever
  passed a string constant.  Also, the code is dominated by decl flag
  checks, so I think an --enable-checking compiler would have aborted
  before reaching here.

  Other than that, mips_unique_section seems to behave in the same
  way as the generic version.


- The patch has the same effect as:

      http://gcc.gnu.org/ml/gcc-patches/2002-08/msg01188.html

  Jason was worried that the patch would change the ABI.  But it only
  affects the way that undefined symbols are declared in the assembler
  output.  It doesn't change the definitions of variables and it doesn't
  change the code that decides whether sdata optimisations apply.  I
  think these things have remained the same since before the original
  comdat patch went in.

  As things stand, gcc assumes that we can use sdata optimisations
  for external comdat symbols.  It's just not giving assembler the
  info it needs to do that.


- We no longer emit .extern <object>,<size> directives when using
  -mexplicit-relocs.  Also, as a small optimisation and code cleanup,
  we only emit the .externs when an object is within the -G limit.


- Although you wouldn't realise this from reading the documentation,
  -mgpopt only has an effect when optimisation is disabled.  Otherwise
  override_options will set MASK_GP_OPT to whatever it thinks is best.

  I doubt that controlling sdata optimisations for -O0 is of much use to
  anyone, so the patch disables the option altogether.  I've kept it
  in TARGET_SWITCHES to avoid gratuitiously breaking old makefiles.


- Having both SYMBOL_REF_FLAG_P and SYMBOL_REF_SMALL_P makes it possible
  to do sdata optimisations for -mabicalls as well.  I'm planning to
  handle the -G side of this later.  But one immediate side-effect of
  the patch below is that -mexplicit-relocs -mabicalls code will now
  use gp-relative accesses for "foo" and "x" above.


Patch tested on mips-sgi-irix6.5, mipsel-linux-gnu, mips64vrel-elf and
mipsisa64-elf.  I also compared the code generated for gcc.c-torture
before and after the patch using mips64-elf-gcc, options

   {,-O2}{-G0,-G8}{,-membedded-data,-mips16}

The only changes were the ones described above.  OK to install?

Richard


	* config/mips/elf64.h (TARGET_ASM_UNIQUE_SECTION): Delete.
	(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
	(SECTION_FUNCTION_TEMPLATE): Delete.
	* config/mips/elf.h: As for elf64.h.
	(ASM_OUTPUT_ALIGNED_BSS): Use named_section rather than sbss_section.
	* config/mips/linux.h: As for elf.h
	* config/mips/iris6gld.h (TARGET_ASM_UNIQUE_SECTION): Delete.
	* config/mips/iris6.h (EXTRA_SECTIONS): Delete.
	(EXTRA_SECTION_FUNCTIONS): Remove sdata_section.  Remove the handling
	of in_sdata from current_section_name and current_section_flags.
	* config/mips/iris6gld.h (TARGET_ASM_UNIQUE_SECTION): Delete.
	* config/mips/mips.h (sdata_section, sbss_section): Remove prototypes.
	(MASK_GP_OPT, TARGET_GP_OPT): Delete.
	(MASK_NO_FUSED_MADD): Use MASK_GP_OPT's old value.
	(TARGET_SWITCHES): Neuter gpOPT, gpopt, no-gpOPT and no-gpopt.
	(SMALL_DATA_SECTION, EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Remove.
	* config/mips/mips.c (TARGET_IN_SMALL_DATA_P): Override.
	(TARGET_SECTION_TYPE_FLAGS): Override if TARGET_IRIX6.
	(mips_classify_symbol): Use SYMBOL_REF_SMALL_P.
	(override_options): Remove setting of MASK_GPOPT.
	(mips_output_external): Use mips_in_small_data_p to check whether a
	symbol needs an .extern directive.  Don't emit such directives for
	TARGET_EXPLICIT_RELOCS.
	(mips_declare_object): Update accordingly.
	(mips_select_rtx_section): Call named_section rather than
	SMALL_DATA_SECTION.
	(mips_select_section): Use default_elf_section_section for everything
	except .text string constants.
	(mips_in_small_data_p): New function.
	(mips_encode_section_info): Remove small data handling.
	(mips_unique_section): Delete.
	(iris6_section_type_flags): New function.

Index: config/mips/elf64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/elf64.h,v
retrieving revision 1.55
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.55 elf64.h
*** config/mips/elf64.h	9 Jun 2003 06:55:14 -0000	1.55
--- config/mips/elf64.h	7 Jul 2003 15:41:30 -0000
*************** #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,
*** 142,168 ****
  
  #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
  
- #define TARGET_ASM_UNIQUE_SECTION mips_unique_section
- 
- /* A list of other sections which the compiler might be "in" at any
-    given time.  */
- #undef EXTRA_SECTIONS
- #define EXTRA_SECTIONS in_sdata
- 
- #undef EXTRA_SECTION_FUNCTIONS
- #define EXTRA_SECTION_FUNCTIONS                                         \
-   SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP)
- 
- #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP)                               \
- void FN ()                                                            \
- {                                                                     \
-   if (in_section != ENUM)                                             \
-     {                                                                 \
-       fprintf (asm_out_file, "%s\n", OP);                             \
-       in_section = ENUM;                                              \
-     }                                                                 \
- }
- 
  /* On elf, we *do* have support for the .init and .fini sections, and we
     can put stuff in there to be executed before and after `main'.  We let
     crtstuff.c and other files know this by defining the following symbols.
--- 142,147 ----
Index: config/mips/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/elf.h,v
retrieving revision 1.51
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.51 elf.h
*** config/mips/elf.h	9 Jun 2003 06:55:14 -0000	1.51
--- config/mips/elf.h	7 Jul 2003 15:41:30 -0000
*************** #define SBSS_SECTION_ASM_OP	"\t.section 
*** 94,100 ****
  #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
  do {									\
    if (SIZE > 0 && SIZE <= (unsigned HOST_WIDE_INT)mips_section_threshold)\
!     sbss_section ();							\
    else									\
      bss_section ();							\
    ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT));		\
--- 94,100 ----
  #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
  do {									\
    if (SIZE > 0 && SIZE <= (unsigned HOST_WIDE_INT)mips_section_threshold)\
!     named_section (0, ".sbss", 0);					\
    else									\
      bss_section ();							\
    ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT));		\
*************** #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,
*** 182,209 ****
   } while (0)
  
  #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
- 
- #define TARGET_ASM_UNIQUE_SECTION  mips_unique_section
- 
- /* A list of other sections which the compiler might be "in" at any
-    given time.  */
- #undef  EXTRA_SECTIONS
- #define EXTRA_SECTIONS in_sdata, in_sbss
- 
- #undef  EXTRA_SECTION_FUNCTIONS
- #define EXTRA_SECTION_FUNCTIONS                                         \
-   SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
-   SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP)
- 
- #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP)                               \
- void FN ()                                                            \
- {                                                                     \
-   if (in_section != ENUM)                                             \
-     {                                                                 \
-       fprintf (asm_out_file, "%s\n", OP);                             \
-       in_section = ENUM;                                              \
-     }                                                                 \
- }
  
  /* On elf, we *do* have support for the .init and .fini sections, and we
     can put stuff in there to be executed before and after `main'.  We let
--- 182,187 ----
Index: config/mips/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/linux.h,v
retrieving revision 1.60
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.60 linux.h
*** config/mips/linux.h	1 Jul 2003 05:45:18 -0000	1.60
--- config/mips/linux.h	7 Jul 2003 15:41:30 -0000
*************** #define SBSS_SECTION_ASM_OP	"\t.section 
*** 47,53 ****
  #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)	\
  do {								\
    if (SIZE > 0 && (long)(SIZE) <= mips_section_threshold)	\
!     sbss_section ();						\
    else								\
      bss_section ();						\
    ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT));	\
--- 47,53 ----
  #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)	\
  do {								\
    if (SIZE > 0 && (long)(SIZE) <= mips_section_threshold)	\
!     named_section (0, ".sbss", 0);				\
    else								\
      bss_section ();						\
    ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT));	\
*************** #define ASM_DECLARE_OBJECT_NAME(FILE, NA
*** 77,104 ****
        }									\
      mips_declare_object (FILE, NAME, "", ":\n", 0);			\
    } while (0)
- 
- #define TARGET_ASM_UNIQUE_SECTION  mips_unique_section
- 
- /* A list of other sections which the compiler might be "in" at any
-    given time.  */
- #undef EXTRA_SECTIONS
- #define EXTRA_SECTIONS in_sdata, in_sbss
- 
- #undef EXTRA_SECTION_FUNCTIONS
- #define EXTRA_SECTION_FUNCTIONS                                         \
-   SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
-   SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP)
- 
- #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP)			\
- void FN ()							\
- {								\
-   if (in_section != ENUM)					\
-     {								\
-       fprintf (asm_out_file, "%s\n", OP);			\
-       in_section = ENUM;					\
-     }								\
- }
  
  #undef TARGET_VERSION
  #if TARGET_ENDIAN_DEFAULT == 0
--- 77,82 ----
Index: config/mips/iris6.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris6.h,v
retrieving revision 1.64
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.64 iris6.h
*** config/mips/iris6.h	2 Jul 2003 00:21:56 -0000	1.64
--- config/mips/iris6.h	7 Jul 2003 15:41:30 -0000
*************** #define READONLY_DATA_SECTION_ASM_OP		\
*** 281,310 ****
     ? READONLY_DATA_SECTION_ASM_OP_64		\
     : READONLY_DATA_SECTION_ASM_OP_32)
  
! /* A default list of other sections which we might be "in" at any given
!    time.  For targets that use additional sections (e.g. .tdesc) you
!    should override this definition in the target-specific file which
!    includes this file.  */
! 
! #undef EXTRA_SECTIONS
! #define EXTRA_SECTIONS in_sdata
! 
! /* A default list of extra section function definitions.  For targets
!    that use additional sections (e.g. .tdesc) you should override this
!    definition in the target-specific file which includes this file.  */
  
  #undef EXTRA_SECTION_FUNCTIONS
  #define EXTRA_SECTION_FUNCTIONS						\
- void									\
- sdata_section ()							\
- {									\
-   if (in_section != in_sdata)						\
-     {									\
-       fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP);		\
-       in_section = in_sdata;						\
-     }									\
- }									\
- 									\
  const char *								\
  current_section_name ()							\
  {									\
--- 281,291 ----
     ? READONLY_DATA_SECTION_ASM_OP_64		\
     : READONLY_DATA_SECTION_ASM_OP_32)
  
! /* Define functions to read the name and flags of the current section.
!    They are used by iris6_asm_output_align.  */
  
  #undef EXTRA_SECTION_FUNCTIONS
  #define EXTRA_SECTION_FUNCTIONS						\
  const char *								\
  current_section_name ()							\
  {									\
*************** current_section_name ()							\
*** 313,319 ****
      case no_section:	return NULL;					\
      case in_text:	return ".text";					\
      case in_data:	return ".data";					\
-     case in_sdata:	return ".sdata";				\
      case in_bss:	return ".bss";					\
      case in_readonly_data:						\
        if (mips_abi != ABI_32 && mips_abi != ABI_O64)			\
--- 294,299 ----
*************** current_section_flags ()						\
*** 334,340 ****
      case no_section:	return 0;					\
      case in_text:	return SECTION_CODE;				\
      case in_data:	return SECTION_WRITE;				\
-     case in_sdata:	return SECTION_WRITE | SECTION_SMALL;		\
      case in_bss:	return SECTION_WRITE | SECTION_BSS;		\
      case in_readonly_data: return 0;					\
      case in_named:	return get_named_section_flags (in_named_name);	\
--- 314,319 ----
Index: config/mips/iris6gld.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris6gld.h,v
retrieving revision 1.10
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.10 iris6gld.h
*** config/mips/iris6gld.h	17 May 2002 07:43:33 -0000	1.10
--- config/mips/iris6gld.h	7 Jul 2003 15:41:30 -0000
*************** #define LINK_SPEC "\
*** 49,52 ****
  
  /* The GNU linker supports one-only sections.  */
  #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
- #define TARGET_ASM_UNIQUE_SECTION  mips_unique_section
--- 49,51 ----
Index: config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.272
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.272 mips.h
*** config/mips/mips.h	3 Jul 2003 13:24:04 -0000	1.272
--- config/mips/mips.h	7 Jul 2003 15:41:32 -0000
*************** extern const struct mips_cpu_info mips_c
*** 148,157 ****
  extern const struct mips_cpu_info *mips_arch_info;
  extern const struct mips_cpu_info *mips_tune_info;
  
- /* Functions to change what output section we are using.  */
- extern void		sdata_section PARAMS ((void));
- extern void		sbss_section PARAMS ((void));
- 
  /* Macros to silence warnings about numbers being signed in traditional
     C and unsigned in ISO C when compiled on 32-bit hosts.  */
  
--- 148,153 ----
*************** #define BITMASK_LOWER16	((unsigned long)
*** 168,174 ****
  #define MASK_INT64	   0x00000001	/* ints are 64 bits */
  #define MASK_LONG64	   0x00000002	/* longs are 64 bits */
  #define MASK_SPLIT_ADDR	   0x00000004	/* Address splitting is enabled.  */
! #define MASK_GPOPT	   0x00000008	/* Optimize for global pointer */
  #define MASK_GAS	   0x00000010	/* Gas used instead of MIPS as */
  #define MASK_NAME_REGS	   0x00000020	/* Use MIPS s/w reg name convention */
  #define MASK_EXPLICIT_RELOCS 0x00000040 /* Use relocation operators.  */
--- 164,171 ----
  #define MASK_INT64	   0x00000001	/* ints are 64 bits */
  #define MASK_LONG64	   0x00000002	/* longs are 64 bits */
  #define MASK_SPLIT_ADDR	   0x00000004	/* Address splitting is enabled.  */
! #define MASK_NO_FUSED_MADD 0x00000008   /* Don't generate floating point
! 					   multiply-add operations.  */
  #define MASK_GAS	   0x00000010	/* Gas used instead of MIPS as */
  #define MASK_NAME_REGS	   0x00000020	/* Use MIPS s/w reg name convention */
  #define MASK_EXPLICIT_RELOCS 0x00000040 /* Use relocation operators.  */
*************** #define MASK_BRANCHLIKELY  0x00400000   
*** 193,200 ****
  #define MASK_UNINIT_CONST_IN_RODATA \
  			   0x00800000	/* Store uninitialized
  					   consts in rodata */
- #define MASK_NO_FUSED_MADD 0x01000000   /* Don't generate floating point
- 					   multiply-add operations.  */
  
  					/* Debug switches, not documented */
  #define MASK_DEBUG	0		/* unused */
--- 190,195 ----
*************** #define TARGET_DEBUG_I_MODE	(target_flag
*** 237,245 ****
  					/* Reg. Naming in .s ($21 vs. $a0) */
  #define TARGET_NAME_REGS	(target_flags & MASK_NAME_REGS)
  
- 					/* Optimize for Sdata/Sbss */
- #define TARGET_GP_OPT		(target_flags & MASK_GPOPT)
- 
  					/* call memcpy instead of inline code */
  #define TARGET_MEMCPY		(target_flags & MASK_MEMCPY)
  
--- 232,237 ----
*************** #define TARGET_SWITCHES							\
*** 532,545 ****
       N_("Use symbolic register names")},				\
    {"no-rnames",		 -MASK_NAME_REGS,				\
       N_("Don't use symbolic register names")},				\
!   {"gpOPT",		  MASK_GPOPT,					\
!      N_("Use GP relative sdata/sbss sections")},			\
!   {"gpopt",		  MASK_GPOPT,					\
!      N_("Use GP relative sdata/sbss sections")},			\
!   {"no-gpOPT",		 -MASK_GPOPT,					\
!      N_("Don't use GP relative sdata/sbss sections")},			\
!   {"no-gpopt",		 -MASK_GPOPT,					\
!      N_("Don't use GP relative sdata/sbss sections")},			\
    {"stats",		  0,						\
       N_("Output compiler statistics (now ignored)")},			\
    {"no-stats",		  0,						\
--- 524,537 ----
       N_("Use symbolic register names")},				\
    {"no-rnames",		 -MASK_NAME_REGS,				\
       N_("Don't use symbolic register names")},				\
!   {"gpOPT",		  0,						\
!      N_("Use GP relative sdata/sbss sections (now ignored)")},		\
!   {"gpopt",		  0,						\
!      N_("Use GP relative sdata/sbss sections (now ignored)")},		\
!   {"no-gpOPT",		  0,					\
!      N_("Don't use GP relative sdata/sbss sections (now ignored)")},	\
!   {"no-gpopt",		  0,					\
!      N_("Don't use GP relative sdata/sbss sections (now ignored)")},	\
    {"stats",		  0,						\
       N_("Output compiler statistics (now ignored)")},			\
    {"no-stats",		  0,						\
*************** #define SDATA_SECTION_ASM_OP	"\t.sdata"	
*** 3862,3896 ****
  
  #undef READONLY_DATA_SECTION_ASM_OP
  #define READONLY_DATA_SECTION_ASM_OP	"\t.rdata"	/* read-only data */
- 
- #define SMALL_DATA_SECTION	sdata_section
- 
- /* What other sections we support other than the normal .data/.text.  */
- 
- #undef EXTRA_SECTIONS
- #define EXTRA_SECTIONS in_sdata
- 
- /* Define the additional functions to select our additional sections.  */
- 
- /* on the MIPS it is not a good idea to put constants in the text
-    section, since this defeats the sdata/data mechanism. This is
-    especially true when -O is used. In this case an effort is made to
-    address with faster (gp) register relative addressing, which can
-    only get at sdata and sbss items (there is no stext !!)  However,
-    if the constant is too large for sdata, and it's readonly, it
-    will go into the .rdata section.  */
- 
- #undef EXTRA_SECTION_FUNCTIONS
- #define EXTRA_SECTION_FUNCTIONS						\
- void									\
- sdata_section ()							\
- {									\
-   if (in_section != in_sdata)						\
-     {									\
-       fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP);		\
-       in_section = in_sdata;						\
-     }									\
- }
  
  /* Given a decl node or constant node, choose the section to output it in
     and select that section.  */
--- 3854,3859 ----
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.286
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.286 mips.c
*** config/mips/mips.c	3 Jul 2003 12:34:07 -0000	1.286
--- config/mips/mips.c	7 Jul 2003 15:41:34 -0000
*************** static hashval_t iris_section_align_entr
*** 282,287 ****
--- 282,289 ----
  static int iris6_section_align_1		PARAMS ((void **, void *));
  static void iris6_file_start			PARAMS ((void));
  static void iris6_file_end			PARAMS ((void));
+ static unsigned int iris6_section_type_flags	PARAMS ((tree, const char *,
+ 							 int));
  #endif
  static int mips_adjust_cost			PARAMS ((rtx, rtx, rtx, int));
  static int mips_issue_rate			PARAMS ((void));
*************** static int mips_issue_rate			PARAMS ((vo
*** 289,301 ****
  static struct machine_function * mips_init_machine_status PARAMS ((void));
  static void mips_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT))
  	ATTRIBUTE_UNUSED;
- static void mips_unique_section			PARAMS ((tree, int))
- 	ATTRIBUTE_UNUSED;
  static void mips_select_rtx_section PARAMS ((enum machine_mode, rtx,
  					     unsigned HOST_WIDE_INT));
  static int mips_use_dfa_pipeline_interface      PARAMS ((void));
  static bool mips_rtx_costs			PARAMS ((rtx, int, int, int *));
  static int mips_address_cost                    PARAMS ((rtx));
  static void mips_encode_section_info            PARAMS ((tree, rtx, int));
  static void mips_file_start			PARAMS ((void));
  static void mips_file_end			PARAMS ((void));
--- 291,302 ----
  static struct machine_function * mips_init_machine_status PARAMS ((void));
  static void mips_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT))
  	ATTRIBUTE_UNUSED;
  static void mips_select_rtx_section PARAMS ((enum machine_mode, rtx,
  					     unsigned HOST_WIDE_INT));
  static int mips_use_dfa_pipeline_interface      PARAMS ((void));
  static bool mips_rtx_costs			PARAMS ((rtx, int, int, int *));
  static int mips_address_cost                    PARAMS ((rtx));
+ static bool mips_in_small_data_p		PARAMS ((tree));
  static void mips_encode_section_info            PARAMS ((tree, rtx, int));
  static void mips_file_start			PARAMS ((void));
  static void mips_file_end			PARAMS ((void));
*************** #define TARGET_DELEGITIMIZE_ADDRESS mips
*** 888,893 ****
--- 889,896 ----
  
  #undef TARGET_ENCODE_SECTION_INFO
  #define TARGET_ENCODE_SECTION_INFO mips_encode_section_info
+ #undef TARGET_IN_SMALL_DATA_P
+ #define TARGET_IN_SMALL_DATA_P mips_in_small_data_p
  
  #undef TARGET_MACHINE_DEPENDENT_REORG
  #define TARGET_MACHINE_DEPENDENT_REORG mips_reorg
*************** #define TARGET_ASM_FILE_END mips_file_en
*** 904,909 ****
--- 907,917 ----
  #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
  #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
  
+ #ifdef TARGET_IRIX6
+ #undef TARGET_SECTION_TYPE_FLAGS
+ #define TARGET_SECTION_TYPE_FLAGS iris6_section_type_flags
+ #endif
+ 
  struct gcc_target targetm = TARGET_INITIALIZER;
  
  /* If X is one of the constants described by mips_constant_type,
*************** mips_classify_symbol (x)
*** 995,1004 ****
  	return SYMBOL_GOT_LOCAL;
      }
  
    if (TARGET_ABICALLS)
      return (SYMBOL_REF_FLAG (x) ? SYMBOL_GOT_LOCAL : SYMBOL_GOT_GLOBAL);
  
!   return (SYMBOL_REF_FLAG (x) ? SYMBOL_SMALL_DATA : SYMBOL_GENERAL);
  }
  
  
--- 1003,1015 ----
  	return SYMBOL_GOT_LOCAL;
      }
  
+   if (SYMBOL_REF_SMALL_P (x))
+     return SYMBOL_SMALL_DATA;
+ 
    if (TARGET_ABICALLS)
      return (SYMBOL_REF_FLAG (x) ? SYMBOL_GOT_LOCAL : SYMBOL_GOT_GLOBAL);
  
!   return SYMBOL_GENERAL;
  }
  
  
*************** override_options ()
*** 4852,4862 ****
  
    mips_section_threshold = g_switch_set ? g_switch_value : MIPS_DEFAULT_GVALUE;
  
-   if (mips_section_threshold <= 0)
-     target_flags &= ~MASK_GPOPT;
-   else if (optimize)
-     target_flags |= MASK_GPOPT;
- 
    /* Interpret -mabi.  */
    mips_abi = MIPS_ABI_DEFAULT;
    if (mips_abi_string != 0)
--- 4863,4868 ----
*************** override_options ()
*** 5057,5066 ****
       do this, it was very invasive and fragile.  It no longer seems
       worth the effort.  */
    if (!TARGET_EXPLICIT_RELOCS && !TARGET_GAS)
!     {
!       mips_section_threshold = 0;
!       target_flags &= ~MASK_GPOPT;
!     }
  
    /* -membedded-pic is a form of PIC code suitable for embedded
       systems.  All calls are made using PC relative addressing, and
--- 5063,5069 ----
       do this, it was very invasive and fragile.  It no longer seems
       worth the effort.  */
    if (!TARGET_EXPLICIT_RELOCS && !TARGET_GAS)
!     mips_section_threshold = 0;
  
    /* -membedded-pic is a form of PIC code suitable for embedded
       systems.  All calls are made using PC relative addressing, and
*************** mips_assemble_integer (x, size, aligned_
*** 5906,5921 ****
    return default_assemble_integer (x, size, aligned_p);
  }
  
! /* If optimizing for the global pointer, keep track of all of the externs, so
!    that at the end of the file, we can emit the appropriate .extern
!    declaration for them, before writing out the text section.  We assume all
!    names passed to us are in the permanent obstack, so they will be valid at
!    the end of the compilation.
  
!    If we have -G 0, or the extern size is unknown, or the object is in a user
!    specified section that is not .sbss/.sdata, don't bother emitting the
!    .externs.  In the case of user specified sections this behavior is
!    required as otherwise GAS will think the object lives in .sbss/.sdata.  */
  
  int
  mips_output_external (file, decl, name)
--- 5909,5921 ----
    return default_assemble_integer (x, size, aligned_p);
  }
  
! /* When using assembler macros, keep track of all of small-data externs
!    so that mips_file_end can emit the appropriate declarations for them.
  
!    In most cases it would be safe (though pointless) to emit .externs
!    for other symbols too.  One exception is when an object is within
!    the -G limit but declared by the user to be in a section other
!    than .sbss or .sdata.  */
  
  int
  mips_output_external (file, decl, name)
*************** mips_output_external (file, decl, name)
*** 5924,5944 ****
       const char *name;
  {
    register struct extern_list *p;
-   int len;
-   tree section_name;
  
!   if (TARGET_GP_OPT
!       && TREE_CODE (decl) != FUNCTION_DECL
!       && !DECL_COMDAT (decl)
!       && (len = int_size_in_bytes (TREE_TYPE (decl))) > 0
!       && ((section_name = DECL_SECTION_NAME (decl)) == NULL
! 	  || strcmp (TREE_STRING_POINTER (section_name), ".sbss") == 0
! 	  || strcmp (TREE_STRING_POINTER (section_name), ".sdata") == 0))
      {
        p = (struct extern_list *) ggc_alloc (sizeof (struct extern_list));
        p->next = extern_head;
        p->name = name;
!       p->size = len;
        extern_head = p;
      }
  
--- 5924,5936 ----
       const char *name;
  {
    register struct extern_list *p;
  
!   if (!TARGET_EXPLICIT_RELOCS && mips_in_small_data_p (decl))
      {
        p = (struct extern_list *) ggc_alloc (sizeof (struct extern_list));
        p->next = extern_head;
        p->name = name;
!       p->size = int_size_in_bytes (TREE_TYPE (decl));
        extern_head = p;
      }
  
*************** mips_file_end ()
*** 6250,6257 ****
      }
  }
  
! /* Emit either a label, .comm, or .lcomm directive, and mark that the symbol
!    is used, so that we don't emit an .extern for it in mips_file_end.  */
  
  void
  mips_declare_object (stream, name, init_string, final_string, size)
--- 6242,6250 ----
      }
  }
  
! /* Emit either a label, .comm, or .lcomm directive.  When using assembler
!    macros, mark the symbol as written so that mips_file_end won't emit an
!    .extern for it.  */
  
  void
  mips_declare_object (stream, name, init_string, final_string, size)
*************** mips_declare_object (stream, name, init_
*** 6265,6271 ****
    assemble_name (stream, name);
    fprintf (stream, final_string, size);	/* ":\n", ",%u\n", ",%u\n" */
  
!   if (TARGET_GP_OPT)
      {
        tree name_tree = get_identifier (name);
        TREE_ASM_WRITTEN (name_tree) = 1;
--- 6258,6264 ----
    assemble_name (stream, name);
    fprintf (stream, final_string, size);	/* ":\n", ",%u\n", ",%u\n" */
  
!   if (!TARGET_EXPLICIT_RELOCS)
      {
        tree name_tree = get_identifier (name);
        TREE_ASM_WRITTEN (name_tree) = 1;
*************** mips_select_rtx_section (mode, x, align)
*** 7812,7822 ****
  
        if (GET_MODE_SIZE (mode) <= (unsigned) mips_section_threshold
  	  && mips_section_threshold > 0)
! 	SMALL_DATA_SECTION ();
        else if (flag_pic && symbolic_expression_p (x))
  	{
  	  if (targetm.have_named_sections)
! 	    named_section (NULL_TREE, ".data.rel.ro", 3);
  	  else
  	    data_section ();
  	}
--- 7805,7815 ----
  
        if (GET_MODE_SIZE (mode) <= (unsigned) mips_section_threshold
  	  && mips_section_threshold > 0)
! 	named_section (0, ".sdata", 0);
        else if (flag_pic && symbolic_expression_p (x))
  	{
  	  if (targetm.have_named_sections)
! 	    named_section (0, ".data.rel.ro", 3);
  	  else
  	    data_section ();
  	}
*************** mips_select_rtx_section (mode, x, align)
*** 7826,7834 ****
  }
  
  /* Choose the section to use for DECL.  RELOC is true if its value contains
!    any relocatable expression.
! 
!    ??? This would be fixed by implementing targetm.is_small_data_p.  */
  
  static void
  mips_select_section (decl, reloc, align)
--- 7819,7825 ----
  }
  
  /* Choose the section to use for DECL.  RELOC is true if its value contains
!    any relocatable expression.  */
  
  static void
  mips_select_section (decl, reloc, align)
*************** mips_select_section (decl, reloc, align)
*** 7836,7843 ****
       int reloc;
       unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED;
  {
-   int size = int_size_in_bytes (TREE_TYPE (decl));
- 
    if ((TARGET_EMBEDDED_PIC || TARGET_MIPS16)
        && TREE_CODE (decl) == STRING_CST
        && !flag_writable_strings)
--- 7827,7832 ----
*************** mips_select_section (decl, reloc, align)
*** 7846,7899 ****
         For mips16 code, put strings in the text section so that a PC
         relative load instruction can be used to get their address.  */
      text_section ();
!   else if (TARGET_EMBEDDED_DATA)
      {
!       /* For embedded applications, always put an object in read-only data
! 	 if possible, in order to reduce RAM usage.  */
  
!       if (((TREE_CODE (decl) == VAR_DECL
! 	    && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
! 	    && DECL_INITIAL (decl)
! 	    && (DECL_INITIAL (decl) == error_mark_node
! 		|| TREE_CONSTANT (DECL_INITIAL (decl))))
! 	   /* Deal with calls from output_constant_def_contents.  */
! 	   || (TREE_CODE (decl) != VAR_DECL
! 	       && (TREE_CODE (decl) != STRING_CST
! 		   || !flag_writable_strings)))
! 	  && ! (flag_pic && reloc))
! 	readonly_data_section ();
!       else if (size > 0 && size <= mips_section_threshold)
! 	SMALL_DATA_SECTION ();
!       else
! 	data_section ();
      }
!   else
      {
!       /* For hosted applications, always put an object in small data if
! 	 possible, as this gives the best performance.  */
  
!       if (size > 0 && size <= mips_section_threshold)
! 	SMALL_DATA_SECTION ();
!       else if (((TREE_CODE (decl) == VAR_DECL
! 		 && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
! 		 && DECL_INITIAL (decl)
! 		 && (DECL_INITIAL (decl) == error_mark_node
! 		     || TREE_CONSTANT (DECL_INITIAL (decl))))
! 		/* Deal with calls from output_constant_def_contents.  */
! 		|| (TREE_CODE (decl) != VAR_DECL
! 		    && (TREE_CODE (decl) != STRING_CST
! 			|| !flag_writable_strings)))
! 	       && ! (flag_pic && reloc))
! 	readonly_data_section ();
!       else
! 	data_section ();
      }
  }
  
- /* When optimizing for the $gp pointer, SYMBOL_REF_FLAG is set for all
-    small objects.
  
!    When generating embedded PIC code, SYMBOL_REF_FLAG is set for
     symbols which are not in the .text section.
  
     When generating mips16 code, SYMBOL_REF_FLAG is set for string
--- 7835,7900 ----
         For mips16 code, put strings in the text section so that a PC
         relative load instruction can be used to get their address.  */
      text_section ();
!   else
!     default_elf_select_section (decl, reloc, align);
! }
! 
! 
! /* Implement TARGET_IN_SMALL_DATA_P.  Return true if it would be safe to
!    access DECL using %gp_rel(...)($gp).  */
! 
! static bool
! mips_in_small_data_p (decl)
!      tree decl;
! {
!   HOST_WIDE_INT size;
! 
!   if (TREE_CODE (decl) == STRING_CST || TREE_CODE (decl) == FUNCTION_DECL)
!     return false;
! 
!   if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl) != 0)
      {
!       const char *name;
  
!       /* Reject anything that isn't in a known small-data section.  */
!       name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
!       if (strcmp (name, ".sdata") != 0 && strcmp (name, ".sbss") != 0)
! 	return false;
! 
!       /* If a symbol is defined externally, the assembler will use the
! 	 usual -G rules when deciding how to implement macros.  */
!       if (TARGET_EXPLICIT_RELOCS || !DECL_EXTERNAL (decl))
! 	return true;
      }
!   else if (TARGET_EMBEDDED_DATA)
      {
!       /* Don't put constants into the small data section: we want them
! 	 to be in ROM rather than RAM.  */
!       if (TREE_CODE (decl) != VAR_DECL)
! 	return false;
  
!       if (TREE_READONLY (decl)
! 	  && !TREE_SIDE_EFFECTS (decl)
! 	  && (!DECL_INITIAL (decl) || TREE_CONSTANT (DECL_INITIAL (decl))))
! 	return false;
      }
+   else if (TARGET_MIPS16)
+     {
+       /* Alhough it seems strange to have separate rules for -mips16,
+ 	 this behaviour is long-standing.  */
+       if (TREE_PUBLIC (decl)
+ 	  && (DECL_COMMON (decl)
+ 	      || DECL_ONE_ONLY (decl)
+ 	      || DECL_WEAK (decl)))
+ 	return false;
+     }
+ 
+   size = int_size_in_bytes (TREE_TYPE (decl));
+   return (size > 0 && size <= mips_section_threshold);
  }
  
  
! /* When generating embedded PIC code, SYMBOL_REF_FLAG is set for
     symbols which are not in the .text section.
  
     When generating mips16 code, SYMBOL_REF_FLAG is set for string
*************** mips_select_section (decl, reloc, align)
*** 7902,7921 ****
     whether we need to split the constant table, and need not be
     precisely correct.
  
!    When not mips16 code nor embedded PIC, if a symbol is in a
!    gp addressable section, SYMBOL_REF_FLAG is set prevent gcc from
!    splitting the reference so that gas can generate a gp relative
!    reference.
! 
!    When TARGET_EMBEDDED_DATA is set, we assume that all const
!    variables will be stored in ROM, which is too far from %gp to use
!    %gprel addressing.  Note that (1) we include "extern const"
!    variables in this, which mips_select_section doesn't, and (2) we
!    can't always tell if they're really const (they might be const C++
!    objects with non-const constructors), so we err on the side of
!    caution and won't use %gprel anyway (otherwise we'd have to defer
!    this decision to the linker/loader).  The handling of extern consts
!    is why the DECL_INITIAL macros differ from mips_select_section.  */
  
  static void
  mips_encode_section_info (decl, rtl, first)
--- 7903,7910 ----
     whether we need to split the constant table, and need not be
     precisely correct.
  
!    When generating -mabicalls code, SYMBOL_REF_FLAG is set if we
!    should treat the symbol as SYMBOL_GOT_LOCAL.  */
  
  static void
  mips_encode_section_info (decl, rtl, first)
*************** mips_encode_section_info (decl, rtl, fir
*** 7957,7972 ****
          }
      }
  
!   if (TARGET_EMBEDDED_DATA
!       && (TREE_CODE (decl) == VAR_DECL
!           && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl))
!       && (!DECL_INITIAL (decl)
!           || TREE_CONSTANT (DECL_INITIAL (decl))))
!     {
!       SYMBOL_REF_FLAG (symbol) = 0;
!     }
! 
!   else if (TARGET_EMBEDDED_PIC)
      {
        if (TREE_CODE (decl) == VAR_DECL)
          SYMBOL_REF_FLAG (symbol) = 1;
--- 7946,7952 ----
          }
      }
  
!   if (TARGET_EMBEDDED_PIC)
      {
        if (TREE_CODE (decl) == VAR_DECL)
          SYMBOL_REF_FLAG (symbol) = 1;
*************** mips_encode_section_info (decl, rtl, fir
*** 8008,8039 ****
          SYMBOL_REF_FLAG (symbol) = 1;
      }
  
!   else if (TREE_CODE (decl) == VAR_DECL
!            && DECL_SECTION_NAME (decl) != NULL_TREE
!            && (0 == strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
!                             ".sdata")
!                || 0 == strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
!                                ".sbss")))
!     {
!       SYMBOL_REF_FLAG (symbol) = 1;
!     }
! 
!   /* We can not perform GP optimizations on variables which are in
!        specific sections, except for .sdata and .sbss which are
!        handled above.  */
!   else if (TARGET_GP_OPT && TREE_CODE (decl) == VAR_DECL
!            && DECL_SECTION_NAME (decl) == NULL_TREE
!            && ! (TARGET_MIPS16 && TREE_PUBLIC (decl)
!                  && (DECL_COMMON (decl)
!                      || DECL_ONE_ONLY (decl)
!                      || DECL_WEAK (decl))))
!     {
!       int size = int_size_in_bytes (TREE_TYPE (decl));
! 
!       if (size > 0 && size <= mips_section_threshold)
!         SYMBOL_REF_FLAG (symbol) = 1;
!     }
! 
  }
  
  
--- 7988,7994 ----
          SYMBOL_REF_FLAG (symbol) = 1;
      }
  
!   default_encode_section_info (decl, rtl, first);
  }
  
  
*************** mips_adjust_cost (insn, link, dep, cost)
*** 10243,10323 ****
    return cost;
  }
  
- /* ??? This could be replaced with the default elf version if
-    TARGET_IS_SMALL_DATA_P is set properly.  */
- 
- static void
- mips_unique_section (decl, reloc)
-      tree decl;
-      int reloc;
- {
-   int len, size, sec;
-   const char *name, *prefix;
-   char *string;
-   static const char *const prefixes[4][2] = {
-     { ".text.", ".gnu.linkonce.t." },
-     { ".rodata.", ".gnu.linkonce.r." },
-     { ".data.", ".gnu.linkonce.d." },
-     { ".sdata.", ".gnu.linkonce.s." }
-   };
- 
-   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-   name = (* targetm.strip_name_encoding) (name);
-   size = int_size_in_bytes (TREE_TYPE (decl));
- 
-   /* Determine the base section we are interested in:
-      0=text, 1=rodata, 2=data, 3=sdata, [4=bss].  */
-   if (TREE_CODE (decl) == FUNCTION_DECL)
-     sec = 0;
-   else if (DECL_INITIAL (decl) == 0
-            || DECL_INITIAL (decl) == error_mark_node)
-     sec = 2;
-   else if ((TARGET_EMBEDDED_PIC || TARGET_MIPS16)
-       && TREE_CODE (decl) == STRING_CST
-       && !flag_writable_strings)
-     {
-       /* For embedded position independent code, put constant
- 	 strings in the text section, because the data section
- 	 is limited to 64K in size.  For mips16 code, put
- 	 strings in the text section so that a PC relative load
- 	 instruction can be used to get their address.  */
-       sec = 0;
-     }
-   else if (TARGET_EMBEDDED_DATA)
-     {
-       /* For embedded applications, always put an object in
- 	 read-only data if possible, in order to reduce RAM
- 	 usage.  */
- 
-       if (decl_readonly_section (decl, reloc))
- 	sec = 1;
-       else if (size > 0 && size <= mips_section_threshold)
- 	sec = 3;
-       else
- 	sec = 2;
-     }
-   else
-     {
-       /* For hosted applications, always put an object in
- 	 small data if possible, as this gives the best
- 	 performance.  */
- 
-       if (size > 0 && size <= mips_section_threshold)
- 	sec = 3;
-       else if (decl_readonly_section (decl, reloc))
- 	sec = 1;
-       else
- 	sec = 2;
-     }
- 
-   prefix = prefixes[sec][DECL_ONE_ONLY (decl)];
-   len = strlen (name) + strlen (prefix);
-   string = alloca (len + 1);
-   sprintf (string, "%s%s", prefix, name);
- 
-   DECL_SECTION_NAME (decl) = build_string (len, string);
- }
- 
  unsigned int
  mips_hard_regno_nregs (regno, mode)
      int regno;
--- 10198,10203 ----
*************** iris6_file_end ()
*** 10585,10590 ****
--- 10465,10496 ----
  
    mips_file_end ();
  }
+ 
+ 
+ /* Implement TARGET_SECTION_TYPE_FLAGS.  Make sure that .sdata and
+    .sbss sections get the SECTION_SMALL flag: this isn't set by the
+    default code.  */
+ 
+ static unsigned int
+ iris6_section_type_flags (decl, section, relocs_p)
+      tree decl;
+      const char *section;
+      int relocs_p;
+ {
+   unsigned int flags;
+ 
+   flags = default_section_type_flags (decl, section, relocs_p);
+ 
+   if (strcmp (section, ".sdata") == 0
+       || strcmp (section, ".sbss") == 0
+       || strncmp (section, ".gnu.linkonce.s.", 16) == 0
+       || strncmp (section, ".gnu.linkonce.sb.", 17) == 0)
+     flags |= SECTION_SMALL;
+ 
+   return flags;
+ }
+ 
+ 
  #endif /* TARGET_IRIX6 */
  
  #include "gt-mips.h"
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.308
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.308 invoke.texi
*** doc/invoke.texi	5 Jul 2003 00:19:47 -0000	1.308
--- doc/invoke.texi	7 Jul 2003 15:41:39 -0000
*************** in the following sections.
*** 465,478 ****
  @gccoptlist{-mabicalls  -march=@var{cpu-type}  -mtune=@var{cpu=type} @gol
  -mcpu=@var{cpu-type}  -membedded-data  -muninit-const-in-rodata @gol
  -membedded-pic  -mfp32  -mfp64  -mfused-madd  -mno-fused-madd @gol
! -mgas  -mgp32  -mgp64 @gol
! -mgpopt  -mhalf-pic  -mhard-float  -mint64  -mips1 @gol
  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
  -mlong64  -mlong32  -mlong-calls  -mmemcpy @gol
  -mmips-as  -mmips-tfile  -mno-abicalls @gol
  -mno-embedded-data  -mno-uninit-const-in-rodata @gol
! -mno-embedded-pic  -mno-gpopt  -mno-long-calls @gol
! -mno-memcpy  -mno-mips-tfile  -mno-rnames  -mno-stats @gol
  -mrnames  -msoft-float @gol
  -m4650  -msingle-float  -mmad @gol
  -EL  -EB  -G @var{num}  -nocpp @gol
--- 465,477 ----
  @gccoptlist{-mabicalls  -march=@var{cpu-type}  -mtune=@var{cpu=type} @gol
  -mcpu=@var{cpu-type}  -membedded-data  -muninit-const-in-rodata @gol
  -membedded-pic  -mfp32  -mfp64  -mfused-madd  -mno-fused-madd @gol
! -mgas  -mgp32  -mgp64  -mhard-float  -mint64  -mips1 @gol
  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
  -mlong64  -mlong32  -mlong-calls  -mmemcpy @gol
  -mmips-as  -mmips-tfile  -mno-abicalls @gol
  -mno-embedded-data  -mno-uninit-const-in-rodata @gol
! -mno-embedded-pic  -mno-long-calls @gol
! -mno-memcpy  -mno-mips-tfile  -mno-rnames @gol
  -mrnames  -msoft-float @gol
  -m4650  -msingle-float  -mmad @gol
  -EL  -EB  -G @var{num}  -nocpp @gol
*************** names for the registers, instead of the 
*** 7950,7965 ****
  instead of @var{$4}).  The only known assembler that supports this option
  is the Algorithmics assembler.
  
- @item -mgpopt
- @itemx -mno-gpopt
- @opindex mgpopt
- @opindex mno-gpopt
- The @option{-mgpopt} switch says to write all of the data declarations
- before the instructions in the text section, this allows the MIPS
- assembler to generate one word memory references instead of using two
- words for short global or static data items.  This is on by default if
- optimization is selected.
- 
  @item -mmemcpy
  @itemx -mno-memcpy
  @opindex mmemcpy
--- 7949,7954 ----
*************** Do all calls with the @samp{JALR} instru
*** 8013,8025 ****
  loading up a function's address into a register before the call.
  You need to use this switch, if you call outside of the current
  512 megabyte segment to functions that are not through pointers.
- 
- @item -mhalf-pic
- @itemx -mno-half-pic
- @opindex mhalf-pic
- @opindex mno-half-pic
- Put pointers to extern references into the data section and load them
- up, rather than put the references in the text section.
  
  @item -membedded-pic
  @itemx -mno-embedded-pic
--- 8002,8007 ----
*** /dev/null	Tue Jun 17 23:06:41 2003
--- testsuite/gcc.dg/compat/sdata-1_main.c	Mon Jul  7 16:46:07 2003
***************
*** 0 ****
--- 1,12 ----
+ /* Check that sdata qualification doesn't produce out-of-range relocations
+    and that compilers agree on the way these declarations are handled.  */
+ 
+ extern void sdata_1_x (void);
+ extern void exit (int);
+ 
+ int
+ main ()
+ {
+   sdata_1_x ();
+   exit (0);
+ }
*** /dev/null	Tue Jun 17 23:06:41 2003
--- testsuite/gcc.dg/compat/sdata-1_x.c	Mon Jul  7 16:46:07 2003
***************
*** 0 ****
--- 1,25 ----
+ #include "sdata-section.h"
+ 
+ struct s { int x; int y[4]; };
+ extern struct s small_struct SDATA_SECTION;
+ 
+ /* Test "load address" operations.  */
+ int *xaddr (void) { return &small_struct.x; }
+ int *yaddr (int i) { return &small_struct.y[i]; }
+ 
+ void sdata_1_x (void)
+ {
+   int i;
+ 
+   /* Test direct accesses.  */
+   small_struct.x = 5;
+   for (i = 0; i < 4; i++)
+     small_struct.y[i] = i + 42;
+ 
+   if (*xaddr () != 5)
+     abort ();
+ 
+   for (i = 0; i < 4; i++)
+     if (*yaddr (i) != i + 42)
+       abort ();
+ }
*** /dev/null	Tue Jun 17 23:06:41 2003
--- testsuite/gcc.dg/compat/sdata-1_y.c	Mon Jul  7 16:46:07 2003
***************
*** 0 ****
--- 1,4 ----
+ #include "sdata-section.h"
+ 
+ struct s { int x; int y[4]; };
+ struct s small_struct SDATA_SECTION;
*** /dev/null	Tue Jun 17 23:06:41 2003
--- testsuite/gcc.dg/compat/sdata-section.h	Mon Jul  7 16:46:07 2003
***************
*** 0 ****
--- 1,5 ----
+ #ifdef __mips
+ #define SDATA_SECTION __attribute__((__section__(".sdata")))
+ #else
+ #define SDATA_SECTION
+ #endif
*** /dev/null	Tue Jun 17 23:06:41 2003
--- testsuite/gcc.dg/torture/mips-sdata-1.c	Mon Jul  7 16:47:02 2003
***************
*** 0 ****
--- 1,10 ----
+ /* Check that sdata-accesses are applied regardless of size or ABI.  */
+ /* { dg-options -mexplicit-relocs } */
+ /* { dg-do compile { target mips*-*-* } } */
+ 
+ struct s { int x[4]; };
+ struct s my_struct __attribute__((__section__(".sdata")));
+ 
+ int f() { return my_struct.x[3]; }
+ 
+ /* { dg-final { scan-assembler {gp_?rel\(my_struct} } } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]