X86-64: Correct CFA in _dl_runtime_resolve

Message ID 20160819203022.GA12109@intel.com
State New, archived
Headers

Commit Message

Lu, Hongjiu Aug. 19, 2016, 8:30 p.m. UTC
  When stack is re-aligned in _dl_runtime_resolve, there is no need to
adjust CFA when allocating register save area on stack.

Tested on x86-64.  OK for master?


H.J.
---
	* sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Don't
	adjust CFA when allocating register save area on re-aligned
	stack.
---
 sysdeps/x86_64/dl-trampoline.h | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

H.J. Lu Aug. 26, 2016, 3:53 p.m. UTC | #1
On Fri, Aug 19, 2016 at 1:30 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> When stack is re-aligned in _dl_runtime_resolve, there is no need to
> adjust CFA when allocating register save area on stack.
>
> Tested on x86-64.  OK for master?
>
>
> H.J.
> ---
>         * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Don't
>         adjust CFA when allocating register save area on re-aligned
>         stack.
> ---
>  sysdeps/x86_64/dl-trampoline.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/sysdeps/x86_64/dl-trampoline.h b/sysdeps/x86_64/dl-trampoline.h
> index b90836a..8161f96 100644
> --- a/sysdeps/x86_64/dl-trampoline.h
> +++ b/sysdeps/x86_64/dl-trampoline.h
> @@ -69,7 +69,9 @@ _dl_runtime_resolve:
>         and $-VEC_SIZE, %RSP_LP
>  #endif
>         sub $REGISTER_SAVE_AREA, %RSP_LP
> +#if !DL_RUNTIME_RESOLVE_REALIGN_STACK
>         cfi_adjust_cfa_offset(REGISTER_SAVE_AREA)
> +#endif
>         # Preserve registers otherwise clobbered.
>         movq %rax, REGISTER_SAVE_RAX(%rsp)
>         movq %rcx, REGISTER_SAVE_RCX(%rsp)
> --
> 2.7.4
>

I am checking it in.
  
H.J. Lu Oct. 19, 2017, 3:01 p.m. UTC | #2
On Fri, Aug 26, 2016 at 8:53 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Aug 19, 2016 at 1:30 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> When stack is re-aligned in _dl_runtime_resolve, there is no need to
>> adjust CFA when allocating register save area on stack.
>>
>> Tested on x86-64.  OK for master?
>>
>>
>> H.J.
>> ---
>>         * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Don't
>>         adjust CFA when allocating register save area on re-aligned
>>         stack.
>> ---
>>  sysdeps/x86_64/dl-trampoline.h | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/sysdeps/x86_64/dl-trampoline.h b/sysdeps/x86_64/dl-trampoline.h
>> index b90836a..8161f96 100644
>> --- a/sysdeps/x86_64/dl-trampoline.h
>> +++ b/sysdeps/x86_64/dl-trampoline.h
>> @@ -69,7 +69,9 @@ _dl_runtime_resolve:
>>         and $-VEC_SIZE, %RSP_LP
>>  #endif
>>         sub $REGISTER_SAVE_AREA, %RSP_LP
>> +#if !DL_RUNTIME_RESOLVE_REALIGN_STACK
>>         cfi_adjust_cfa_offset(REGISTER_SAVE_AREA)
>> +#endif
>>         # Preserve registers otherwise clobbered.
>>         movq %rax, REGISTER_SAVE_RAX(%rsp)
>>         movq %rcx, REGISTER_SAVE_RCX(%rsp)
>> --
>> 2.7.4
>>
>
> I am checking it in.
>

I am backporting it to 2.24 and 2.23 branches.
  

Patch

diff --git a/sysdeps/x86_64/dl-trampoline.h b/sysdeps/x86_64/dl-trampoline.h
index b90836a..8161f96 100644
--- a/sysdeps/x86_64/dl-trampoline.h
+++ b/sysdeps/x86_64/dl-trampoline.h
@@ -69,7 +69,9 @@  _dl_runtime_resolve:
 	and $-VEC_SIZE, %RSP_LP
 #endif
 	sub $REGISTER_SAVE_AREA, %RSP_LP
+#if !DL_RUNTIME_RESOLVE_REALIGN_STACK
 	cfi_adjust_cfa_offset(REGISTER_SAVE_AREA)
+#endif
 	# Preserve registers otherwise clobbered.
 	movq %rax, REGISTER_SAVE_RAX(%rsp)
 	movq %rcx, REGISTER_SAVE_RCX(%rsp)