* varasm.c (make_decl_rtl): Remove call to REDO_SECTION_INFO_P;
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 3 Mar 2002 04:23:21 +0000 (04:23 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 3 Mar 2002 04:23:21 +0000 (04:23 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50236 138bc75d-0d04-0410-961f-82ee72b054a4

65 files changed:
gcc/ChangeLog
gcc/config/a29k/a29k.h
gcc/config/alpha/alpha-protos.h
gcc/config/alpha/alpha.c
gcc/config/alpha/alpha.h
gcc/config/arc/arc.h
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.h
gcc/config/arm/pe.c
gcc/config/arm/pe.h
gcc/config/arm/t-pe
gcc/config/avr/avr-protos.h
gcc/config/avr/avr.c
gcc/config/avr/avr.h
gcc/config/c4x/c4x-protos.h
gcc/config/c4x/c4x.c
gcc/config/c4x/c4x.h
gcc/config/cris/cris-protos.h
gcc/config/cris/cris.c
gcc/config/cris/cris.h
gcc/config/d30v/d30v.h
gcc/config/darwin-protos.h
gcc/config/darwin.c
gcc/config/darwin.h
gcc/config/h8300/h8300.h
gcc/config/i370/i370.h
gcc/config/i386/cygwin.h
gcc/config/i386/i386-interix.h
gcc/config/i386/i386.h
gcc/config/i386/osfrose.h
gcc/config/i386/win32.h
gcc/config/i386/winnt.c
gcc/config/ia64/ia64-protos.h
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.h
gcc/config/m32r/m32r-protos.h
gcc/config/m32r/m32r.c
gcc/config/m32r/m32r.h
gcc/config/m68hc11/m68hc11-protos.h
gcc/config/m68hc11/m68hc11.c
gcc/config/m68hc11/m68hc11.h
gcc/config/m88k/m88k.h
gcc/config/mcore/mcore-protos.h
gcc/config/mcore/mcore.c
gcc/config/mcore/mcore.h
gcc/config/mips/mips.h
gcc/config/ns32k/ns32k.h
gcc/config/pa/pa.h
gcc/config/romp/romp.h
gcc/config/rs6000/linux64.h
gcc/config/rs6000/rs6000-protos.h
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/sysv4.h
gcc/config/rs6000/xcoff.h
gcc/config/s390/s390.h
gcc/config/sh/sh.h
gcc/config/sparc/sparc.h
gcc/config/stormy16/stormy16-protos.h
gcc/config/stormy16/stormy16.c
gcc/config/stormy16/stormy16.h
gcc/config/v850/v850.h
gcc/config/vax/vms.h
gcc/config/xtensa/xtensa.h
gcc/doc/tm.texi
gcc/varasm.c

index eb73bd1..85872bb 100644 (file)
@@ -1,3 +1,39 @@
+2002-03-02  Richard Henderson  <rth@redhat.com>
+
+       * 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.
+
 2002-03-02  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * a29k.h, alpha.h, arc.h, arm.h, avr.h, clipper.h, convex.h,
index f499ea1..2c98d12 100644 (file)
@@ -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;
index c6fdd04..0ccdaaa 100644 (file)
@@ -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
index aea7471..5875346 100644 (file)
@@ -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;
index 6d78d3f..3ea6556 100644 (file)
@@ -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 {                                           \
index 0a83854..29edf4e 100644 (file)
@@ -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;   \
index b42da82..036ea44 100644 (file)
@@ -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));
index 8f4c4a1..853db6d 100644 (file)
@@ -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
 
index 8360f85..4069eac 100644 (file)
@@ -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)
index 1182aac..6c4375d 100644 (file)
@@ -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
index 4de3665..f559bd2 100644 (file)
@@ -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
index e47b7e0..966a0cb 100644 (file)
@@ -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));
 
 
index 8e64bcb..30ea833 100644 (file)
@@ -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))
     {
index ffcfa26..9b5b35f 100644 (file)
@@ -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).
index 1cd7fce..d24a1f1 100644 (file)
@@ -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 */
 
index ee878dd..6743990 100644 (file)
@@ -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
 }
 
 
index 5ae16ab..ffa888e 100644 (file)
@@ -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.  */
 
index e13c94f..f5e9f76 100644 (file)
@@ -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 */
 
index 063bad6..72fc6b3 100644 (file)
@@ -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)
     {
index 009b9aa..e1d7007 100644 (file)
@@ -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
index 2174507..aa4f718 100644 (file)
@@ -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.  */
index 0bff130..5a93ca6 100644 (file)
@@ -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 */
 
index 6864f0c..f5e9db0 100644 (file)
@@ -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;
index 05ca85b..c5a078b 100644 (file)
@@ -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)))
index b19c0b3..3439453 100644 (file)
@@ -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);
index d1f72bb..206a94d 100644 (file)
@@ -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;
 
index 2a812a5..aa05518 100644 (file)
@@ -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
-
 \f
 #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) \
index 962862f..495d962 100644 (file)
@@ -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) =                                    \
index a53a06f..1a3d9ab 100644 (file)
@@ -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)                                              \
       {                                                                \
index 4580e0e..7338191 100644 (file)
@@ -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)
 
 
index 0aa7a57..da1821d 100644 (file)
@@ -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
index 9d955df..b8bb39e 100644 (file)
@@ -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))
index 43538cc..332b076 100644 (file)
@@ -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,
index e4f6268..1c7c5a3 100644 (file)
@@ -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;
 
index 3c1d6b7..50f7982 100644 (file)
@@ -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 '@'
 
index f76e6b9..86adde0 100644 (file)
@@ -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));
 
