diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d38b71b23ad..506f73c9f9f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2003-03-13 Alan Modra + + * config/rs6000/rs6000.c (rs6000_flag_pic): Delete. + (rs6000_xcoff_encode_section_info): #ifdef TARGET_XCOFF. + (rs6000_binds_local_p, TARGET_BINDS_LOCAL_P): #if TARGET_MACHO. + (rs6000_override_options): Don't clear flag_pic for ABI_AIX. + (rs6000_legitimize_address): Formatting. + (rs6000_emit_move): Likewise. + (rs6000_return_addr): Test ABI_AIX as well as flag_pic. + (rs6000_emit_prologue ): Likewise. + (rs6000_elf_select_section): Comment reason for shlib being + set for ABI_AIX. + (rs6000_elf_unique_section): Likewise. + (rs6000_elf_encode_section_info): Test !TARGET_AIX as well as ABI_AIX. + * config/rs6000/rs6000.h (LEGITIMATE_LO_SUM_ADDRESS_P): Test ABI_AIX + as well as flag_pic. + * config/rs6000/sysv4.h (SUBTARGET_OVERRIDE_OPTIONS): Likewise. + (MINIMAL_TOC_SECTION_ASM_OP): Likewise. + * config/rs6000/linux64.h (TARGET_ENCODE_SECTION_INFO): Don't define. + 2003-03-13 Richard Henderson * emit-rtl.c (try_split): Handle 1-1 splits of call insns properly. diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 3d5d7e447b8..494dc7ac0d1 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for 64 bit PowerPC linux. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GNU CC. @@ -221,9 +221,6 @@ Boston, MA 02111-1307, USA. */ #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG -#undef TARGET_ENCODE_SECTION_INFO -#define TARGET_ENCODE_SECTION_INFO rs6000_xcoff_encode_section_info - /* This is how to output a reference to a user-level label named NAME. `assemble_name' uses this. */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index b64c8ccd04f..d8ceb4a71ac 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -97,9 +97,6 @@ const char *rs6000_isel_string; /* Set to nonzero once AIX common-mode calls have been defined. */ static GTY(()) int common_mode_defined; -/* Private copy of original value of flag_pic for ABI_AIX. */ -static int rs6000_flag_pic; - /* Save information from a "cmpxx" operation until the branch or scc is emitted. */ rtx rs6000_compare_op0, rs6000_compare_op1; @@ -225,10 +222,12 @@ static void rs6000_xcoff_select_rtx_section PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT)); static const char * rs6000_xcoff_strip_name_encoding PARAMS ((const char *)); static unsigned int rs6000_xcoff_section_type_flags PARAMS ((tree, const char *, int)); -#endif static void rs6000_xcoff_encode_section_info PARAMS ((tree, int)) ATTRIBUTE_UNUSED; +#endif +#if TARGET_MACHO static bool rs6000_binds_local_p PARAMS ((tree)); +#endif static int rs6000_use_dfa_pipeline_interface PARAMS ((void)); static int rs6000_variable_issue PARAMS ((FILE *, int, rtx, int)); static bool rs6000_rtx_costs PARAMS ((rtx, int, int, int *)); @@ -403,8 +402,10 @@ static const char alt_reg_names[][8] = #undef TARGET_EXPAND_BUILTIN #define TARGET_EXPAND_BUILTIN rs6000_expand_builtin +#if TARGET_MACHO #undef TARGET_BINDS_LOCAL_P #define TARGET_BINDS_LOCAL_P rs6000_binds_local_p +#endif #undef TARGET_ASM_OUTPUT_MI_THUNK #define TARGET_ASM_OUTPUT_MI_THUNK rs6000_output_mi_thunk @@ -637,12 +638,6 @@ rs6000_override_options (default_cpu) } } - if (flag_pic != 0 && DEFAULT_ABI == ABI_AIX) - { - rs6000_flag_pic = flag_pic; - flag_pic = 0; - } - /* Set debug flags */ if (rs6000_debug_name) { @@ -2215,7 +2210,10 @@ rs6000_legitimize_address (x, oldx, mode) return force_reg (Pmode, x); } - else if (TARGET_ELF && TARGET_32BIT && TARGET_NO_TOC && ! flag_pic + else if (TARGET_ELF + && TARGET_32BIT + && TARGET_NO_TOC + && ! flag_pic && GET_CODE (x) != CONST_INT && GET_CODE (x) != CONST_DOUBLE && CONSTANT_P (x) @@ -2770,7 +2768,8 @@ rs6000_emit_move (dest, source, mode) } if ((TARGET_ELF || DEFAULT_ABI == ABI_DARWIN) - && TARGET_NO_TOC && ! flag_pic + && TARGET_NO_TOC + && ! flag_pic && mode == Pmode && CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != HIGH @@ -9650,7 +9649,7 @@ rs6000_return_addr (count, frame) /* Currently we don't optimize very well between prolog and body code and for PIC code the code can be actually quite bad, so don't try to be too clever here. */ - if (count != 0 || flag_pic != 0) + if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic)) { cfun->machine->ra_needs_full_frame = 1; @@ -10761,7 +10760,9 @@ rs6000_emit_prologue () it. We use R11 for this purpose because emit_load_toc_table can use register 0. This allows us to use a plain 'blr' to return from the procedure more often. */ - int save_LR_around_toc_setup = (TARGET_ELF && flag_pic != 0 + int save_LR_around_toc_setup = (TARGET_ELF + && DEFAULT_ABI != ABI_AIX + && flag_pic && ! info->lr_save_p && EXIT_BLOCK_PTR->pred != NULL); if (save_LR_around_toc_setup) @@ -12715,6 +12716,10 @@ rs6000_elf_select_section (decl, reloc, align) 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. */ default_elf_select_section_1 (decl, reloc, align, flag_pic || DEFAULT_ABI == ABI_AIX); } @@ -12732,10 +12737,11 @@ rs6000_elf_unique_section (decl, reloc) 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); } - /* If we are referencing a function that is static or is known to be in this file, make the SYMBOL_REF special. We can use this to indicate @@ -12759,7 +12765,7 @@ rs6000_elf_encode_section_info (decl, first) if ((*targetm.binds_local_p) (decl)) SYMBOL_REF_FLAG (sym_ref) = 1; - if (DEFAULT_ABI == ABI_AIX) + if (!TARGET_AIX && DEFAULT_ABI == ABI_AIX) { size_t len1 = (DEFAULT_ABI == ABI_AIX) ? 1 : 2; size_t len2 = strlen (XSTR (sym_ref, 0)); @@ -13438,10 +13444,6 @@ rs6000_xcoff_section_type_flags (decl, name, reloc) return flags | (exact_log2 (align) & SECTION_ENTSIZE); } -#endif /* TARGET_XCOFF */ - -/* Note that this is also used for PPC64 Linux. */ - static void rs6000_xcoff_encode_section_info (decl, first) tree decl; @@ -13451,18 +13453,19 @@ rs6000_xcoff_encode_section_info (decl, first) && (*targetm.binds_local_p) (decl)) SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; } +#endif /* TARGET_XCOFF */ -/* Cross-module name binding. For AIX and PPC64 Linux, which always are - PIC, use private copy of flag_pic. Darwin does not support overriding +#if TARGET_MACHO +/* Cross-module name binding. Darwin does not support overriding functions at dynamic-link time. */ static bool rs6000_binds_local_p (decl) tree decl; { - return default_binds_local_p_1 (decl, - DEFAULT_ABI == ABI_DARWIN ? 0 : flag_pic || rs6000_flag_pic); + return default_binds_local_p_1 (decl, 0); } +#endif /* Compute a (partial) cost for rtx X. Return true if the complete cost has been computed, and false if subexpressions should be diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index fe932a6f0ed..84aad60a28b 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -2103,7 +2103,8 @@ typedef struct rs6000_args #define LEGITIMATE_LO_SUM_ADDRESS_P(MODE, X, STRICT) \ (TARGET_ELF \ - && ! flag_pic && ! TARGET_TOC \ + && (DEFAULT_ABI == ABI_AIX || ! flag_pic) \ + && ! TARGET_TOC \ && GET_MODE_NUNITS (MODE) == 1 \ && (GET_MODE_BITSIZE (MODE) <= 32 \ || (TARGET_HARD_FLOAT && TARGET_FPRS && (MODE) == DFmode)) \ diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 503deaf398a..b046f3e51be 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -247,8 +247,9 @@ do { \ rs6000_sdata_name); \ } \ \ - else if (flag_pic && \ - (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \ + else if (flag_pic && DEFAULT_ABI != ABI_AIX \ + && (rs6000_sdata == SDATA_EABI \ + || rs6000_sdata == SDATA_SYSV)) \ { \ rs6000_sdata = SDATA_DATA; \ error ("-f%s and -msdata=%s are incompatible", \ @@ -292,7 +293,7 @@ do { \ } \ \ /* Treat -fPIC the same as -mrelocatable. */ \ - if (flag_pic > 1) \ + if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \ target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \ \ else if (TARGET_RELOCATABLE) \ @@ -421,7 +422,8 @@ do { \ /* Put PC relative got entries in .got2. */ #define MINIMAL_TOC_SECTION_ASM_OP \ - ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"") + (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \ + ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"") #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\"" #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""