rs6000.h (RS6000_SAVE_AREA): Handle ABI_ELFv2.

gcc/ChangeLog:

2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
	    Alan Modra  <amodra@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.Weigand@de.ibm.com>
	    Alan Modra  <amodra@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.Weigand@de.ibm.com>
	    Michael Gschwind  <mkg@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.Weigand@de.ibm.com>
	    Michael Gschwind  <mkg@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.Weigand@de.ibm.com>
	    Michael Gschwind  <mkg@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.Weigand@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.Weigand@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.

gcc/testsuite/ChangeLog:

2013-11-14  Ulrich Weigand  <Ulrich.Weigand@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.Weigand@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.Weigand@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.

libgcc/ChangeLog:

2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
	    Alan Modra  <amodra@gmail.com>

	* config/rs6000/linux-unwind.h (TOC_SAVE_SLOT): Define.
	(frob_update_context): Use it.

2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
	    Alan Modra  <amodra@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.Weigand@de.ibm.com>
	    Alan Modra  <amodra@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.

libitm/ChangeLog:

2013-11-14  Ulrich Weigand  <Ulrich.Weigand@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++/ChangeLog:

2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>

	* scripts/extract_symvers.in: Ignore <localentry: > fields
	in readelf --symbols output.


Co-Authored-By: Alan Modra <amodra@gmail.com>
Co-Authored-By: Michael Gschwind <mkg@us.ibm.com>

From-SVN: r204808
This commit is contained in:
Ulrich Weigand 2013-11-14 18:50:48 +00:00 committed by Ulrich Weigand
parent 140f2c812c
commit b54214fe22
31 changed files with 1453 additions and 219 deletions

View File

@ -1,3 +1,186 @@
2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Alan Modra <amodra@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.Weigand@de.ibm.com>
Alan Modra <amodra@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.Weigand@de.ibm.com>
Michael Gschwind <mkg@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.Weigand@de.ibm.com>
Michael Gschwind <mkg@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.Weigand@de.ibm.com>
Michael Gschwind <mkg@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.Weigand@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.Weigand@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.
2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* config/rs6000/rs6000.c (rs6000_arg_partial_bytes): Simplify logic

View File

@ -3805,7 +3805,7 @@ case "${target}" in
;;
powerpc*-*-* | rs6000-*-*)
supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64"
supported_defaults="abi cpu cpu_32 cpu_64 float tune tune_32 tune_64"
for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do
eval "val=\$with_$which"
@ -3842,6 +3842,16 @@ case "${target}" in
;;
esac
done
case "$with_abi" in
"" | elfv1 | elfv2 )
#OK
;;
*)
echo "Unknown ABI used in --with-abi=$with_abi"
exit 1
;;
esac
;;
s390*-*-*)

View File

