This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix .ctors/.dtors header configure test for bootstrapping
On 03/07/12 14:30, Joseph S. Myers wrote:
> - AC_TRY_LINK([], [
> -__attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
> -__attribute__ ((destructor)) void dtor (void) { puts("dtor"); }
> + LIBC_TRY_LINK_STATIC([
> +__attribute__ ((constructor)) void ctor (void) { }
> +__attribute__ ((destructor)) void dtor (void) { }
I recommend an asm("") in those function bodies.
Gcc could legitimately eliminate those functions as empty.
I think that's the reason for the puts hack originally.
r~