Date: Mon, 20 Nov 2017 10:15:51 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-toolchain@FreeBSD.org Subject: [Bug 223752] clang __attribute__((constructor)) gets wrong input parameters Message-ID: <bug-223752-29464-vO9cYzLKIl@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-223752-29464@https.bugs.freebsd.org/bugzilla/> References: <bug-223752-29464@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D223752 --- Comment #21 from David Chisnall <theraven@FreeBSD.org> --- It's also worth noting that functions declared with this attribute can have some complex interaction with threading. If a process spawns a thread which calls `dlopen` then all of the library's constructors will be called in that thread. At this point, it's not clear whether the run-time linker will even have access to the arguments that you want. It's also not clear what `envp` should be (the current environment, or the environment from process creation time?) I believe glibc provides an `__arguments` variable, along the same lines as `__environ`, which allows the process to get access to the arguments from arbitrary points in the code. Implementing something like this would proba= bly be the best solution for this use case. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-223752-29464-vO9cYzLKIl>