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: [RFC] Provide crt[in].S for x86-64


On Wed, 8 Feb 2012, Marek Polacek wrote:

> +_init:
> +	/* Maintain 16-byte stack alignment for called functions.  */
> +	subq $8, %rsp
> +#if PREINIT_FUNCTION_WEAK
> +	movq PREINIT_FUNCTION@GOTPCREL(%rip), %rax
> +	testq %rax, %rax
> +	je .Lno_weak_fn
> +	call PREINIT_FUNCTION@PLT
> +.Lno_weak_fn:
> +#else
> +	addq $8, %rsp
> +	ret
> +#endif

That #else case looks wrong, you still need to call the function 
(directly) in the non-weak case, and the final addq and ret should only be 
in the epilogue in crtn.S, not in crti.S, so that all the other functions 
other objects contribute to the .init section are called.

-- 
Joseph S. Myers
joseph@codesourcery.com


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