Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Nov 2017 23:56:17 +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-1a6l35ws3D@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=223752

--- Comment #7 from dstaesse <dimitri.staessens@ugent.be> ---
(In reply to Mark Millard from comment #5)

Good point, we only tried amd64 and i386. 

This feature seems to be very sparsely documented, with some sources saying
everything but void func(void) is undefined behaviour and others stating that
it can have the same signature as the main() function. The GNU compiler
documentation doesn't give details and clang doesn't document it at all. I've
seen other projects use this, though.

The compiler doesn't seem to check the function signature at all, I've tried to
set the constructor attribute to functions with all sorts of parameters and
complaints.

If this is undefined behaviour, do you know of a portable way to access argv
from a shared library without passing it as a function parameter to some init
call?

-- 
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-1a6l35ws3D>