This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Provide crt[in].S for x86-64
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Wed, 8 Feb 2012 15:45:19 +0000 (UTC)
- Subject: Re: [RFC] Provide crt[in].S for x86-64
- References: <4F328903.9050704@redhat.com>
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