This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][BZ #19490] Add unwind descriptors for x86_64 _mcount and __fentry__


On 23 Jan 2016 14:52, Paul Pluzhnikov wrote:
> --- a/sysdeps/x86_64/_mcount.S
> +++ b/sysdeps/x86_64/_mcount.S
> @@ -28,8 +28,10 @@
>  	.type C_SYMBOL_NAME(_mcount), @function
>  	.align ALIGNARG(4)
>  C_LABEL(_mcount)
> +	cfi_startproc
>  	/* Allocate space for 7 registers.  */
>  	subq	$56,%rsp
> +	cfi_adjust_cfa_offset (56)
>  	movq	%rax,(%rsp)
>  	movq	%rcx,8(%rsp)
>  	movq	%rdx,16(%rsp)
> @@ -37,6 +39,13 @@ C_LABEL(_mcount)
>  	movq	%rdi,32(%rsp)
>  	movq	%r8,40(%rsp)
>  	movq	%r9,48(%rsp)
> +	cfi_rel_offset (rax, 0)
> +	cfi_rel_offset (rcx, 8)
> +	cfi_rel_offset (rdx, 16)
> +	cfi_rel_offset (rsi, 24)
> +	cfi_rel_offset (rdi, 32)
> +	cfi_rel_offset (r8, 40)
> +	cfi_rel_offset (r9, 48)

don't we usually interleave the insns & cfi calls so that it's harder
for them to get out of sync ?

C_LABEL(_mcount)
	cfi_startproc
	/* Allocate space for 7 registers.  */
	subq	$56,%rsp
	cfi_adjust_cfa_offset (56)
	movq	%rax,(%rsp)
	cfi_rel_offset (rax, 0)
	movq	%rcx,8(%rsp)
	cfi_rel_offset (rcx, 8)
	movq	%rdx,16(%rsp)
	cfi_rel_offset (rdx, 16)
...

ignoring that, the actual patch looks fine

>  	.type C_SYMBOL_NAME(__fentry__), @function
>  	.align ALIGNARG(4)
>  C_LABEL(__fentry__)
> -	/* Allocate space for 7 registers.  */
> +	cfi_startproc
> +	/* Allocate space for 7 registers (+8 for proper stack alignment).  */
>  	subq	$64,%rsp

mmm, 56 is used above w/_mcount and is 8 byte aligned.  are you saying
we need 16 byte alignment and thus _mcount should be fixed ?
-mike

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]