[PATCH v3] IBM Z: Use @PLT symbols for local functions in 64-bit mode

Andreas Krebbel krebbel@linux.ibm.com
Fri Jul 16 07:37:06 GMT 2021


On 7/12/21 9:23 PM, Ilya Leoshkevich wrote:
> Bootstrapped and regtested on s390x-redhat-linux.  Ok for master?
> 
> v1: https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573614.html
> v1 -> v2: Do not use UNSPEC_PLT in 64-bit code and rename it to
>           UNSPEC_PLT31 (Ulrich, Andreas).  Do not append @PLT only to
>           weak symbols in non-PIC code (Ulrich).  Add TLS tests.
> 
> v2: https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574646.html
> v2 -> v3: Use %K in function_profiler() and s390_output_mi_thunk(),
>           add tests for these cases.
> 
> 
> 
> This helps with generating code for kernel hotpatches, which contain
> individual functions and are loaded more than 2G away from vmlinux.
> This should not create performance regressions for the normal use
> cases, because for local functions ld replaces @PLT calls with direct
> calls.
> 
> gcc/ChangeLog:
> 
> 	* config/s390/predicates.md (bras_sym_operand): Accept all
> 	functions in 64-bit mode, use UNSPEC_PLT31.
> 	(larl_operand): Use UNSPEC_PLT31.
> 	* config/s390/s390.c (s390_loadrelative_operand_p): Likewise.
> 	(legitimize_pic_address): Likewise.
> 	(s390_emit_tls_call_insn): Mark __tls_get_offset as function,
> 	use UNSPEC_PLT31.
> 	(s390_delegitimize_address): Use UNSPEC_PLT31.
> 	(s390_output_addr_const_extra): Likewise.
> 	(print_operand): Add @PLT to TLS calls, handle %K.
> 	(s390_function_profiler): Mark __fentry__/_mcount as function,
> 	use %K, use UNSPEC_PLT31.
> 	(s390_output_mi_thunk): Use only UNSPEC_GOT, use %K.
> 	(s390_emit_call): Use UNSPEC_PLT31.
> 	(s390_emit_tpf_eh_return): Mark __tpf_eh_return as function.
> 	* config/s390/s390.md (UNSPEC_PLT31): Rename from UNSPEC_PLT.
> 	(*movdi_64): Use %K.
> 	(reload_base_64): Likewise.
> 	(*sibcall_brc): Likewise.
> 	(*sibcall_brcl): Likewise.
> 	(*sibcall_value_brc): Likewise.
> 	(*sibcall_value_brcl): Likewise.
> 	(*bras): Likewise.
> 	(*brasl): Likewise.
> 	(*bras_r): Likewise.
> 	(*brasl_r): Likewise.
> 	(*bras_tls): Likewise.
> 	(*brasl_tls): Likewise.
> 	(main_base_64): Likewise.
> 	(reload_base_64): Likewise.
> 	(@split_stack_call<mode>): Likewise.

Ok. Thanks!

Andreas


More information about the Gcc-patches mailing list