@ -25,9 +25,6 @@
#ifndef RS6000_BI_ARCH
#undef DEFAULT_ABI
#define DEFAULT_ABI ABI_AIX
#undef TARGET_64BIT
#define TARGET_64BIT 1
@ -88,6 +85,12 @@ extern int dot_symbols;
#define INVALID_64BIT "-m%s not supported in this configuration"
#define INVALID_32BIT INVALID_64BIT
#ifdef LINUX64_DEFAULT_ABI_ELFv2
#define ELFv2_ABI_CHECK (rs6000_elf_abi != 1)
#else
#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)
#endif
#undef SUBSUBTARGET_OVERRIDE_OPTIONS
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do \
@ -102,6 +105,12 @@ extern int dot_symbols;
error (INVALID_64BIT, "call"); \
} \
dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \
if (ELFv2_ABI_CHECK) \
{ \
rs6000_current_abi = ABI_ELFv2; \
if (dot_symbols) \
error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \
} \
if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \
{ \
rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
@ -355,7 +364,11 @@ extern int dot_symbols;
#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
#ifdef LINUX64_DEFAULT_ABI_ELFv2
#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
#else
#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
#endif
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
#if DEFAULT_LIBC == LIBC_UCLIBC

View File

@ -54,6 +54,7 @@
--with-float is ignored if -mhard-float or -msoft-float are
specified. */
#define OPTION_DEFAULT_SPECS \
{"abi", "%{!mabi=elfv*:-mabi=%(VALUE)}" }, \
{"tune", "%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}" }, \
{"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}}" }, \
{"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}}" }, \

View File

@ -256,7 +256,30 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
* the real function with one or two leading periods respectively.
*/
#if defined (__powerpc64__)
#if defined(__powerpc64__) && _CALL_ELF == 2
/* Defining "toc" above breaks @toc in assembler code. */
#undef toc
#define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name)
#define JUMP_TARGET(name) FUNC_NAME(name)
#define FUNC_START(name) \
.type FUNC_NAME(name),@function; \
.globl FUNC_NAME(name); \
FUNC_NAME(name): \
0: addis 2,12,(.TOC.-0b)@ha; \
addi 2,2,(.TOC.-0b)@l; \
.localentry FUNC_NAME(name),.-FUNC_NAME(name)
#define HIDDEN_FUNC(name) \
FUNC_START(name) \
.hidden FUNC_NAME(name);
#define FUNC_END(name) \
.size FUNC_NAME(name),.-FUNC_NAME(name)
#elif defined (__powerpc64__)
#define FUNC_NAME(name) GLUE(.,name)
#define JUMP_TARGET(name) FUNC_NAME(name)
#define FUNC_START(name) \

View File

@ -1050,7 +1050,8 @@
(and (match_code "symbol_ref")
(match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op))
&& ((SYMBOL_REF_LOCAL_P (op)
&& (DEFAULT_ABI != ABI_AIX
&& ((DEFAULT_ABI != ABI_AIX
&& DEFAULT_ABI != ABI_ELFv2)
|| !SYMBOL_REF_EXTERNAL_P (op)))
|| (op == XEXP (DECL_RTL (current_function_decl),
0)))")))

View File

@ -461,6 +461,10 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
case ABI_AIX:
builtin_define ("_CALL_AIXDESC");
builtin_define ("_CALL_AIX");
builtin_define ("_CALL_ELF=1");
break;
case ABI_ELFv2:
builtin_define ("_CALL_ELF=2");
break;
case ABI_DARWIN:
builtin_define ("_CALL_DARWIN");
@ -473,6 +477,13 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
if (TARGET_SOFT_FLOAT || !TARGET_FPRS)
builtin_define ("__NO_FPRS__");
/* Whether aggregates passed by value are aligned to a 16 byte boundary
if their alignment is 16 bytes or larger. */
if ((TARGET_MACHO && rs6000_darwin64_abi)
|| DEFAULT_ABI == ABI_ELFv2
|| (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm))
builtin_define ("__STRUCT_PARM_ALIGN__=16");
/* Generate defines for Xilinx FPU. */
if (rs6000_xilinx_fpu)
{

View File

@ -107,7 +107,8 @@ enum group_termination
/* Enumeration to give which calling sequence to use. */
enum rs6000_abi {
ABI_NONE,
ABI_AIX, /* IBM's AIX */
ABI_AIX, /* IBM's AIX, or Linux ELFv1 */
ABI_ELFv2, /* Linux ELFv2 ABI */
ABI_V4, /* System V.4/eabi */
ABI_DARWIN /* Apple's Darwin (OS X kernel) */
};

View File

@ -158,6 +158,7 @@ extern tree altivec_resolve_overloaded_builtin (location_t, tree, void *);
extern rtx rs6000_libcall_value (enum machine_mode);
extern rtx rs6000_va_arg (tree, tree);
extern int function_ok_for_sibcall (tree);
extern int rs6000_reg_parm_stack_space (tree);
extern void rs6000_elf_declare_function_name (FILE *, const char *, tree);
extern bool rs6000_elf_in_small_data_p (const_tree);
#ifdef ARGS_SIZE_RTX

File diff suppressed because it is too large Load Diff

View File

@ -1527,18 +1527,14 @@ extern enum reg_class rs6000_constraints[RS6000_CONSTRAINT_MAX];
#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0 \
|| (flag_sanitize & SANITIZE_ADDRESS) != 0)
/* Size of the outgoing register save area */
#define RS6000_REG_SAVE \
((DEFAULT_ABI == ABI_V4 ? 0 : 32) << (TARGET_64BIT ? 1 : 0))
/* Size of the fixed area on the stack */
#define RS6000_SAVE_AREA \
((DEFAULT_ABI == ABI_V4 ? 8 : 24) << (TARGET_64BIT ? 1 : 0))
((DEFAULT_ABI == ABI_V4 ? 8 : DEFAULT_ABI == ABI_ELFv2 ? 16 : 24) \
<< (TARGET_64BIT ? 1 : 0))
/* MEM representing address to save the TOC register */
#define RS6000_SAVE_TOC gen_rtx_MEM (Pmode, \
plus_constant (Pmode, stack_pointer_rtx, \
(TARGET_32BIT ? 20 : 40)))
/* Stack offset for toc save slot. */
#define RS6000_TOC_SAVE_SLOT \
((DEFAULT_ABI == ABI_ELFv2 ? 12 : 20) << (TARGET_64BIT ? 1 : 0))
/* Align an address */
#define RS6000_ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1))
@ -1588,7 +1584,7 @@ extern enum reg_class rs6000_constraints[RS6000_CONSTRAINT_MAX];
/* Define this if stack space is still allocated for a parameter passed
in a register. The value is the number of bytes allocated to this
area. */
#define REG_PARM_STACK_SPACE(FNDECL) RS6000_REG_SAVE
#define REG_PARM_STACK_SPACE(FNDECL) rs6000_reg_parm_stack_space((FNDECL))
/* Define this if the above stack space is to be considered part of the
space allocated by the caller. */
@ -1641,10 +1637,17 @@ extern enum reg_class rs6000_constraints[RS6000_CONSTRAINT_MAX];
#define ALTIVEC_ARG_MAX_REG (ALTIVEC_ARG_MIN_REG + 11)
#define ALTIVEC_ARG_NUM_REG (ALTIVEC_ARG_MAX_REG - ALTIVEC_ARG_MIN_REG + 1)
/* Maximum number of registers per ELFv2 homogeneous aggregate argument. */
#define AGGR_ARG_NUM_REG 8
/* Return registers */
#define GP_ARG_RETURN GP_ARG_MIN_REG
#define FP_ARG_RETURN FP_ARG_MIN_REG
#define ALTIVEC_ARG_RETURN (FIRST_ALTIVEC_REGNO + 2)
#define FP_ARG_MAX_RETURN (DEFAULT_ABI != ABI_ELFv2 ? FP_ARG_RETURN \
: (FP_ARG_RETURN + AGGR_ARG_NUM_REG - 1))
#define ALTIVEC_ARG_MAX_RETURN (DEFAULT_ABI != ABI_ELFv2 ? ALTIVEC_ARG_RETURN \
: (ALTIVEC_ARG_RETURN + AGGR_ARG_NUM_REG - 1))
/* Flags for the call/call_value rtl operations set up by function_arg */
#define CALL_NORMAL 0x00000000 /* no special processing */
@ -1664,8 +1667,10 @@ extern enum reg_class rs6000_constraints[RS6000_CONSTRAINT_MAX];
On RS/6000, this is r3, fp1, and v2 (for AltiVec). */
#define FUNCTION_VALUE_REGNO_P(N) \
((N) == GP_ARG_RETURN \
|| ((N) == FP_ARG_RETURN && TARGET_HARD_FLOAT && TARGET_FPRS) \
|| ((N) == ALTIVEC_ARG_RETURN && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI))
|| ((N) >= FP_ARG_RETURN && (N) <= FP_ARG_MAX_RETURN \
&& TARGET_HARD_FLOAT && TARGET_FPRS) \
|| ((N) >= ALTIVEC_ARG_RETURN && (N) <= ALTIVEC_ARG_MAX_RETURN \
&& TARGET_ALTIVEC && TARGET_ALTIVEC_ABI))
/* 1 if N is a possible register number for function argument passing.
On RS/6000, these are r3-r10 and fp1-fp13.

View File

@ -11185,7 +11185,7 @@
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGD)
(clobber (reg:SI LR_REGNO))]
"HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
"HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
{
if (TARGET_CMODEL != CMODEL_SMALL)
return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
@ -11294,7 +11294,8 @@
(unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
UNSPEC_TLSGD)
(clobber (reg:SI LR_REGNO))]
"HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
"HAVE_AS_TLS && TARGET_TLS_MARKERS
&& (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
"bl %z1(%3@tlsgd)\;nop"
[(set_attr "type" "branch")
(set_attr "length" "8")])
@ -11326,7 +11327,7 @@
(unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
UNSPEC_TLSLD)
(clobber (reg:SI LR_REGNO))]
"HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
"HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
{
if (TARGET_CMODEL != CMODEL_SMALL)
return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
@ -11429,7 +11430,8 @@
(match_operand 2 "" "g")))
(unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
(clobber (reg:SI LR_REGNO))]
"HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
"HAVE_AS_TLS && TARGET_TLS_MARKERS
&& (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
"bl %z1(%&@tlsld)\;nop"
[(set_attr "type" "branch")
(set_attr "length" "8")])
@ -11800,7 +11802,7 @@
[(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
(unspec:SI [(const_int 0)] UNSPEC_TOC))
(use (reg:SI 2))])]
"DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
"(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_32BIT"
"*
{
char buf[30];
@ -11815,7 +11817,7 @@
[(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
(unspec:DI [(const_int 0)] UNSPEC_TOC))
(use (reg:DI 2))])]
"DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
"(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_64BIT"
"*
{
char buf[30];
@ -12081,7 +12083,7 @@
operands[0] = XEXP (operands[0], 0);
if (DEFAULT_ABI == ABI_AIX)
if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
{
rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]);
DONE;
@ -12125,7 +12127,7 @@
operands[1] = XEXP (operands[1], 0);
if (DEFAULT_ABI == ABI_AIX)
if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
{
rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]);
DONE;
@ -12424,7 +12426,7 @@
[(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s"))
(match_operand 1 "" "g"))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX"
"DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
"bl %z0"
[(set_attr "type" "branch")
(set_attr "length" "4")])
@ -12434,7 +12436,7 @@
(call (mem:SI (match_operand:P 1 "current_file_function_operand" "s"))
(match_operand 2 "" "g")))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX"
"DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
"bl %z1"
[(set_attr "type" "branch")
(set_attr "length" "4")])
@ -12446,7 +12448,7 @@
[(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
(match_operand 1 "" "g"))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX"
"DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
"bl %z0\;nop"
[(set_attr "type" "branch")
(set_attr "length" "8")])
@ -12456,7 +12458,7 @@
(call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
(match_operand 2 "" "g")))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX"
"DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
"bl %z1\;nop"
[(set_attr "type" "branch")
(set_attr "length" "8")])
@ -12489,6 +12491,31 @@
[(set_attr "type" "jmpreg")
(set_attr "length" "12")])
;; Call to indirect functions with the ELFv2 ABI.
;; Operand0 is the addresss of the function to call
;; Operand2 is the stack location to hold the current TOC pointer
(define_insn "*call_indirect_elfv2<mode>"
[(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
(match_operand 1 "" "g,g"))
(set (reg:P TOC_REGNUM) (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_ELFv2"
"b%T0l\;<ptrload> 2,%2"
[(set_attr "type" "jmpreg")
(set_attr "length" "8")])
(define_insn "*call_value_indirect_elfv2<mode>"
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
(match_operand 2 "" "g,g")))
(set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_ELFv2"
"b%T1l\;<ptrload> 2,%3"
[(set_attr "type" "jmpreg")
(set_attr "length" "8")])
;; Call subroutine returning any type.
(define_expand "untyped_call"
@ -12538,7 +12565,7 @@
operands[0] = XEXP (operands[0], 0);
if (DEFAULT_ABI == ABI_AIX)
if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
{
rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]);
DONE;
@ -12565,7 +12592,7 @@
operands[1] = XEXP (operands[1], 0);
if (DEFAULT_ABI == ABI_AIX)
if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
{
rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]);
DONE;
@ -12725,7 +12752,7 @@
[(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
(match_operand 1 "" "g,g"))
(simple_return)]
"DEFAULT_ABI == ABI_AIX"
"DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
"@
b %z0
b%T0"
@ -12737,7 +12764,7 @@
(call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
(match_operand 2 "" "g,g")))
(simple_return)]
"DEFAULT_ABI == ABI_AIX"
"DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
"@
b %z1
b%T1"

View File

@ -369,6 +369,14 @@ mabi=no-spe
Target RejectNegative Var(rs6000_spe_abi, 0)
Do not use the SPE ABI extensions
mabi=elfv1
Target RejectNegative Var(rs6000_elf_abi, 1) Save
Use the ELFv1 ABI
mabi=elfv2
Target RejectNegative Var(rs6000_elf_abi, 2)
Use the ELFv2 ABI
; These are here for testing during development only, do not document
; in the manual please.

View File

@ -1,3 +1,26 @@
2013-11-14 Ulrich Weigand <Ulrich.Weigand@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.Weigand@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.Weigand@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.
2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* g++.dg/eh/ppc64-sighandle-cr.C: New test.

View File

@ -40,7 +40,11 @@
# endif
#elif defined (__powerpc64__) || defined (__ppc64__) || defined (__POWERPC64__) \
|| defined (__PPC64__)
# define SIZE 180
# if _CALL_ELF == 2
# define SIZE 208
# else
# define SIZE 180
# endif
#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
|| defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
# if defined (__ALTIVEC__)

View File

@ -1,5 +1,6 @@
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */
/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
/* { dg-options "-O2 -mno-pointers-to-nested-functions" } */
int

View File

@ -1,5 +1,6 @@
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */
/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
/* { dg-options "-O2 -mpointers-to-nested-functions" } */
int

View File

@ -1,5 +1,6 @@
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */
/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
/* { dg-options "-O2 -mno-pointers-to-nested-functions" } */
extern void ext_call (int (func) (void));

View File

@ -89,8 +89,10 @@ typedef struct sf
long a1;
long a2;
long a3;
#if _CALL_ELF != 2
long a4;
long a5;
#endif
parm_t slot[100];
} stack_frame_t;

View File

@ -107,8 +107,10 @@ typedef struct sf
long a1;
long a2;
long a3;
#if _CALL_ELF != 2
long a4;
long a5;
#endif
parm_t slot[100];
} stack_frame_t;

View File

@ -33,15 +33,27 @@ reg_parms_t gparms;
/* Wrapper to save the GPRs and FPRs and then jump to the real function. */
#if _CALL_ELF != 2
#define FUNC_START(NAME) \
"\t.globl\t" NAME "\n\t" \
".section \".opd\",\"aw\"\n\t" \
".align 3\n" \
NAME ":\n\t" \
".quad .L." NAME ",.TOC.@tocbase,0\n\t" \
".text\n\t" \
".type " NAME ", @function\n" \
".L." NAME ":\n\t"
#else
#define FUNC_START(NAME) \
"\t.globl\t" NAME "\n\t" \
".text\n\t" \
NAME ":\n" \
"0:\taddis 2,12,(.TOC.-0b)@ha\n\t" \
"addi 2,2,(.TOC.-0b)@l\n\t" \
".localentry " NAME ",.-" NAME "\n\t"
#endif
#define WRAPPER(NAME) \
__asm__ ("\t.globl\t" #NAME "_asm\n\t" \
".section \".opd\",\"aw\"\n\t" \
".align 3\n" \
#NAME "_asm:\n\t" \
".quad .L." #NAME "_asm,.TOC.@tocbase,0\n\t" \
".text\n\t" \
".type " #NAME "_asm, @function\n" \
".L." #NAME "_asm:\n\t" \
__asm__ (FUNC_START (#NAME "_asm") \
"ld 11,gparms@got(2)\n\t" \
"std 3,0(11)\n\t" \
"std 4,8(11)\n\t" \
@ -75,8 +87,10 @@ typedef struct sf
long a1;
long a2;
long a3;
#if _CALL_ELF != 2
long a4;
long a5;
#endif
unsigned long slot[100];
} stack_frame_t;

View File

@ -1,5 +1,6 @@
/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
/* { dg-options "-O2 -mcpu=power7" } */
/* Verify that vs is 16-byte aligned in the absence of -mcompat-align-parm. */

View File

@ -1,5 +1,6 @@
/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
/* { dg-options "-O2 -mcpu=power7 -mcompat-align-parm" } */
/* Verify that vs is not 16-byte aligned with -mcompat-align-parm. */

View File

@ -3020,6 +3020,22 @@ proc check_effective_target_powerpc_405_nocache { } {
}
}
# Return 1 if this is a PowerPC target using the ELFv2 ABI.
proc check_effective_target_powerpc_elfv2 { } {
if { [istarget powerpc*-*-*] } {
return [check_no_compiler_messages powerpc_elfv2 object {
#if _CALL_ELF != 2
#error not ELF v2 ABI
#else
int dummy;
#endif
}]
} else {
return 0
}
}
# Return 1 if this is a SPU target with a toolchain that
# supports automatic overlay generation.

View File

@ -1,3 +1,27 @@
2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Alan Modra <amodra@gmail.com>
* config/rs6000/linux-unwind.h (TOC_SAVE_SLOT): Define.
(frob_update_context): Use it.
2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Alan Modra <amodra@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.Weigand@de.ibm.com>
Alan Modra <amodra@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.
2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Alan Modra <amodra@gmail.com>

View File

@ -24,9 +24,19 @@
#define R_LR 65
#define R_CR2 70
#define R_CR3 71
#define R_CR4 72
#define R_VR0 77
#define R_VRSAVE 109
#ifdef __powerpc64__
#if _CALL_ELF == 2
#define TOC_SAVE_SLOT 24
#else
#define TOC_SAVE_SLOT 40
#endif
#endif
struct gcc_vregs
{
__attribute__ ((vector_size (16))) int vr[32];
@ -107,6 +117,8 @@ get_regs (struct _Unwind_Context *context)
}
else if (pc[1] == 0x380000AC)
{
#if _CALL_ELF != 2
/* These old kernel versions never supported ELFv2. */
/* This works for 2.4 kernels, but not for 2.6 kernels with vdso
because pc isn't pointing into the stack. Can be removed when
no one is running 2.4.19 or 2.4.20, the first two ppc64
@ -121,6 +133,7 @@ get_regs (struct _Unwind_Context *context)
if ((long) frame24->puc != -21 * 8)
return frame24->puc->regs;
else
#endif
{
/* This works for 2.4.21 and later kernels. */
struct rt_sigframe {
@ -212,8 +225,16 @@ ppc_fallback_frame_state (struct _Unwind_Context *context,
#ifndef __LITTLE_ENDIAN__
cr_offset += sizeof (long) - 4;
#endif
/* In the ELFv1 ABI, CR2 stands in for the whole CR. */
fs->regs.reg[R_CR2].how = REG_SAVED_OFFSET;
fs->regs.reg[R_CR2].loc.offset = cr_offset;
#if _CALL_ELF == 2
/* In the ELFv2 ABI, every CR field has a separate CFI entry. */
fs->regs.reg[R_CR3].how = REG_SAVED_OFFSET;
fs->regs.reg[R_CR3].loc.offset = cr_offset;
fs->regs.reg[R_CR4].how = REG_SAVED_OFFSET;
fs->regs.reg[R_CR4].loc.offset = cr_offset;
#endif
fs->regs.reg[R_LR].how = REG_SAVED_OFFSET;
fs->regs.reg[R_LR].loc.offset = (long) &regs->link - new_cfa;
@ -297,9 +318,13 @@ frob_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs ATT
figure out if it was saved. The big problem here is that the
code that does the save/restore is generated by the linker, so
we have no good way to determine at compile time what to do. */
if (pc[0] == 0xF8410028
if (pc[0] == 0xF8410000 + TOC_SAVE_SLOT
#if _CALL_ELF != 2
/* The ELFv2 linker never generates the old PLT stub form. */
|| ((pc[0] & 0xFFFF0000) == 0x3D820000
&& pc[1] == 0xF8410028))
&& pc[1] == 0xF8410000 + TOC_SAVE_SLOT)
#endif
)
{
/* We are in a plt call stub or r2 adjusting long branch stub,
before r2 has been saved. Keep REG_UNSAVED. */
@ -308,18 +333,21 @@ frob_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs ATT
{
unsigned int *insn
= (unsigned int *) _Unwind_GetGR (context, R_LR);
if (insn && *insn == 0xE8410028)
_Unwind_SetGRPtr (context, 2, context->cfa + 40);
if (insn && *insn == 0xE8410000 + TOC_SAVE_SLOT)
_Unwind_SetGRPtr (context, 2, context->cfa + TOC_SAVE_SLOT);
#if _CALL_ELF != 2
/* ELFv2 does not use this function pointer call sequence. */
else if (pc[0] == 0x4E800421
&& pc[1] == 0xE8410028)
&& pc[1] == 0xE8410000 + TOC_SAVE_SLOT)
{
/* We are at the bctrl instruction in a call via function
pointer. gcc always emits the load of the new R2 just
before the bctrl so this is the first and only place
we need to use the stored R2. */
_Unwind_Word sp = _Unwind_GetGR (context, 1);
_Unwind_SetGRPtr (context, 2, (void *)(sp + 40));
_Unwind_SetGRPtr (context, 2, (void *)(sp + TOC_SAVE_SLOT));
}
#endif
}
}
#endif

View File

@ -116,4 +116,70 @@ FUNC_END(__trampoline_setup)
#endif
#elif _CALL_ELF == 2
.type trampoline_initial,@object
.align 3
trampoline_initial:
ld r11,.Lchain(r12)
ld r12,.Lfunc(r12)
mtctr r12
bctr
.Lfunc = .-trampoline_initial
.quad 0 /* will be replaced with function address */
.Lchain = .-trampoline_initial
.quad 0 /* will be replaced with static chain */
trampoline_size = .-trampoline_initial
.size trampoline_initial,trampoline_size
/* R3 = stack address to store trampoline */
/* R4 = length of trampoline area */
/* R5 = function address */
/* R6 = static chain */
.pushsection ".toc","aw"
.LC0:
.quad trampoline_initial-8
.popsection
FUNC_START(__trampoline_setup)
addis 7,2,.LC0@toc@ha
ld 7,.LC0@toc@l(7) /* trampoline address -8 */
li r8,trampoline_size /* verify that the trampoline is big enough */
cmpw cr1,r8,r4
srwi r4,r4,3 /* # doublewords to move */
addi r9,r3,-8 /* adjust pointer for stdu */
mtctr r4
blt cr1,.Labort
/* Copy the instructions to the stack */
.Lmove:
ldu r10,8(r7)
stdu r10,8(r9)
bdnz .Lmove
/* Store correct function and static chain */
std r5,.Lfunc(r3)
std r6,.Lchain(r3)
/* Now flush both caches */
mtctr r4
.Lcache:
icbi 0,r3
dcbf 0,r3
addi r3,r3,8
bdnz .Lcache
/* Finally synchronize things & return */
sync
isync
blr
.Labort:
bl JUMP_TARGET(abort)
nop
FUNC_END(__trampoline_setup)
#endif

View File

@ -1,3 +1,13 @@
2013-11-14 Ulrich Weigand <Ulrich.Weigand@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.
2013-09-20 Alan Modra <amodra@gmail.com>
* configure: Regenerate.

View File

@ -26,7 +26,26 @@
#include "asmcfi.h"
#if defined(__powerpc64__) && defined(__ELF__)
#if defined(__powerpc64__) && _CALL_ELF == 2
.macro FUNC name
.globl \name
.type \name, @function
\name:
0: addis 2,12,(.TOC.-0b)@ha
addi 2,2,(.TOC.-0b)@l
.localentry \name, . - \name
.endm
.macro END name
.size \name, . - \name
.endm
.macro HIDDEN name
.hidden \name
.endm
.macro CALL name
bl \name
nop
.endm
#elif defined(__powerpc64__) && defined(__ELF__)
.macro FUNC name
.globl \name, .\name
.section ".opd","aw"
@ -117,6 +136,9 @@ _$0:
#if defined(_CALL_AIXDESC)
# define BASE 6*WS
# define LR_SAVE 2*WS
#elif _CALL_ELF == 2
# define BASE 6*WS
# define LR_SAVE 2*WS
#elif defined(_CALL_SYSV)
# define BASE 2*WS
# define LR_SAVE 1*WS

View File

@ -1,3 +1,8 @@
2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* scripts/extract_symvers.in: Ignore <localentry: > fields
in readelf --symbols output.
2013-11-14 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/bits/alloc_traits.h (__allow_copy_cons): Remove.

View File

@ -53,6 +53,7 @@ SunOS)
# present on Solaris.
${readelf} ${lib} |\
sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
sed -e 's/ \[<localentry>: [0-9]*\] //' |\
egrep -v ' (LOCAL|UND) ' |\
egrep -v ' (_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_end|_etext)$' |\
sed -e 's/ <processor specific>: / <processor_specific>:_/g' |\