On Wed, Mar 19, 2014 at 3:31 PM, Bill Schmidt <wschm...@linux.vnet.ibm.com> wrote: > Hi, > > This patch (diff-abi-elfv2) backports the fundamental changes for the > ELFv2 ABI for powerpc64le. Copying Richard and Jakub for the libgcc, > libitm, and libstdc++ bits. > > Thanks, > Bill > > > [gcc] > > 2014-03-29 Bill Schmidt <wschm...@linux.vnet.ibm.com> > > Backport from mainline r204842: > > 2013-11-15 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * doc/invoke.texi (-mabi=elfv1, -mabi=elfv2): Document. > > Backport from mainline r204809: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * config/rs6000/sysv4le.h (LINUX64_DEFAULT_ABI_ELFv2): Define. > > Backport from mainline r204808: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > Alan Modra <amo...@gmail.com> > > * config/rs6000/rs6000.h (RS6000_SAVE_AREA): Handle ABI_ELFv2. > (RS6000_SAVE_TOC): Remove. > (RS6000_TOC_SAVE_SLOT): New macro. > * config/rs6000/rs6000.c (rs6000_parm_offset): New function. > (rs6000_parm_start): Use it. > (rs6000_function_arg_advance_1): Likewise. > (rs6000_emit_prologue): Use RS6000_TOC_SAVE_SLOT. > (rs6000_emit_epilogue): Likewise. > (rs6000_call_aix): Likewise. > (rs6000_output_function_prologue): Do not save/restore r11 > around calling _mcount for ABI_ELFv2. > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > Alan Modra <amo...@gmail.com> > > * config/rs6000/rs6000-protos.h (rs6000_reg_parm_stack_space): > Add prototype. > * config/rs6000/rs6000.h (RS6000_REG_SAVE): Remove. > (REG_PARM_STACK_SPACE): Call rs6000_reg_parm_stack_space. > * config/rs6000/rs6000.c (rs6000_parm_needs_stack): New function. > (rs6000_function_parms_need_stack): Likewise. > (rs6000_reg_parm_stack_space): Likewise. > (rs6000_function_arg): Do not replace BLKmode by Pmode when > returning a register argument. > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > Michael Gschwind <m...@us.ibm.com> > > * config/rs6000/rs6000.h (FP_ARG_MAX_RETURN): New macro. > (ALTIVEC_ARG_MAX_RETURN): Likewise. > (FUNCTION_VALUE_REGNO_P): Use them. > * config/rs6000/rs6000.c (TARGET_RETURN_IN_MSB): Define. > (rs6000_return_in_msb): New function. > (rs6000_return_in_memory): Handle ELFv2 homogeneous aggregates. > Handle aggregates of up to 16 bytes for ELFv2. > (rs6000_function_value): Handle ELFv2 homogeneous aggregates. > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > Michael Gschwind <m...@us.ibm.com> > > * config/rs6000/rs6000.h (AGGR_ARG_NUM_REG): Define. > * config/rs6000/rs6000.c (rs6000_aggregate_candidate): New function. > (rs6000_discover_homogeneous_aggregate): Likewise. > (rs6000_function_arg_boundary): Handle homogeneous aggregates. > (rs6000_function_arg_advance_1): Likewise. > (rs6000_function_arg): Likewise. > (rs6000_arg_partial_bytes): Likewise. > (rs6000_psave_function_arg): Handle BLKmode arguments. > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > Michael Gschwind <m...@us.ibm.com> > > * config/rs6000/rs6000.h (AGGR_ARG_NUM_REG): Define. > * config/rs6000/rs6000.c (rs6000_aggregate_candidate): New function. > (rs6000_discover_homogeneous_aggregate): Likewise. > (rs6000_function_arg_boundary): Handle homogeneous aggregates. > (rs6000_function_arg_advance_1): Likewise. > (rs6000_function_arg): Likewise. > (rs6000_arg_partial_bytes): Likewise. > (rs6000_psave_function_arg): Handle BLKmode arguments. > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * config/rs6000/rs6000.c (machine_function): New member > r2_setup_needed. > (rs6000_emit_prologue): Set r2_setup_needed if necessary. > (rs6000_output_mi_thunk): Set r2_setup_needed. > (rs6000_output_function_prologue): Output global entry point > prologue and local entry point marker if needed for ABI_ELFv2. > Output -mprofile-kernel code here. > (output_function_profiler): Do not output -mprofile-kernel > code here; moved to rs6000_output_function_prologue. > (rs6000_file_start): Output ".abiversion 2" for ABI_ELFv2. > > (rs6000_emit_move): Do not handle dot symbols for ABI_ELFv2. > (rs6000_output_function_entry): Likewise. > (rs6000_assemble_integer): Likewise. > (rs6000_elf_encode_section_info): Likewise. > (rs6000_elf_declare_function_name): Do not create dot symbols > or .opd section for ABI_ELFv2. > > (rs6000_trampoline_size): Update for ABI_ELFv2 trampolines. > (rs6000_trampoline_init): Likewise. > (rs6000_elf_file_end): Call file_end_indicate_exec_stack > for ABI_ELFv2. > > (rs6000_call_aix): Handle ELFv2 indirect calls. Do not check > for function descriptors in ABI_ELFv2. > > * config/rs6000/rs6000.md ("*call_indirect_aix<mode>"): Support > on ABI_AIX only, not ABI_ELFv2. > ("*call_value_indirect_aix<mode>"): Likewise. > ("*call_indirect_elfv2<mode>"): New pattern. > ("*call_value_indirect_elfv2<mode>"): Likewise. > > * config/rs6000/predicates.md ("symbol_ref_operand"): Do not > check for function descriptors in ABI_ELFv2. > ("current_file_function_operand"): Likewise. > > * config/rs6000/ppc-asm.h [__powerpc64__ && _CALL_ELF == 2]: > (toc): Undefine. > (FUNC_NAME): Define ELFv2 variant. > (JUMP_TARGET): Likewise. > (FUNC_START): Likewise. > (HIDDEN_FUNC): Likewise. > (FUNC_END): Likeiwse. > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * config.gcc [powerpc*-*-* | rs6000-*-*]: Support --with-abi=elfv1 > and --with-abi=elfv2. > * config/rs6000/option-defaults.h (OPTION_DEFAULT_SPECS): Add "abi". > * config/rs6000/rs6000.opt (mabi=elfv1): New option. > (mabi=elfv2): Likewise. > * config/rs6000/rs6000-opts.h (enum rs6000_abi): Add ABI_ELFv2. > * config/rs6000/linux64.h (DEFAULT_ABI): Do not hard-code to AIX_ABI > if !RS6000_BI_ARCH. > (ELFv2_ABI_CHECK): New macro. > (SUBSUBTARGET_OVERRIDE_OPTIONS): Use it to decide whether to set > rs6000_current_abi to ABI_AIX or ABI_ELFv2. > (GLIBC_DYNAMIC_LINKER64): Support ELFv2 ld.so version. > * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Predefine > _CALL_ELF and __STRUCT_PARM_ALIGN__ if appropriate. > > * config/rs6000/rs6000.c (rs6000_debug_reg_global): Handle ABI_ELFv2. > (debug_stack_info): Likewise. > (rs6000_file_start): Treat ABI_ELFv2 the same as ABI_AIX. > (rs6000_legitimize_tls_address): Likewise. > (rs6000_conditional_register_usage): Likewise. > (rs6000_emit_move): Likewise. > (init_cumulative_args): Likewise. > (rs6000_function_arg_advance_1): Likewise. > (rs6000_function_arg): Likewise. > (rs6000_arg_partial_bytes): Likewise. > (rs6000_output_function_entry): Likewise. > (rs6000_assemble_integer): Likewise. > (rs6000_savres_strategy): Likewise. > (rs6000_stack_info): Likewise. > (rs6000_function_ok_for_sibcall): Likewise. > (rs6000_emit_load_toc_table): Likewise. > (rs6000_savres_routine_name): Likewise. > (ptr_regno_for_savres): Likewise. > (rs6000_emit_prologue): Likewise. > (rs6000_emit_epilogue): Likewise. > (rs6000_output_function_epilogue): Likewise. > (output_profile_hook): Likewise. > (output_function_profiler): Likewise. > (rs6000_trampoline_size): Likewise. > (rs6000_trampoline_init): Likewise. > (rs6000_elf_output_toc_section_asm_op): Likewise. > (rs6000_elf_encode_section_info): Likewise. > (rs6000_elf_reloc_rw_mask): Likewise. > (rs6000_elf_declare_function_name): Likewise. > (rs6000_function_arg_boundary): Treat ABI_ELFv2 the same as ABI_AIX, > except that rs6000_compat_align_parm is always assumed false. > (rs6000_gimplify_va_arg): Likewise. > (rs6000_call_aix): Update comment. > (rs6000_sibcall_aix): Likewise. > * config/rs6000/rs6000.md ("tls_gd_aix<TLSmode:tls_abi_suffix>"): > Treat ABI_ELFv2 the same as ABI_AIX. > ("*tls_gd_call_aix<TLSmode:tls_abi_suffix>"): Likewise. > ("tls_ld_aix<TLSmode:tls_abi_suffix>"): Likewise. > ("*tls_ld_call_aix<TLSmode:tls_abi_suffix>"): Likewise. > ("load_toc_aix_si"): Likewise. > ("load_toc_aix_di"): Likewise. > ("call"): Likewise. > ("call_value"): Likewise. > ("*call_local_aix<mode>"): Likewise. > ("*call_value_local_aix<mode>"): Likewise. > ("*call_nonlocal_aix<mode>"): Likewise. > ("*call_value_nonlocal_aix<mode>"): Likewise. > ("*call_indirect_aix<mode>"): Likewise. > ("*call_value_indirect_aix<mode>"): Likewise. > ("sibcall"): Likewise. > ("sibcall_value"): Likewise. > ("*sibcall_aix<mode>"): Likewise. > ("*sibcall_value_aix<mode>"): Likewise. > * config/rs6000/predicates.md ("symbol_ref_operand"): Likewise. > ("current_file_function_operand"): Likewise. > > Backport from mainline r204807: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * config/rs6000/rs6000.c (rs6000_arg_partial_bytes): Simplify logic > by making use of the fact that for vector / floating point arguments > passed both in VRs/FPRs and in the fixed parameter area, the partial > bytes mechanism is in fact not used. > > Backport from mainline r204806: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * config/rs6000/rs6000.c (rs6000_psave_function_arg): New function. > (rs6000_finish_function_arg): Likewise. > (rs6000_function_arg): Use rs6000_psave_function_arg and > rs6000_finish_function_arg to handle both vector and floating > point arguments that are also passed in GPRs / the stack. > > Backport from mainline r204805: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * config/rs6000/rs6000.c (USE_FP_FOR_ARG_P): Remove TYPE argument. > (USE_ALTIVEC_FOR_ARG_P): Likewise. > (rs6000_darwin64_record_arg_advance_recurse): Update uses. > (rs6000_function_arg_advance_1):Likewise. > (rs6000_darwin64_record_arg_recurse): Likewise. > (rs6000_function_arg): Likewise. > (rs6000_arg_partial_bytes): Likewise. > > Backport from mainline r204804: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * config/rs6000/rs6000.c (rs6000_option_override_internal): Replace > "DEFAULT_ABI != ABI_AIX" test by testing for ABI_V4 or ABI_DARWIN. > (rs6000_savres_strategy): Likewise. > (rs6000_return_addr): Likewise. > (rs6000_emit_load_toc_table): Replace "DEFAULT_ABI != ABI_AIX" by > testing for ABI_V4 (since ABI_DARWIN is impossible here). > (rs6000_emit_prologue): Likewise. > (legitimate_lo_sum_address_p): Simplify DEFAULT_ABI test. > (rs6000_elf_declare_function_name): Remove duplicated test. > * config/rs6000/rs6000.md ("load_toc_v4_PIC_1"): Explicitly test > for ABI_V4 (instead of "DEFAULT_ABI != ABI_AIX" test). > ("load_toc_v4_PIC_1_normal"): Likewise. > ("load_toc_v4_PIC_1_476"): Likewise. > ("load_toc_v4_PIC_1b"): Likewise. > ("load_toc_v4_PIC_1b_normal"): Likewise. > ("load_toc_v4_PIC_1b_476"): Likewise. > ("load_toc_v4_PIC_2"): Likewise. > ("load_toc_v4_PIC_3b"): Likewise. > ("load_toc_v4_PIC_3c"): Likewise. > * config/rs6000/rs6000.h (RS6000_REG_SAVE): Simplify DEFAULT_ABI test. > (RS6000_SAVE_AREA): Likewise. > (FP_ARG_MAX_REG): Likewise. > (RETURN_ADDRESS_OFFSET): Likewise. > * config/rs6000/sysv.h (TARGET_TOC): Test for ABI_V4 instead > of ABI_AIX. > (SUBTARGET_OVERRIDE_OPTIONS): Likewise. > (MINIMAL_TOC_SECTION_ASM_OP): Likewise. > > Backport from mainline r204803: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * config/rs6000/rs6000.c (rs6000_call_indirect_aix): Rename to ... > (rs6000_call_aix): ... this. Handle both direct and indirect calls. > Create call insn directly instead of via various gen_... routines. > Mention special registers used by the call in > CALL_INSN_FUNCTION_USAGE. > (rs6000_sibcall_aix): New function. > * config/rs6000/rs6000.md (TOC_SAVE_OFFSET_32BIT): Remove. > (TOC_SAVE_OFFSET_64BIT): Likewise. > (AIX_FUNC_DESC_TOC_32BIT): Likewise. > (AIX_FUNC_DESC_TOC_64BIT): Likewise. > (AIX_FUNC_DESC_SC_32BIT): Likewise. > (AIX_FUNC_DESC_SC_64BIT): Likewise. > ("call" expander): Call rs6000_call_aix. > ("call_value" expander): Likewise. > ("call_indirect_aix<ptrsize>"): Replace this pattern ... > ("call_indirect_aix<ptrsize>_nor11"): ... and this pattern ... > ("*call_indirect_aix<mode>"): ... by this insn pattern. > ("call_value_indirect_aix<ptrsize>"): Replace this pattern ... > ("call_value_indirect_aix<ptrsize>_nor11"): ... and this pattern ... > ("*call_value_indirect_aix<mode>"): ... by this insn pattern. > ("*call_nonlocal_aix32", "*call_nonlocal_aix64"): Replace by ... > ("*call_nonlocal_aix<mode>"): ... this pattern. > ("*call_value_nonlocal_aix32", "*call_value_nonlocal_aix64"): Replace > ("*call_value_nonlocal_aix<mode>"): ... by this pattern. > ("*call_local_aix<mode>"): New insn pattern. > ("*call_value_local_aix<mode>"): Likewise. > ("sibcall" expander): Call rs6000_sibcall_aix. > ("sibcall_value" expander): Likewise. Move earlier in file. > ("*sibcall_nonlocal_aix<mode>"): Replace by ... > ("*sibcall_aix<mode>"): ... this pattern. > ("*sibcall_value_nonlocal_aix<mode>"): Replace by ... > ("*sibcall_value_aix<mode>"): ... this pattern. > * config/rs6000/rs6000-protos.h (rs6000_call_indirect_aix): Remove. > (rs6000_call_aix): Add prototype. > (rs6000_sibcall_aix): Likewise. > > Backport from mainline r204799: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * config/rs6000/rs6000.c (rs6000_emit_prologue): Do not place a > RTX_FRAME_RELATED_P marker on the UNSPEC_MOVESI_FROM_CR insn. > Instead, add USEs of all modified call-saved CR fields to the > insn storing the result to the stack slot, and provide an > appropriate REG_FRAME_RELATED_EXPR for that insn. > * config/rs6000/rs6000.md ("*crsave"): New insn pattern. > * config/rs6000/predicates.md ("crsave_operation"): New predicate. > > [gcc/testsuite] > > 2014-03-29 Bill Schmidt <wschm...@linux.vnet.ibm.com> > > Backport from mainline r204808: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * gcc.target/powerpc/ppc64-abi-1.c (stack_frame_t): Remove > compiler and linker field if _CALL_ELF == 2. > * gcc.target/powerpc/ppc64-abi-2.c (stack_frame_t): Likewise. > * gcc.target/powerpc/ppc64-abi-dfp-1.c (stack_frame_t): Likewise. > * gcc.dg/stack-usage-1.c (SIZE): Update value for _CALL_ELF == 2. > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * gcc.target/powerpc/ppc64-abi-dfp-1.c (FUNC_START): New macro. > (WRAPPER): Use it. > * gcc.target/powerpc/no-r11-1.c: Skip on powerpc_elfv2. > * gcc.target/powerpc/no-r11-2.c: Skip on powerpc_elfv2. > * gcc.target/powerpc/no-r11-3.c: Skip on powerpc_elfv2. > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * lib/target-supports.exp (check_effective_target_powerpc_elfv2): > New function. > * gcc.target/powerpc/pr57949-1.c: Disable for powerpc_elfv2. > * gcc.target/powerpc/pr57949-2.c: Likewise. > > Backport from mainline r204799: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * g++.dg/eh/ppc64-sighandle-cr.C: New test. > > [libgcc] > > 2014-03-29 Bill Schmidt <wschm...@linux.vnet.ibm.com> > > Backport from mainline r204808: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > Alan Modra <amo...@gmail.com> > > * config/rs6000/linux-unwind.h (TOC_SAVE_SLOT): Define. > (frob_update_context): Use it. > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > Alan Modra <amo...@gmail.com> > > * config/rs6000/tramp.S [__powerpc64__ && _CALL_ELF == 2]: > (trampoline_initial): Provide ELFv2 variant. > (__trampoline_setup): Likewise. > > * config/rs6000/linux-unwind.h (frob_update_context): Do not > check for AIX indirect function call sequence if _CALL_ELF == 2. > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > Alan Modra <amo...@gmail.com> > > * config/rs6000/linux-unwind.h (get_regs): Do not support > old kernel versions if _CALL_ELF == 2. > (frob_update_context): Do not support PLT stub variants only > generated by old linkers if _CALL_ELF == 2. > > Backport from mainline r204800: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > Alan Modra <amo...@gmail.com> > > * config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Correct > location of CR save area for 64-bit little-endian systems. > > [libitm] > > 2014-03-29 Bill Schmidt <wschm...@linux.vnet.ibm.com> > > Backport from mainline r204808: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * config/powerpc/sjlj.S [__powerpc64__ && _CALL_ELF == 2]: > (FUNC): Define ELFv2 variant. > (END): Likewise. > (HIDDEN): Likewise. > (CALL): Likewise. > (BASE): Likewise. > (LR_SAVE): Likewise. > > [libstdc++] > > 2014-03-29 Bill Schmidt <wschm...@linux.vnet.ibm.com> > > Backport from mainline r204808: > > 2013-11-14 Ulrich Weigand <ulrich.weig...@de.ibm.com> > > * scripts/extract_symvers.in: Ignore <localentry: > fields > in readelf --symbols output.
Okay. Thanks, David