diff options
author | Richard Henderson <rth@redhat.com> | 2002-03-02 20:23:21 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2002-03-02 20:23:21 -0800 |
commit | b20032503b0ecc63b4ce05e65fda684b47afef3b (patch) | |
tree | 0c4d8b48d85a563b3f4acbe81debdbebc7911eac /gcc/config | |
parent | 5c60f03d436955a225fd4e255af691f5782232f4 (diff) | |
download | gcc-b20032503b0ecc63b4ce05e65fda684b47afef3b.zip gcc-b20032503b0ecc63b4ce05e65fda684b47afef3b.tar.gz gcc-b20032503b0ecc63b4ce05e65fda684b47afef3b.tar.bz2 |
varasm.c (make_decl_rtl): Remove call to REDO_SECTION_INFO_P; invoke ENCODE_SECTION_INFO with first call flag.
* varasm.c (make_decl_rtl): Remove call to REDO_SECTION_INFO_P;
invoke ENCODE_SECTION_INFO with first call flag.
* config/darwin-protos.h, config/darwin.c, config/darwin.h,
config/a29k/a29k.h, config/alpha/alpha-protos.h, config/alpha/alpha.c,
config/alpha/alpha.h, config/arc/arc.h, config/arm/arm-protos.h,
config/arm/arm.h, config/arm/pe.c, config/arm/pe.h,
config/avr/avr-protos.h, config/avr/avr.c, config/avr/avr.h,
config/c4x/c4x-protos.h, config/c4x/c4x.c, config/c4x/c4x.h,
config/cris/cris-protos.h, config/cris/cris.c, config/cris/cris.h,
config/d30v/d30v.h, config/h8300/h8300.h, config/i370/i370.h,
config/i386/cygwin.h, config/i386/i386-interix.h, config/i386/i386.h,
config/i386/osfrose.h, config/i386/win32.h, config/i386/winnt.c,
config/ia64/ia64-protos.h, config/ia64/ia64.c, config/ia64/ia64.h,
config/m32r/m32r-protos.h, config/m32r/m32r.c, config/m32r/m32r.h,
config/m68hc11/m68hc11-protos.h, config/m68hc11/m68hc11.c,
config/m68hc11/m68hc11.h, config/m88k/m88k.h,
config/mcore/mcore-protos.h, config/mcore/mcore.c,
config/mcore/mcore.h, config/mips/mips.h, config/ns32k/ns32k.h,
config/pa/pa.h, config/romp/romp.h, config/rs6000/linux64.h,
config/rs6000/rs6000-protos.h, config/rs6000/rs6000.c,
config/rs6000/sysv4.h, config/rs6000/xcoff.h, config/s390/s390.h,
config/sh/sh.h, config/sparc/sparc.h,
config/stormy16/stormy16-protos.h, config/stormy16/stormy16.c,
config/stormy16/stormy16.h, config/v850/v850.h, config/vax/vms.h,
config/xtensa/xtensa.h, doc/tm.texi: ENCODE_SECTION_INFO now takes
FIRST argument. As needed, examine it and do nothing.
* config/darwin.h, config/alpha/alpha.h, config/arm/pe.h,
config/i386/cygwin.h, config/ia64/ia64.h, config/m68hc11/m68hc11.h,
config/mcore/mcore.h: Remove REDO_SECTION_INFO_P.
* config/arm/t-pe (pe.o): Add dependencies.
From-SVN: r50236
Diffstat (limited to 'gcc/config')
62 files changed, 170 insertions, 201 deletions
diff --git a/gcc/config/a29k/a29k.h b/gcc/config/a29k/a29k.h index f499ea1..2c98d12 100644 --- a/gcc/config/a29k/a29k.h +++ b/gcc/config/a29k/a29k.h @@ -1366,7 +1366,7 @@ literal_section () \ that we can branch to this function without emitting a no-op after the call. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ if (TREE_CODE (DECL) == FUNCTION_DECL \ && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL))) \ SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h index c6fdd04..0ccdaaa 100644 --- a/gcc/config/alpha/alpha-protos.h +++ b/gcc/config/alpha/alpha-protos.h @@ -165,7 +165,7 @@ extern void alpha_start_function PARAMS ((FILE *, const char *, tree)); extern void alpha_end_function PARAMS ((FILE *, const char *, tree)); extern void alpha_output_mi_thunk_osf PARAMS ((FILE *, tree, HOST_WIDE_INT, tree)); -extern void alpha_encode_section_info PARAMS ((tree)); +extern void alpha_encode_section_info PARAMS ((tree, int)); #endif /* TREE CODE */ #ifdef RTX_CODE diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index aea7471..5875346 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -1554,8 +1554,9 @@ decl_in_text_section (decl) then add "@s" instead. */ void -alpha_encode_section_info (decl) +alpha_encode_section_info (decl, first) tree decl; + int first ATTRIBUTE_UNUSED; { const char *symbol_str; bool is_local, is_small; diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 6d78d3f..3ea6556 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -1797,16 +1797,8 @@ literal_section () \ depending on something about the variable or function named by the symbol (such as what section it is in). */ -#define ENCODE_SECTION_INFO(DECL) alpha_encode_section_info (DECL) - -/* If a variable is weakened, made one only or moved into a different - section, it may be necessary to redo the section info to move the - variable out of sdata. */ - -#define REDO_SECTION_INFO_P(DECL) \ - ((TREE_CODE (DECL) == VAR_DECL) \ - && (DECL_ONE_ONLY (DECL) || DECL_WEAK (DECL) || DECL_COMMON (DECL) \ - || DECL_SECTION_NAME (DECL) != 0)) +#define ENCODE_SECTION_INFO(DECL, FIRST) \ + alpha_encode_section_info (DECL, FIRST) #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ do { \ diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 0a83854..29edf4e 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -1139,7 +1139,7 @@ extern const char *arc_text_section, *arc_data_section, *arc_rodata_section; Branch to absolute address insns take an address that is right-shifted by 2. We encode the fact that we have a function here, and then emit a special assembler op when outputting the address. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do { \ if (TREE_CODE (DECL) == FUNCTION_DECL) \ SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index b42da823..036ea44 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -185,7 +185,7 @@ extern int arm_dllimport_name_p PARAMS ((const char *)); #ifdef TREE_CODE extern void arm_pe_unique_section PARAMS ((tree, int)); -extern void arm_pe_encode_section_info PARAMS ((tree)); +extern void arm_pe_encode_section_info PARAMS ((tree, int)); extern int arm_dllexport_p PARAMS ((tree)); extern int arm_dllimport_p PARAMS ((tree)); extern void arm_mark_dllexport PARAMS ((tree)); diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 8f4c4a1..853db6d 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1912,7 +1912,7 @@ typedef struct /* This doesn't work with AOF syntax, since the string table may be in a different AREA. */ #ifndef AOF_ASSEMBLER -#define ENCODE_SECTION_INFO(decl) \ +#define ENCODE_SECTION_INFO(decl, first) \ { \ if (optimize > 0 && TREE_CONSTANT (decl) \ && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) \ @@ -1921,12 +1921,14 @@ typedef struct ? TREE_CST_RTL (decl) : DECL_RTL (decl)); \ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1; \ } \ - ARM_ENCODE_CALL_TYPE (decl) \ + if (first) \ + ARM_ENCODE_CALL_TYPE (decl) \ } #else -#define ENCODE_SECTION_INFO(decl) \ +#define ENCODE_SECTION_INFO(decl, first) \ { \ - ARM_ENCODE_CALL_TYPE (decl) \ + if (first) \ + ARM_ENCODE_CALL_TYPE (decl) \ } #endif diff --git a/gcc/config/arm/pe.c b/gcc/config/arm/pe.c index 8360f85..4069eac 100644 --- a/gcc/config/arm/pe.c +++ b/gcc/config/arm/pe.c @@ -207,8 +207,9 @@ arm_mark_dllimport (decl) /* Cover function to implement ENCODE_SECTION_INFO. */ void -arm_pe_encode_section_info (decl) +arm_pe_encode_section_info (decl, first) tree decl; + int first ATTRIBUTE_UNUSED; { /* This bit is copied from arm.h. */ if (optimize > 0 && TREE_CONSTANT (decl) diff --git a/gcc/config/arm/pe.h b/gcc/config/arm/pe.h index 1182aac..6c4375d 100644 --- a/gcc/config/arm/pe.h +++ b/gcc/config/arm/pe.h @@ -102,14 +102,8 @@ Boston, MA 02111-1307, USA. */ section and we need to set DECL_SECTION_NAME so we do that here. Note that we can be called twice on the same decl. */ #undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) \ - arm_pe_encode_section_info (DECL) - -/* Used to implement dllexport overriding dllimport semantics. It's also used - to handle vtables - the first pass won't do anything because - DECL_CONTEXT (DECL) will be 0 so arm_dll{ex,im}port_p will return 0. - It's also used to handle dllimport override semantics. */ -#define REDO_SECTION_INFO_P(DECL) 1 +#define ENCODE_SECTION_INFO(DECL, FIRST) \ + arm_pe_encode_section_info (DECL, FIRST) /* Define this macro if in some cases global symbols from one translation unit may not be bound to undefined symbols in another translation unit diff --git a/gcc/config/arm/t-pe b/gcc/config/arm/t-pe index 4de3665..f559bd2 100644 --- a/gcc/config/arm/t-pe +++ b/gcc/config/arm/t-pe @@ -20,7 +20,8 @@ dp-bit.c: $(srcdir)/config/fp-bit.c echo '#endif' >> dp-bit.c cat $(srcdir)/config/fp-bit.c >> dp-bit.c -pe.o: $(srcdir)/config/arm/pe.c +pe.o: $(srcdir)/config/arm/pe.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) output.h \ + flags.h $(TREE_H) $(EXPR_H) toplev.h $(TM_P_H) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/arm/pe.c MULTILIB_OPTIONS = mhard-float mthumb diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index e47b7e0..966a0cb 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -44,7 +44,7 @@ extern void gas_output_ascii PARAMS ((FILE *file, const char *str, extern void asm_output_external PARAMS ((FILE *file, tree decl, char *name)); extern void unique_section PARAMS ((tree decl, int reloc)); -extern void encode_section_info PARAMS ((tree decl)); +extern void encode_section_info PARAMS ((tree decl, int)); extern int avr_progmem_p PARAMS ((tree decl)); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 8e64bcb..30ea833 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -4741,12 +4741,14 @@ avr_progmem_p (decl) /* Encode section information about tree DECL */ void -encode_section_info (decl) +encode_section_info (decl, first) tree decl; + int first; { if (TREE_CODE (decl) == FUNCTION_DECL) SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; - else if ((TREE_STATIC (decl) || DECL_EXTERNAL (decl)) + else if (first + && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)) && TREE_CODE (decl) == VAR_DECL && avr_progmem_p (decl)) { diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index ffcfa26..9b5b35f 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -1830,7 +1830,7 @@ progmem_section (void) \ This macro is irrelevant if there is no separate readonly data section. */ -#define ENCODE_SECTION_INFO(DECL) encode_section_info(DECL) +#define ENCODE_SECTION_INFO(DECL, FIRST) encode_section_info(DECL, FIRST) /* Define this macro if references to a symbol must be treated differently depending on something about the variable or function named by the symbol (such as what section it is in). diff --git a/gcc/config/c4x/c4x-protos.h b/gcc/config/c4x/c4x-protos.h index 1cd7fce..d24a1f1 100644 --- a/gcc/config/c4x/c4x-protos.h +++ b/gcc/config/c4x/c4x-protos.h @@ -53,7 +53,7 @@ extern struct rtx_def *c4x_function_arg PARAMS ((CUMULATIVE_ARGS *, enum machine_mode, tree, int)); -extern void c4x_encode_section_info PARAMS ((tree)); +extern void c4x_encode_section_info PARAMS ((tree, int)); #endif /* TREE_CODE */ diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index ee878dd..6743990 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -1479,16 +1479,12 @@ c4x_emit_libcall_mulhi (libcall, code, mode, operands) /* Set the SYMBOL_REF_FLAG for a function decl. However, wo do not yet use this info. */ void -c4x_encode_section_info (decl) - tree decl; +c4x_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; { -#if 0 - if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE) - SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; -#else if (TREE_CODE (decl) == FUNCTION_DECL) SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; -#endif } diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 5ae16ab..ffa888e 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -1540,7 +1540,7 @@ CUMULATIVE_ARGS; On the C4x we use this to indicate if a symbol is in text or data space. */ -#define ENCODE_SECTION_INFO(DECL) c4x_encode_section_info (DECL); +#define ENCODE_SECTION_INFO(DECL, FIRST) c4x_encode_section_info (DECL, FIRST); /* Descripting Relative Cost of Operations. */ diff --git a/gcc/config/cris/cris-protos.h b/gcc/config/cris/cris-protos.h index e13c94f..f5e9f76 100644 --- a/gcc/config/cris/cris-protos.h +++ b/gcc/config/cris/cris-protos.h @@ -49,7 +49,7 @@ extern void cris_target_asm_named_section # ifdef TREE_CODE extern rtx cris_expand_builtin_va_arg PARAMS ((tree, tree)); -extern void cris_encode_section_info PARAMS ((tree)); +extern void cris_encode_section_info PARAMS ((tree, int)); # endif #endif /* RTX_CODE */ diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 063bad6..72fc6b3 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -2999,8 +2999,9 @@ restart: functions. */ void -cris_encode_section_info (exp) +cris_encode_section_info (exp, first) tree exp; + int first ATTRIBUTE_UNUSED; { if (flag_pic) { diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 009b9aa..e1d7007 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -1446,7 +1446,7 @@ struct cum_args {int regs;}; /* We need to code in PIC-specific flags into SYMBOL_REF_FLAG. */ -#define ENCODE_SECTION_INFO(EXP) cris_encode_section_info (EXP) +#define ENCODE_SECTION_INFO(EXP, FIRST) cris_encode_section_info (EXP, FIRST) /* We pull a little trick to register the _fini function with atexit, after (presumably) registering the eh frame info, since we don't handle diff --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h index 2174507..aa4f718 100644 --- a/gcc/config/d30v/d30v.h +++ b/gcc/config/d30v/d30v.h @@ -2794,19 +2794,6 @@ extern const char *d30v_branch_cost_string; 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 function named by the symbol - (such as what section it is in). - - The macro definition, if any, is executed immediately after the rtl for DECL - has been created and stored in `DECL_RTL (DECL)'. The value of the rtl will - be a `mem' whose address is a `symbol_ref'. - - The usual thing for this macro to do is to record a flag in the `symbol_ref' - (such as `SYMBOL_REF_FLAG') or to store a modified name string in the - `symbol_ref' (if one bit is not enough information). */ -/* #define ENCODE_SECTION_INFO(DECL) */ - /* Decode SYM_NAME and store the real name part in VAR, sans the characters that encode section info. Define this macro if `ENCODE_SECTION_INFO' alters the symbol's name string. */ diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h index 0bff130..5a93ca6 100644 --- a/gcc/config/darwin-protos.h +++ b/gcc/config/darwin-protos.h @@ -58,7 +58,7 @@ extern void machopic_define_ident PARAMS ((tree)); extern void machopic_define_name PARAMS ((const char*)); extern int machopic_name_defined_p PARAMS ((const char*)); extern int machopic_ident_defined_p PARAMS ((tree)); -extern void darwin_encode_section_info PARAMS ((tree)); +extern void darwin_encode_section_info PARAMS ((tree, int)); #endif /* TREE_CODE */ diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 6864f0c..f5e9db0 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -952,8 +952,9 @@ machopic_operand_p (op) use later. */ void -darwin_encode_section_info (decl) +darwin_encode_section_info (decl, first) tree decl; + int first ATTRIBUTE_UNUSED; { char code = '\0'; int defined = 0; diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 05ca85b..c5a078b 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -208,7 +208,7 @@ do { text_section (); \ if ((TREE_STATIC (DECL) \ && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \ || DECL_INITIAL (DECL)) \ - ENCODE_SECTION_INFO (DECL); \ + ENCODE_SECTION_INFO (DECL, false); \ ASM_OUTPUT_LABEL (FILE, xname); \ } while (0) @@ -224,7 +224,7 @@ do { text_section (); \ if ((TREE_STATIC (DECL) \ && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \ || DECL_INITIAL (DECL)) \ - ENCODE_SECTION_INFO (DECL); \ + ENCODE_SECTION_INFO (DECL, false); \ ASM_OUTPUT_LABEL (FILE, xname); \ /* Avoid generating stubs for functions we've just defined by \ outputting any required stub name label now. */ \ @@ -270,19 +270,20 @@ do { text_section (); \ /* Ensure correct alignment of bss data. */ #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL -#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ - do { \ - fputs (".lcomm ", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u,%u\n", (SIZE), floor_log2 ((ALIGN) / BITS_PER_UNIT)); \ - if ((DECL) && ((TREE_STATIC (DECL) \ - && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \ - || DECL_INITIAL (DECL))) \ - ENCODE_SECTION_INFO (DECL); \ - if ((DECL) && ((TREE_STATIC (DECL) \ - && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \ - || DECL_INITIAL (DECL))) \ - machopic_define_name (NAME); \ +#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ + do { \ + fputs (".lcomm ", (FILE)); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), ",%u,%u\n", (SIZE), \ + floor_log2 ((ALIGN) / BITS_PER_UNIT)); \ + if ((DECL) && ((TREE_STATIC (DECL) \ + && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \ + || DECL_INITIAL (DECL))) \ + ENCODE_SECTION_INFO (DECL, false); \ + if ((DECL) && ((TREE_STATIC (DECL) \ + && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \ + || DECL_INITIAL (DECL))) \ + machopic_define_name (NAME); \ } while (0) /* Output nothing for #ident. */ @@ -716,12 +717,8 @@ enum machopic_addr_class { #define MACHOPIC_JUST_INDIRECT (flag_pic == 1) #define MACHOPIC_PURE (flag_pic == 2) -#define ENCODE_SECTION_INFO(DECL) \ - darwin_encode_section_info (DECL) - -/* Be conservative and always redo the encoding. */ - -#define REDO_SECTION_INFO_P(DECL) (1) +#define ENCODE_SECTION_INFO(DECL, FIRST) \ + darwin_encode_section_info (DECL, FIRST) #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ ((VAR) = ((SYMBOL_NAME[0] == '!') ? (SYMBOL_NAME) + 4 : (SYMBOL_NAME))) diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index b19c0b3..3439453 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -1140,7 +1140,7 @@ readonly_data () \ /* If we are referencing a function that is supposed to be called through the function vector, the SYMBOL_REF_FLAG in the rtl so the call patterns can generate the correct code. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ if (TREE_CODE (DECL) == FUNCTION_DECL \ && h8300_funcvec_function_p (DECL)) \ SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ @@ -1148,7 +1148,7 @@ readonly_data () \ && (TREE_STATIC (DECL) || DECL_EXTERNAL (DECL)) \ && h8300_eightbit_data_p (DECL)) \ SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ - else if (TREE_CODE (DECL) == VAR_DECL \ + else if ((FIRST) && TREE_CODE (DECL) == VAR_DECL \ && (TREE_STATIC (DECL) || DECL_EXTERNAL (DECL)) \ && h8300_tiny_data_p (DECL)) \ h8300_encode_label (DECL); diff --git a/gcc/config/i370/i370.h b/gcc/config/i370/i370.h index d1f72bb..206a94d 100644 --- a/gcc/config/i370/i370.h +++ b/gcc/config/i370/i370.h @@ -291,7 +291,7 @@ extern int mvs_function_name_length; /* Mark external references. */ -#define ENCODE_SECTION_INFO(decl) \ +#define ENCODE_SECTION_INFO(decl, first) \ if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) \ SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index 2a812a5..aa05518 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -189,19 +189,6 @@ Boston, MA 02111-1307, USA. */ union tree_node; #define TREE union tree_node * - -/* Used to implement dllexport overriding dllimport semantics. It's also used - to handle vtables - the first pass won't do anything because - DECL_CONTEXT (DECL) will be 0 so i386_pe_dll{ex,im}port_p will return 0. - It's also used to handle dllimport override semantics. */ -#if 0 -#define REDO_SECTION_INFO_P(DECL) \ - ((DECL_ATTRIBUTES (DECL) != NULL_TREE) \ - || (TREE_CODE (DECL) == VAR_DECL && DECL_VIRTUAL_P (DECL))) -#else -#define REDO_SECTION_INFO_P(DECL) 1 -#endif - #undef EXTRA_SECTIONS #define EXTRA_SECTIONS in_drectve @@ -277,12 +264,11 @@ do { \ section and we need to set DECL_SECTION_NAME so we do that here. Note that we can be called twice on the same decl. */ -extern void i386_pe_encode_section_info PARAMS ((TREE)); +extern void i386_pe_encode_section_info PARAMS ((TREE, int)); -#ifdef ENCODE_SECTION_INFO #undef ENCODE_SECTION_INFO -#endif -#define ENCODE_SECTION_INFO(DECL) i386_pe_encode_section_info (DECL) +#define ENCODE_SECTION_INFO(DECL, FIRST) \ + i386_pe_encode_section_info (DECL, FIRST) /* Utility used only in this file. */ #define I386_PE_STRIP_ENCODING(SYM_NAME) \ diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h index 962862f..495d962 100644 --- a/gcc/config/i386/i386-interix.h +++ b/gcc/config/i386/i386-interix.h @@ -354,7 +354,7 @@ union tree_node; const char *gen_stdcall_suffix PARAMS ((union tree_node *)); #undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do \ { \ if (flag_pic) \ @@ -365,7 +365,7 @@ do \ = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ || ! TREE_PUBLIC (DECL)); \ } \ - if (TREE_CODE (DECL) == FUNCTION_DECL) \ + if ((FIRST) && TREE_CODE (DECL) == FUNCTION_DECL) \ if (lookup_attribute ("stdcall", \ TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \ XEXP (DECL_RTL (DECL), 0) = \ diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index a53a06f..1a3d9ab 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2244,7 +2244,7 @@ enum ix86_builtins On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol so that we may access it directly in the GOT. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do { \ if (flag_pic) \ { \ diff --git a/gcc/config/i386/osfrose.h b/gcc/config/i386/osfrose.h index 4580e0e..7338191 100644 --- a/gcc/config/i386/osfrose.h +++ b/gcc/config/i386/osfrose.h @@ -449,21 +449,23 @@ while (0) `PRINT_OPERAND_ADDRESS'. */ #undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) \ -do \ - { \ - if (HALF_PIC_P ()) \ - HALF_PIC_ENCODE (DECL); \ - \ - else if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - } \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ +do \ + { \ + if (HALF_PIC_P ()) \ + { \ + if (FIRST) \ + HALF_PIC_ENCODE (DECL); \ + } \ + else if (flag_pic) \ + { \ + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ + ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ + SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ + = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ + || ! TREE_PUBLIC (DECL)); \ + } \ + } \ while (0) diff --git a/gcc/config/i386/win32.h b/gcc/config/i386/win32.h index 0aa7a57..da1821d 100644 --- a/gcc/config/i386/win32.h +++ b/gcc/config/i386/win32.h @@ -115,9 +115,8 @@ Boston, MA 02111-1307, USA. */ the number of bytes of arguments passed to the function, if it has the attribute STDCALL. */ -#ifdef ENCODE_SECTION_INFO #undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do \ { \ if (flag_pic) \ @@ -128,14 +127,13 @@ do \ = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ || ! TREE_PUBLIC (DECL)); \ } \ - if (TREE_CODE (DECL) == FUNCTION_DECL) \ + if ((FIRST) && TREE_CODE (DECL) == FUNCTION_DECL) \ if (lookup_attribute ("stdcall", \ TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \ XEXP (DECL_RTL (DECL), 0) = \ gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \ } \ while (0) -#endif /* This macro gets just the user-specified name out of the string in a SYMBOL_REF. Discard diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 9d955df..b8bb39e 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -369,9 +369,13 @@ gen_stdcall_suffix (decl) /* Cover function to implement ENCODE_SECTION_INFO. */ void -i386_pe_encode_section_info (decl) +i386_pe_encode_section_info (decl, first) tree decl; + int first; { + if (!first) + return; + /* This bit is copied from i386.h. */ if (optimize > 0 && TREE_CONSTANT (decl) && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h index 43538cc..332b076 100644 --- a/gcc/config/ia64/ia64-protos.h +++ b/gcc/config/ia64/ia64-protos.h @@ -116,7 +116,7 @@ extern void ia64_function_arg_advance PARAMS((CUMULATIVE_ARGS *, extern int ia64_return_in_memory PARAMS((tree)); extern void ia64_asm_output_external PARAMS((FILE *, tree, const char *)); -extern void ia64_encode_section_info PARAMS((tree)); +extern void ia64_encode_section_info PARAMS((tree, int)); #endif /* TREE_CODE */ extern int ia64_register_move_cost PARAMS((enum machine_mode, enum reg_class, diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index e4f6268..1c7c5a3 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -6857,8 +6857,9 @@ const struct attribute_spec ia64_attribute_table[] = extern struct obstack * saveable_obstack; void -ia64_encode_section_info (decl) +ia64_encode_section_info (decl, first) tree decl; + int first ATTRIBUTE_UNUSED; { const char *symbol_str; diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 3c1d6b7..50f7982 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -1764,16 +1764,7 @@ do { \ depending on something about the variable or function named by the symbol (such as what section it is in). */ -#define ENCODE_SECTION_INFO(DECL) ia64_encode_section_info (DECL) - -/* If a variable is weakened, made one only or moved into a different - section, it may be necessary to redo the section info to move the - variable out of sdata. */ - -#define REDO_SECTION_INFO_P(DECL) \ - ((TREE_CODE (DECL) == VAR_DECL) \ - && (DECL_ONE_ONLY (DECL) || DECL_WEAK (DECL) || DECL_COMMON (DECL) \ - || DECL_SECTION_NAME (DECL) != 0)) +#define ENCODE_SECTION_INFO(DECL, FIRST) ia64_encode_section_info (DECL, FIRST) #define SDATA_NAME_FLAG_CHAR '@' diff --git a/gcc/config/m32r/m32r-protos.h b/gcc/config/m32r/m32r-protos.h index f76e6b9..86adde0 100644 --- a/gcc/config/m32r/m32r-protos.h +++ b/gcc/config/m32r/m32r-protos.h @@ -34,7 +34,7 @@ extern void m32r_asm_file_start PARAMS ((FILE *)); extern int direct_return PARAMS ((void)); #ifdef TREE_CODE extern void m32r_select_section PARAMS ((tree, int)); -extern void m32r_encode_section_info PARAMS ((tree)); +extern void m32r_encode_section_info PARAMS ((tree, int)); extern enum m32r_function_type m32r_compute_function_type PARAMS ((tree)); extern void m32r_select_section PARAMS ((tree, int)); diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index edf5fa4..0a98559 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -366,12 +366,16 @@ m32r_select_section (decl, reloc) */ void -m32r_encode_section_info (decl) +m32r_encode_section_info (decl, first) tree decl; + int first; { char prefix = 0; tree model = 0; + if (!first) + return; + switch (TREE_CODE (decl)) { case VAR_DECL : diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 44510a0..dcbcfd5 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -1644,7 +1644,7 @@ sbss_section () \ || MEDIUM_NAME_P (SYMBOL_NAME) \ || LARGE_NAME_P (SYMBOL_NAME)) -#define ENCODE_SECTION_INFO(DECL) m32r_encode_section_info (DECL) +#define ENCODE_SECTION_INFO(DECL, FIRST) m32r_encode_section_info (DECL, FIRST) /* Decode SYM_NAME and store the real name part in VAR, sans the characters that encode section info. Define this macro if diff --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h index e775234..bbbb452 100644 --- a/gcc/config/m68hc11/m68hc11-protos.h +++ b/gcc/config/m68hc11/m68hc11-protos.h @@ -41,7 +41,7 @@ extern void m68hc11_function_arg_advance PARAMS((CUMULATIVE_ARGS*, enum machine_mode, tree, int)); -extern void m68hc11_encode_section_info PARAMS((tree)); +extern void m68hc11_encode_section_info PARAMS((tree, int)); #endif #ifdef RTX_CODE diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index f45d195..4946c3b 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -1173,8 +1173,9 @@ m68hc11_handle_fntype_attribute (node, name, args, flags, no_add_attrs) handle calls to traps in a special manner (by issuing the trap). This information is stored in SYMBOL_REF_FLAG. */ void -m68hc11_encode_section_info (decl) +m68hc11_encode_section_info (decl, first) tree decl; + int first ATTRIBUTE_UNUSED; { tree func_attr; int trap_handler; diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 0e4b202..6afcf9a 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -1146,11 +1146,8 @@ typedef struct m68hc11_args handle calls to traps in a special manner (by issuing the trap). This information is stored in SYMBOL_REF_FLAG. */ -#define ENCODE_SECTION_INFO(DECL) m68hc11_encode_section_info (DECL) - -/* Override what GCC does for section info to let us recognize traps. */ - -#define REDO_SECTION_INFO_P(DECL) 1 +#define ENCODE_SECTION_INFO(DECL, FIRST) \ + m68hc11_encode_section_info (DECL, FIRST) /* `INIT_TARGET_OPTABS' Define this macro as a C statement that declares additional library diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index 11d8e54..a6da552 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -2414,7 +2414,7 @@ sdata_section () \ rtl will be a `mem' whose address is a `symbol_ref'. For the m88k, determine if the item should go in the global pool. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do { \ if (m88k_gp_threshold > 0) \ { \ diff --git a/gcc/config/mcore/mcore-protos.h b/gcc/config/mcore/mcore-protos.h index d478f90..d6f6e2e 100644 --- a/gcc/config/mcore/mcore-protos.h +++ b/gcc/config/mcore/mcore-protos.h @@ -36,7 +36,7 @@ extern int mcore_naked_function_p PARAMS ((void)); #ifdef TREE_CODE extern void mcore_unique_section PARAMS ((tree, int)); -extern void mcore_encode_section_info PARAMS ((tree)); +extern void mcore_encode_section_info PARAMS ((tree, int)); #ifdef HAVE_MACHINE_MODES extern int mcore_function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int)); diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 2b6d1e8..931cd06 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -3416,8 +3416,9 @@ mcore_dllimport_p (decl) /* Cover function to implement ENCODE_SECTION_INFO. */ void -mcore_encode_section_info (decl) +mcore_encode_section_info (decl, first) tree decl; + int first ATTRIBUTE_UNUSED; { /* This bit is copied from arm.h. */ if (optimize > 0 diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index ab02a2a..4899aa6 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -1161,8 +1161,6 @@ switch_to_section (section, decl) \ #undef UNIQUE_SECTION #define UNIQUE_SECTION(DECL, RELOC) mcore_unique_section (DECL, RELOC) -#define REDO_SECTION_INFO_P(DECL) 1 - #define MULTIPLE_SYMBOL_SPACES 1 #define SUPPORTS_ONE_ONLY 1 @@ -1315,7 +1313,8 @@ extern long mcore_current_compilation_timestamp; /* We must mark dll symbols specially. Definitions of dllexport'd objects install some info in the .drective (PE) or .exports (ELF) sections. */ #undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) mcore_encode_section_info (DECL) +#define ENCODE_SECTION_INFO(DECL, FIRST) \ + mcore_encode_section_info (DECL, FIRST) /* Print operand X (an rtx) in assembler syntax to file FILE. CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 66c3621..39862a35 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -3343,12 +3343,12 @@ typedef struct mips_args { If you are changing this macro, you should look at mips_select_section and see if it needs a similar change. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do \ { \ if (TARGET_MIPS16) \ { \ - if (TREE_CODE (DECL) == STRING_CST \ + if ((FIRST) && TREE_CODE (DECL) == STRING_CST \ && ! flag_writable_strings \ /* If this string is from a function, and the function will \ go in a gnu linkonce section, then we can't directly \ @@ -3415,7 +3415,8 @@ do \ \ else if (HALF_PIC_P ()) \ { \ - HALF_PIC_ENCODE (DECL); \ + if (FIRST) \ + HALF_PIC_ENCODE (DECL); \ } \ } \ while (0) diff --git a/gcc/config/ns32k/ns32k.h b/gcc/config/ns32k/ns32k.h index 8ef5aeb..e0343a6 100644 --- a/gcc/config/ns32k/ns32k.h +++ b/gcc/config/ns32k/ns32k.h @@ -1064,7 +1064,7 @@ __transfer_from_trampoline () \ symbol or a code symbol. These symbols are referenced via pc and not via sb. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do \ { \ extern int flag_pic; \ diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 6960684..770f243 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1486,9 +1486,9 @@ do { \ #define FUNCTION_NAME_P(NAME) (*(NAME) == '@') -#define ENCODE_SECTION_INFO(DECL)\ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do \ - { if (TEXT_SPACE_P (DECL)) \ + { if (FIRST && TEXT_SPACE_P (DECL)) \ { rtx _rtl; \ if (TREE_CODE (DECL) == FUNCTION_DECL \ || TREE_CODE (DECL) == VAR_DECL) \ diff --git a/gcc/config/romp/romp.h b/gcc/config/romp/romp.h index 5ce44f0..a8e04dd 100644 --- a/gcc/config/romp/romp.h +++ b/gcc/config/romp/romp.h @@ -923,7 +923,7 @@ struct rt_cargs {int gregs, fregs; }; /* For no good reason, we do the same as the other RT compilers and load the addresses of data areas for a function from our data area. That means that we need to mark such SYMBOL_REFs. We do so here. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ if (TREE_CODE (TREE_TYPE (DECL)) == FUNCTION_TYPE) \ SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 40b64dc..1099859 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -218,7 +218,7 @@ Boston, MA 02111-1307, USA. */ call. Do not set this flag if the function is weakly defined. */ #undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ if (TREE_CODE (DECL) == FUNCTION_DECL \ && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL)) \ && ! DECL_WEAK (DECL)) \ diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 19aeb07..50367e3 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -144,7 +144,7 @@ extern void setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *, int *, int)); extern struct rtx_def *rs6000_va_arg PARAMS ((tree, tree)); extern void output_mi_thunk PARAMS ((FILE *, tree, int, tree)); -extern void rs6000_encode_section_info PARAMS ((tree)); +extern void rs6000_encode_section_info PARAMS ((tree, int)); extern void rs6000_select_section PARAMS ((tree, int)); extern void rs6000_unique_section PARAMS ((tree, int)); #ifdef ARGS_SIZE_RTX diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 887c3b4..140593f 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -10954,9 +10954,13 @@ rs6000_unique_section (decl, reloc) to read the prefixes. */ void -rs6000_encode_section_info (decl) +rs6000_encode_section_info (decl, first) tree decl; + int first; { + if (!first) + return; + if (TREE_CODE (decl) == FUNCTION_DECL) { rtx sym_ref = XEXP (DECL_RTL (decl), 0); diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 8caa1cc..5373a6c 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -816,7 +816,8 @@ extern int fixuplabelno; to read the prefixes. */ #undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) rs6000_encode_section_info (DECL) +#define ENCODE_SECTION_INFO(DECL, FIRST) \ + rs6000_encode_section_info (DECL, FIRST) /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */ diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index 4a51b04..9fcedf8 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -207,7 +207,7 @@ toc_section () \ that we can branch to this function without emitting a no-op after the call. Do not set this flag if the function is weakly defined. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ if (TREE_CODE (DECL) == FUNCTION_DECL \ && !TREE_PUBLIC (DECL) \ && !DECL_WEAK (DECL)) \ diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index e395f85..b8e86bb 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -409,7 +409,7 @@ do \ On s390, if using PIC, mark a SYMBOL_REF for a non-global symbol so that we may access it directly in the GOT. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do \ { \ if (flag_pic) \ diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index e919597..28cf110c 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -2688,31 +2688,33 @@ while (0) On SH, if using PIC, mark a SYMBOL_REF for a non-global symbol so that we may access it using GOTOFF instead of GOT. */ -#define ENCODE_SECTION_INFO(DECL) \ -do \ - { \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) = \ - (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - if (TARGET_SH5) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) \ - : TREE_CODE (DECL) != VAR_DECL \ - ? NULL_RTX \ - : DECL_RTL (DECL)); \ - \ - if (rtl && GET_CODE (rtl) == MEM \ - && GET_CODE (XEXP (rtl, 0)) == SYMBOL_REF) \ - XEXP (rtl, 0) = gen_datalabel_ref (XEXP (rtl, 0)); \ - } \ - } \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ +do \ + { \ + if (!(FIRST)) \ + break; \ + if (flag_pic) \ + { \ + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ + ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ + \ + SYMBOL_REF_FLAG (XEXP (rtl, 0)) = \ + (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ + || ! TREE_PUBLIC (DECL)); \ + } \ + if (TARGET_SH5) \ + { \ + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ + ? TREE_CST_RTL (DECL) \ + : TREE_CODE (DECL) != VAR_DECL \ + ? NULL_RTX \ + : DECL_RTL (DECL)); \ + \ + if (rtl && GET_CODE (rtl) == MEM \ + && GET_CODE (XEXP (rtl, 0)) == SYMBOL_REF) \ + XEXP (rtl, 0) = gen_datalabel_ref (XEXP (rtl, 0)); \ + } \ + } \ while (0) /* The prefix used to mark SYMBOL_REFs that refer to data symbols. */ diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 3faf25b..22645c3 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -2383,10 +2383,10 @@ do { \ In the Embedded Medium/Anywhere code model, %g4 points to the data segment so we must not add it to function addresses. */ -#define ENCODE_SECTION_INFO(DECL) \ - do { \ - if (TARGET_CM_EMBMEDANY && TREE_CODE (DECL) == FUNCTION_DECL) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ + do { \ + if (TARGET_CM_EMBMEDANY && TREE_CODE (DECL) == FUNCTION_DECL) \ + SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ } while (0) /* Specify the machine mode that this machine uses diff --git a/gcc/config/stormy16/stormy16-protos.h b/gcc/config/stormy16/stormy16-protos.h index 76d0bc0..fdae8a4 100644 --- a/gcc/config/stormy16/stormy16-protos.h +++ b/gcc/config/stormy16/stormy16-protos.h @@ -38,7 +38,7 @@ extern CUMULATIVE_ARGS xstormy16_function_arg_advance extern void xstormy16_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS, int, tree, int *)); extern tree xstormy16_build_va_list PARAMS ((void)); -extern void xstormy16_encode_section_info PARAMS ((tree)); +extern void xstormy16_encode_section_info PARAMS ((tree, int)); #endif #if defined (TREE_CODE) && defined (RTX_CODE) diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 0a886ac..dedc9be 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -1394,8 +1394,9 @@ xstormy16_asm_output_mi_thunk (file, thunk_fndecl, delta, function) /* Mark functions with SYMBOL_REF_FLAG. */ void -xstormy16_encode_section_info (decl) +xstormy16_encode_section_info (decl, first) tree decl; + int first ATTRIBUTE_UNUSED; { if (TREE_CODE (decl) == FUNCTION_DECL) SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h index c2fd617..6ebb43f 100644 --- a/gcc/config/stormy16/stormy16.h +++ b/gcc/config/stormy16/stormy16.h @@ -2593,7 +2593,8 @@ do { \ The usual thing for this macro to do is to record a flag in the `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified name string in the `symbol_ref' (if one bit is not enough information). */ -#define ENCODE_SECTION_INFO(DECL) xstormy16_encode_section_info(DECL) +#define ENCODE_SECTION_INFO(DECL, FIRST) \ + xstormy16_encode_section_info(DECL, FIRST) /* Decode SYM_NAME and store the real name part in VAR, sans the characters that encode section info. Define this macro if `ENCODE_SECTION_INFO' alters diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index b20c1f4..1cf58da 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -1505,10 +1505,10 @@ extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_K #define EP_REGNUM 30 /* ep register number */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do \ { \ - if (TREE_CODE (DECL) == VAR_DECL \ + if ((FIRST) && TREE_CODE (DECL) == VAR_DECL \ && (TREE_STATIC (DECL) || DECL_EXTERNAL (DECL))) \ v850_encode_data_area (DECL); \ } \ diff --git a/gcc/config/vax/vms.h b/gcc/config/vax/vms.h index 133d1c3..69eced9d 100644 --- a/gcc/config/vax/vms.h +++ b/gcc/config/vax/vms.h @@ -88,7 +88,7 @@ Boston, MA 02111-1307, USA. */ addressed. Under VMS there is some brain damage in the linker that requires us to do this. */ -#define ENCODE_SECTION_INFO(decl) \ +#define ENCODE_SECTION_INFO(decl, FIRST) \ if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) \ SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 709ed06..428ed47 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -1261,7 +1261,7 @@ typedef struct xtensa_args { /* If we are referencing a function that is static, make the SYMBOL_REF special so that we can generate direct calls to it even with -fpic. */ -#define ENCODE_SECTION_INFO(DECL) \ +#define ENCODE_SECTION_INFO(DECL, FIRST) \ do { \ if (TREE_CODE (DECL) == FUNCTION_DECL && ! TREE_PUBLIC (DECL)) \ SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ |