[RFC] Provide crt[in].S for x86-64
Joseph S. Myers
joseph@codesourcery.com
Wed Feb 8 15:48:00 GMT 2012
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
More information about the Libc-alpha
mailing list