diff options
author | Richard Henderson <rth@redhat.com> | 2007-03-09 16:53:09 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2007-03-09 16:53:09 -0800 |
commit | 9b580a0b53a3e81eef0656670c4a4a09a5683b42 (patch) | |
tree | ddb930f60eed9d2395dd9b4695e612928d440a18 /gcc/config/rs6000 | |
parent | b22eec88d248d584189d02ff7cc0e199ed7206f6 (diff) | |
download | gcc-9b580a0b53a3e81eef0656670c4a4a09a5683b42.zip gcc-9b580a0b53a3e81eef0656670c4a4a09a5683b42.tar.gz gcc-9b580a0b53a3e81eef0656670c4a4a09a5683b42.tar.bz2 |
re PR target/26090 (IA-64 creates DT_TEXTREL binaries)
PR target/26090
* target.h (targetm.asm.out.reloc_rw_mask): New.
* target-def.h (TARGET_ASM_RELOC_RW_MASK): New.
(TARGET_ASM_OUT): Use it.
* targhooks.c, targhooks.h (default_reloc_rw_mask): New.
* varasm.c (categorize_decl_for_section): Remove shlib argument;
use the new reloc_rw_mask target hook instead.
(default_section_type_flags_1): Merge into...
(default_section_type_flags): ... here.
(decl_readonly_section_1): Merge into...
(decl_readonly_section): ... here.
(default_elf_select_section_1): Merge into...
(default_elf_select_section): ... here.
(default_unique_section_1): Merge into...
(default_unique_section): ... here.
(compute_reloc_for_rtx_1, compute_reloc_for_rtx): New.
(default_select_rtx_section): Use it.
(default_elf_select_rtx_section): Likewise.
* output.h: Update to match.
* doc/tm.texi (TARGET_ASM_RELOC_RW_MASK): New.
* config/alpha/alpha.c (alpha_elf_reloc_rw_mask): New.
(TARGET_ASM_RELOC_RW_MASK): New.
* config/i386/i386.c (x86_64_elf_select_section): Adjust call
to categorize_decl_for_section.
(x86_64_elf_unique_section): Likewise.
* config/ia64/hpux.h (TARGET_ASM_SELECT_SECTION,
TARGET_ASM_UNIQUE_SECTION, TARGET_ASM_SELECT_RTX_SECTION): Remove.
(TARGET_ASM_RELOC_RW_MASK): New.
* config/ia64/ia64.c (ia64_rwreloc_select_section,
ia64_rwreloc_unique_section, ia64_rwreloc_select_rtx_section): Remove.
(ia64_hpux_reloc_rw_mask, ia64_reloc_rw_mask): New.
(TARGET_RWRELOC): Remove.
(ia64_section_type_flags): Adjust call to default_section_type_flags.
* config/ia64/sysv4.h (TARGET_ASM_RELOC_RW_MASK): New.
* config/rs6000/rs6000.c (rs6000_elf_section_type_flags): Remove.
(rs6000_elf_select_section, rs6000_elf_unique_section): Remove.
(rs6000_elf_reloc_rw_mask, rs6000_xcoff_reloc_rw_mask): New.
(rs6000_xcoff_select_section): Use decl_readonly_section.
(rs6000_xcoff_section_type_flags): Use default_section_type_flags.
* config/rs6000/sysv4.h (TARGET_ASM_RELOC_RW_MASK): New.
(TARGET_ASM_SELECT_SECTION, TARGET_ASM_UNIQUE_SECTION): Remove.
(TARGET_SECTION_TYPE_FLAGS): Remove.
* config/rs6000/xcoff.h (TARGET_ASM_RELOC_RW_MASK): New.
From-SVN: r122781
Diffstat (limited to 'gcc/config/rs6000')
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 58 | ||||
-rw-r--r-- | gcc/config/rs6000/sysv4.h | 8 | ||||
-rw-r--r-- | gcc/config/rs6000/xcoff.h | 3 |
3 files changed, 23 insertions, 46 deletions
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index fd1b835..d80d061 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -656,13 +656,11 @@ static rtx rs6000_emit_set_long_const (rtx, HOST_WIDE_INT, HOST_WIDE_INT); static bool rs6000_return_in_memory (tree, tree); static void rs6000_file_start (void); #if TARGET_ELF -static unsigned int rs6000_elf_section_type_flags (tree, const char *, int); +static int rs6000_elf_reloc_rw_mask (void); static void rs6000_elf_asm_out_constructor (rtx, int); static void rs6000_elf_asm_out_destructor (rtx, int); static void rs6000_elf_end_indicate_exec_stack (void) ATTRIBUTE_UNUSED; static void rs6000_elf_asm_init_sections (void); -static section *rs6000_elf_select_section (tree, int, unsigned HOST_WIDE_INT); -static void rs6000_elf_unique_section (tree, int); static section *rs6000_elf_select_rtx_section (enum machine_mode, rtx, unsigned HOST_WIDE_INT); static void rs6000_elf_encode_section_info (tree, rtx, int) @@ -673,6 +671,7 @@ static bool rs6000_use_blocks_for_constant_p (enum machine_mode, rtx); static void rs6000_xcoff_asm_output_anchor (rtx); static void rs6000_xcoff_asm_globalize_label (FILE *, const char *); static void rs6000_xcoff_asm_init_sections (void); +static int rs6000_xcoff_reloc_rw_mask (void); static void rs6000_xcoff_asm_named_section (const char *, unsigned int, tree); static section *rs6000_xcoff_select_section (tree, int, unsigned HOST_WIDE_INT); @@ -18928,37 +18927,6 @@ rs6000_elf_select_rtx_section (enum machine_mode mode, rtx x, else return default_elf_select_rtx_section (mode, x, align); } - -/* Implement TARGET_ASM_SELECT_SECTION for ELF targets. */ - -static section * -rs6000_elf_select_section (tree decl, int reloc, - unsigned HOST_WIDE_INT align) -{ - /* Pretend that we're always building for a shared library when - ABI_AIX, because otherwise we end up with dynamic relocations - in read-only sections. This happens for function pointers, - references to vtables in typeinfo, and probably other cases. */ - return default_elf_select_section_1 (decl, reloc, align, - flag_pic || DEFAULT_ABI == ABI_AIX); -} - -/* A C statement to build up a unique section name, expressed as a - STRING_CST node, and assign it to DECL_SECTION_NAME (decl). - RELOC indicates whether the initial value of EXP requires - link-time relocations. If you do not define this macro, GCC will use - the symbol name prefixed by `.' as the section name. Note - this - macro can now be called for uninitialized data items as well as - initialized data and functions. */ - -static void -rs6000_elf_unique_section (tree decl, int reloc) -{ - /* As above, pretend that we're always building for a shared library - when ABI_AIX, to avoid dynamic relocations in read-only sections. */ - default_unique_section_1 (decl, reloc, - flag_pic || DEFAULT_ABI == ABI_AIX); -} /* For a SYMBOL_REF, set generic flags and then perform some target-specific processing. @@ -19437,11 +19405,15 @@ rs6000_darwin_file_start (void) #endif /* TARGET_MACHO */ #if TARGET_ELF -static unsigned int -rs6000_elf_section_type_flags (tree decl, const char *name, int reloc) +static int +rs6000_elf_reloc_rw_mask (void) { - return default_section_type_flags_1 (decl, name, reloc, - flag_pic || DEFAULT_ABI == ABI_AIX); + if (flag_pic) + return 3; + else if (DEFAULT_ABI == ABI_AIX) + return 2; + else + return 0; } /* Record an element in the table of global constructors. SYMBOL is @@ -19679,6 +19651,12 @@ rs6000_xcoff_asm_init_sections (void) exception_section = data_section; } +static int +rs6000_xcoff_reloc_rw_mask (void) +{ + return 3; +} + static void rs6000_xcoff_asm_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED) @@ -19702,7 +19680,7 @@ static section * rs6000_xcoff_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED) { - if (decl_readonly_section_1 (decl, reloc, 1)) + if (decl_readonly_section (decl, reloc)) { if (TREE_PUBLIC (decl)) return read_only_data_section; @@ -19774,7 +19752,7 @@ static unsigned int rs6000_xcoff_section_type_flags (tree decl, const char *name, int reloc) { unsigned int align; - unsigned int flags = default_section_type_flags_1 (decl, name, reloc, 1); + unsigned int flags = default_section_type_flags (decl, name, reloc); /* Align to at least UNIT size. */ if (flags & SECTION_CODE) diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index d7c1002..0b1eb1e 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -1,6 +1,6 @@ /* Target definitions for GNU compiler for PowerPC running System V.4 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Cygnus Support. This file is part of GCC. @@ -364,11 +364,10 @@ do { \ /* Override default elf definitions. */ #define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections +#undef TARGET_ASM_RELOC_RW_MASK +#define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask #undef TARGET_ASM_SELECT_RTX_SECTION #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section -#undef TARGET_ASM_SELECT_SECTION -#define TARGET_ASM_SELECT_SECTION rs6000_elf_select_section -#define TARGET_ASM_UNIQUE_SECTION rs6000_elf_unique_section /* Return nonzero if this entry is to be written into the constant pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST @@ -533,7 +532,6 @@ extern int fixuplabelno; #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p -#define TARGET_SECTION_TYPE_FLAGS rs6000_elf_section_type_flags /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */ diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index 6a95465..ebf79b5 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for some generic XCOFF file format - Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -88,6 +88,7 @@ #define TARGET_ASM_OUTPUT_ANCHOR rs6000_xcoff_asm_output_anchor #define TARGET_ASM_GLOBALIZE_LABEL rs6000_xcoff_asm_globalize_label #define TARGET_ASM_INIT_SECTIONS rs6000_xcoff_asm_init_sections +#define TARGET_ASM_RELOC_RW_MASK rs6000_xcoff_reloc_rw_mask #define TARGET_ASM_NAMED_SECTION rs6000_xcoff_asm_named_section #define TARGET_ASM_SELECT_SECTION rs6000_xcoff_select_section #define TARGET_ASM_SELECT_RTX_SECTION rs6000_xcoff_select_rtx_section |