+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,
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;
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
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;
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 { \
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; \
#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));
/* 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)) \
? 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
/* 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)
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
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
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));
/* 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))
{
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).
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 */
/* 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
}
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. */
# 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 */
functions. */
void
-cris_encode_section_info (exp)
+cris_encode_section_info (exp, first)
tree exp;
+ int first ATTRIBUTE_UNUSED;
{
if (flag_pic)
{
/* 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
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. */
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 */
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;
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)
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. */ \
/* 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. */
#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)))
/* 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; \
&& (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);
/* 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;
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
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) \
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) \
= (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) = \
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) \
{ \
`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)
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) \
= (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
/* 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))
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,
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;
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 '@'
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));
*/
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 :
|| 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
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
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;
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
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) \
{ \
#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));
/* 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
#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
/* 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.
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 \
\
else if (HALF_PIC_P ()) \
{ \
- HALF_PIC_ENCODE (DECL); \
+ if (FIRST) \
+ HALF_PIC_ENCODE (DECL); \
} \
} \
while (0)
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; \
#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) \
/* 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;
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)) \
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
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);
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. */
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)) \
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) \
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. */
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
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)
/* 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;
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
#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); \
} \
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;
/* 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; \
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})
/* ??? 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;
}
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
}
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);
}