index edf5fa4..0a98559 100644 (file)
@@ -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 :
index 44510a0..dcbcfd5 100644 (file)
@@ -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
index e775234..bbbb452 100644 (file)
@@ -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
index f45d195..4946c3b 100644 (file)
@@ -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;
index 0e4b202..6afcf9a 100644 (file)
@@ -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
index 11d8e54..a6da552 100644 (file)
@@ -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)                                         \
     {                                                                  \
index d478f90..d6f6e2e 100644 (file)
@@ -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));
index 2b6d1e8..931cd06 100644 (file)
@@ -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
index ab02a2a..4899aa6 100644 (file)
@@ -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.
index 66c3621..39862a3 100644 (file)
@@ -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)
index 8ef5aeb..e0343a6 100644 (file)
@@ -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;                                               \
index 6960684..770f243 100644 (file)
@@ -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)            \
index 5ce44f0..a8e04dd 100644 (file)
@@ -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;
 
index 40b64dc..1099859 100644 (file)
@@ -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))                                   \
index 19aeb07..50367e3 100644 (file)
@@ -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
index 887c3b4..140593f 100644 (file)
@@ -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);
index 8caa1cc..5373a6c 100644 (file)
@@ -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.  */
 
index 4a51b04..9fcedf8 100644 (file)
@@ -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))                            \
index e395f85..b8e86bb 100644 (file)
@@ -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)                                               \
index e919597..28cf110 100644 (file)
@@ -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.  */
index 3faf25b..22645c3 100644 (file)
@@ -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)
 \f
 /* Specify the machine mode that this machine uses
index 76d0bc0..fdae8a4 100644 (file)
@@ -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)
index 0a886ac..dedc9be 100644 (file)
@@ -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;
index c2fd617..6ebb43f 100644 (file)
@@ -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
index b20c1f4..1cf58da 100644 (file)
@@ -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);                           \
     }                                                          \
index 133d1c3..69eced9 100644 (file)
@@ -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; 
 
index 709ed06..428ed47 100644 (file)
@@ -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;                 \
index 1a58557..2d7c3e0 100644 (file)
@@ -5545,25 +5545,31 @@ readonly data section is used.
 This macro is irrelevant if there is no separate readonly data section.
 
 @findex ENCODE_SECTION_INFO
-@item ENCODE_SECTION_INFO (@var{decl})
+@item ENCODE_SECTION_INFO (@var{decl}, @var{new_decl_p})
 Define this macro if references to a symbol or a constant 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 under two circumstances.  One
 is immediately after the rtl for @var{decl} that represents a variable
-or a function has been created and stored in @code{DECL_RTL
-(@var{decl})}.  The value of the rtl will be a @code{mem} whose address
-is a @code{symbol_ref}.  The other is immediately after the rtl for
-@var{decl} that represents a constant has been created and stored in
-@code{TREE_CST_RTL (@var{decl})}.  The macro is called once for each
-distinct constant in a source file.
+or a function has been created and stored in @code{DECL_RTL(@var{decl})}.
+The value of the rtl will be a @code{mem} whose address is a @code{symbol_ref}.
+The other is immediately after the rtl for @var{decl} that represents a
+constant has been created and stored in @code{TREE_CST_RTL (@var{decl})}.
+The macro is called once for each distinct constant in a source file.
+
+The @var{new_decl_p} argument will be true if this is the first time that
+@code{ENCODE_SECTION_INFO} has been invoked on this decl.  It will
+be false for subsequent invocations, which will happen for duplicate
+declarations.  Whether or not anything must be done for the duplicate
+declaration depends on whether @code{ENCODE_SECTION_INFO} examines
+@code{DECL_ATTRIBUTES}.
 
 @cindex @code{SYMBOL_REF_FLAG}, in @code{ENCODE_SECTION_INFO}
 The usual thing for this macro to do is to record a flag in the
 @code{symbol_ref} (such as @code{SYMBOL_REF_FLAG}) or to store a
-modified name string in the @code{symbol_ref} (if one bit is not enough
-information).
+modified name string in the @code{symbol_ref} (if one bit is not
+enough information).
 
 @findex STRIP_NAME_ENCODING
 @item STRIP_NAME_ENCODING (@var{var}, @var{sym_name})
index e7505a8..4d57b89 100644 (file)
@@ -851,14 +851,11 @@ make_decl_rtl (decl, asmspec)
 
       /* ??? Another way to do this would be to do what halfpic.c does
         and maintain a hashed table of such critters.  */
-      /* ??? Another way to do this would be to pass a flag bit to
-        ENCODE_SECTION_INFO saying whether this is a new decl or not.  */
       /* Let the target reassign the RTL if it wants.
         This is necessary, for example, when one machine specific
         decl attribute overrides another.  */
-#ifdef REDO_SECTION_INFO_P
-      if (REDO_SECTION_INFO_P (decl))
-       ENCODE_SECTION_INFO (decl);
+#ifdef ENCODE_SECTION_INFO
+      ENCODE_SECTION_INFO (decl, false);
 #endif
       return;
     }
@@ -984,7 +981,7 @@ make_decl_rtl (decl, asmspec)
      If the name is changed, the macro ASM_OUTPUT_LABELREF
      will have to know how to strip this information.  */
 #ifdef ENCODE_SECTION_INFO
-  ENCODE_SECTION_INFO (decl);
+  ENCODE_SECTION_INFO (decl, true);
 #endif
 }
 
@@ -3320,7 +3317,7 @@ output_constant_def (exp, defer)
      encoded in it.  */
   if (! found)
     {
-      ENCODE_SECTION_INFO (exp);
+      ENCODE_SECTION_INFO (exp, true);
       desc->rtl = rtl;
       desc->label = XSTR (XEXP (desc->rtl, 0), 0);
     }