[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Nov 20 01:09:57 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752
--- Comment #13 from Mark Millard <markmi at dsl-only.net> ---
(In reply to dstaesse from comment #10)
The materials that you have referenced
indicate that __attribute__ ((constructor))
gets no arguments. Details follow.
>From the materials you referenced:
QUOTE
The .preinit_array and .init_array sections must contain function pointers (NOT
code!) The prototype of these functions must be
void func(int argc,char** argv,char** envp)
__libc_csu_init execute them in the following order:
Function pointers in .preinit_array section
Functions marked as __attribute__ ((constructor)), via _init
Function pointers in .init_array section
END QUOTE
Note that __attribute__ ((constructor)) is not for the
*init_array usage, just for usage inside _init .
And from the elf-init.c that you listed:
#ifndef NO_INITFINI
_init ();
#endif
has no arguments.
So, __attribute__ ((constructor)) routines are called
form a context not explicitly having the erguments
available.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-toolchain
mailing list