diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-19 05:23:27 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-19 05:23:27 +0000 |
commit | 7811991d015679f79068872ce32cab8b31907713 (patch) | |
tree | 6cc771edadeb72a4893ed77408fb968ecad91282 /gcc/config/i386 | |
parent | e097fb33e6f49505f2296e69f741530dfd964758 (diff) | |
download | gcc-7811991d015679f79068872ce32cab8b31907713.tar.gz |
* system.h (ENCODE_SECTION_INFO): Poison it.
* target-def.h (TARGET_ENCODE_SECTION_INFO): New.
* target.h (encode_section_info): New.
* varasm.c (make_decl_rtl, output_constant_def): Use it.
* hooks.c (hook_tree_int_void): New.
* hooks.h: Declare it.
* config/darwin.h, config/alpha/alpha-protos.h, config/alpha/alpha.c,
config/alpha/alpha.h, 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/i386/cygwin.h,
config/i386/win32.h, 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/mcore/mcore-protos.h, config/mcore/mcore.c,
config/mcore/mcore.h, config/mmix/mmix-protos.h, config/mmix/mmix.c,
config/mmix/mmix.h, config/rs6000/rs6000-protos.h,
config/rs6000/sysv4.h, config/stormy16/stormy16-protos.h,
config/stormy16/stormy16.c, config/stormy16/stormy16.h:
Replace ENCODE_SECTION_INFO with TARGET_ENCODE_SECTION_INFO
referencing existing function. Make function static.
* config/a29k/a29k.c, config/a29k/a29k.h, config/arc/arc.c,
config/arc/arc.h, config/arm/arm.c, config/arm/arm.h,
config/h8300/h8300.c, config/h8300/h8300.h, config/i370/i370.c,
config/i370/i370.h, config/i386/i386-interix.h, config/i386/i386.c,
config/i386/i386.h, config/i386/interix.c, config/m88k/m88k.c,
config/m88k/m88k.h, config/mips/mips.c, config/mips/mips.h,
config/ns32k/ns32k.c, config/ns32k/ns32k.h, config/pa/pa.c,
config/pa/pa.h, config/romp/romp.c, config/romp/romp.h,
config/rs6000/linux64.h, config/rs6000/xcoff.h, config/s390/s390.c,
config/s390/s390.h, config/sh/sh.c, config/sh/sh.h,
config/sparc/sparc.c, config/sparc/sparc.h, config/v850/v850.c,
config/v850/v850.h, config/vax/vax.c, config/vax/vms.h,
config/xtensa/xtensa.c, config/xtensa/xtensa.h:
Move ENCODE_SECTION_INFO to out-of-line function and add
TARGET_ENCODE_SECTION_INFO.
* config/darwin.h (ASM_DECLARE_FUNCTION_NAME): Use hook, not macro.
(ASM_DECLARE_OBJECT_NAME, ASM_OUTPUT_ALIGNED_DECL_LOCAL): Likewise.
* config/arm/pe.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Rename
from SUBTARGET_*
(switch_to_section): Replace in_rdata case with in_readonly_data.
* config/h8300/h8300.c (h8300_encode_label): Make static.
* config/h8300/h8300-protos.h: Update.
* config/rs6000/rs6000.c (rs6000_elf_encode_section_info): Rename
from rs6000_encode_section_info; make static.
(rs6000_xcoff_encode_section_info): New.
* config/v850/v850.c (v850_encode_data_area): Make static.
* config/v850/v850-protos.h: Update.
* config/vax/vax.c: Include flags.h.
(vms_select_section): Fix typo.
* doc/tm.texi (TARGET_ENCODE_SECTION_INFO): Update from previous
ENCODE_SECTION_INFO docs.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53606 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386')
-rw-r--r-- | gcc/config/i386/cygwin.h | 7 | ||||
-rw-r--r-- | gcc/config/i386/i386-interix.h | 29 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 35 | ||||
-rw-r--r-- | gcc/config/i386/i386.h | 32 | ||||
-rw-r--r-- | gcc/config/i386/interix.c | 22 | ||||
-rw-r--r-- | gcc/config/i386/win32.h | 35 | ||||
-rw-r--r-- | gcc/config/i386/winnt.c | 2 |
7 files changed, 68 insertions, 94 deletions
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index 739977b922e..7098066adc1 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -257,9 +257,8 @@ do { \ extern void i386_pe_encode_section_info PARAMS ((TREE, int)); -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - i386_pe_encode_section_info (DECL, FIRST) +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info /* Utility used only in this file. */ #define I386_PE_STRIP_ENCODING(SYM_NAME) \ @@ -269,7 +268,7 @@ extern void i386_pe_encode_section_info PARAMS ((TREE, int)); /* This macro gets just the user-specified name out of the string in a SYMBOL_REF. Discard - trailing @[NUM] encoded by ENCODE_SECTION_INFO. */ + trailing @[NUM] encoded by targetm.encode_section_info. */ #undef STRIP_NAME_ENCODING #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ do { \ diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h index ea37a1cc543..fb0a9a9d87c 100644 --- a/gcc/config/i386/i386-interix.h +++ b/gcc/config/i386/i386-interix.h @@ -305,32 +305,15 @@ while (0) stddef renaming does NOT apply to Alpha. */ -union tree_node; -const char *gen_stdcall_suffix PARAMS ((union tree_node *)); - -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -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 ((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) +const char *gen_stdcall_suffix PARAMS ((tree)); +void i386_interix_encode_section_info PARAMS ((tree, int)); + +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO i386_interix_encode_section_info /* This macro gets just the user-specified name out of the string in a SYMBOL_REF. Discard - trailing @[NUM] encoded by ENCODE_SECTION_INFO. */ + trailing @[NUM] encoded by targetm.encode_section_info. */ #undef STRIP_NAME_ENCODING #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ do { \ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index c5250f6534b..ff77510ab30 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -691,6 +691,8 @@ struct ix86_address static int ix86_decompose_address PARAMS ((rtx, struct ix86_address *)); +static void i386_encode_section_info PARAMS ((tree, int)) ATTRIBUTE_UNUSED; + struct builtin_description; static rtx ix86_expand_sse_comi PARAMS ((const struct builtin_description *, tree, rtx)); @@ -2945,7 +2947,7 @@ local_symbolic_operand (op, mode) the compiler that assumes it can just stick the results of ASM_GENERATE_INTERNAL_LABEL in a symbol_ref and have done. */ /* ??? This is a hack. Should update the body of the compiler to - always create a DECL an invoke ENCODE_SECTION_INFO. */ + always create a DECL an invoke targetm.encode_section_info. */ if (strncmp (XSTR (op, 0), internal_label_prefix, internal_label_prefix_len) == 0) return 1; @@ -5084,6 +5086,37 @@ legitimize_pic_address (orig, reg) } return new; } + +/* If using PIC, mark a SYMBOL_REF for a non-global symbol so that we + may access it directly in the GOT. */ + +static void +i386_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (flag_pic) + { + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + ? TREE_CST_RTL (decl) : DECL_RTL (decl)); + + if (GET_CODE (rtl) == MEM) + { + if (TARGET_DEBUG_ADDR + && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd') + { + fprintf (stderr, "Encode %s, public = %d\n", + IDENTIFIER_POINTER (DECL_NAME (decl)), + TREE_PUBLIC (decl)); + } + + SYMBOL_REF_FLAG (XEXP (rtl, 0)) + = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + || ! TREE_PUBLIC (decl) + || MODULE_LOCAL_P (decl)); + } + } +} /* Try machine-dependent ways of modifying an illegitimate address to be legitimate. If we find one, return the new, valid address. diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 7ed0ddefd59..277290105e7 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2417,37 +2417,7 @@ enum ix86_builtins IX86_BUILTIN_MAX }; -/* 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). - - 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, FIRST) \ -do { \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - \ - if (GET_CODE (rtl) == MEM) \ - { \ - if (TARGET_DEBUG_ADDR \ - && TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd') \ - { \ - fprintf (stderr, "Encode %s, public = %d\n", \ - IDENTIFIER_POINTER (DECL_NAME (DECL)), \ - TREE_PUBLIC (DECL)); \ - } \ - \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL) \ - || MODULE_LOCAL_P (DECL)); \ - } \ - } \ -} while (0) +#define TARGET_ENCODE_SECTION_INFO i386_encode_section_info /* The `FINALIZE_PIC' macro serves as a hook to emit these special codes once the function is being compiled into assembly code, but diff --git a/gcc/config/i386/interix.c b/gcc/config/i386/interix.c index e8caa60e605..dc9c3d6e422 100644 --- a/gcc/config/i386/interix.c +++ b/gcc/config/i386/interix.c @@ -33,7 +33,7 @@ Boston, MA 02111-1307, USA. */ const char * gen_stdcall_suffix (decl) - tree decl; + tree decl; { int total = 0; /* ??? This probably should use XSTR (XEXP (DECL_RTL (decl), 0), 0) instead @@ -65,6 +65,26 @@ gen_stdcall_suffix (decl) return IDENTIFIER_POINTER (get_identifier (newsym)); } +void +i386_interix_encode_section_info (decl, first) + tree decl; + int first; +{ + 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 (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)); +} + #if 0 /* Turn this back on when the linker is updated to handle grouped .data$ sections correctly. See corresponding note in i386/interix.h. diff --git a/gcc/config/i386/win32.h b/gcc/config/i386/win32.h index 2119a19dc75..03ed4957775 100644 --- a/gcc/config/i386/win32.h +++ b/gcc/config/i386/win32.h @@ -102,41 +102,12 @@ Boston, MA 02111-1307, USA. */ #define NEED_ATEXIT 1 -/* 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). - - On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol - so that we may access it directly in the GOT. - - On i386 running Windows NT, modify the assembler name with a suffix - consisting of an atsign (@) followed by string of digits that represents - the number of bytes of arguments passed to the function, if it has the - attribute STDCALL. */ - -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -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 ((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) +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info /* This macro gets just the user-specified name out of the string in a SYMBOL_REF. Discard - trailing @[NUM] encoded by ENCODE_SECTION_INFO. + trailing @[NUM] encoded by targetm.encode_section_info. Do we need the stripping of leading '*'? */ #undef STRIP_NAME_ENCODING #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 87f3c70849c..d88e7dbce73 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -367,8 +367,6 @@ gen_stdcall_suffix (decl) return IDENTIFIER_POINTER (get_identifier (newsym)); } -/* Cover function to implement ENCODE_SECTION_INFO. */ - void i386_pe_encode_section_info (decl, first) tree decl; |