[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2018-09-26 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 Alex S changed: What|Removed |Added CC||iwt...@gmail.com --- Comment #22 from Ale

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-20 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #21 from David Chisnall --- 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 constr

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 Dimitry Andric changed: What|Removed |Added Status|New |Closed Resolution|---

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #19 from Mark Millard --- (In reply to dstaesse from comment #18) You are welcome. My guess is that this is outside POSIX completely and is just ABI material for what you are doing. In fact, looking around I found an ARM docu

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #18 from dstaesse --- Yes, but at least it's not undefined behaviour. Thanks again for your help! -- You are receiving this mail because: You are the assignee for the bug. ___ freebs

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #17 from Mark Millard --- (In reply to dstaesse from comment #16) You may be limited to amd64 and i386 for FreeBSD: it does not appear that the other ABIs have .init_array and .fini_array support. It sounds like 223752 can be

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #16 from dstaesse --- Your comments make a lot of sense. I updated the library code to call the functions in the .init_array and .fini_array, and it looks like this works for our testcases. This is probably the answer I was loo

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #15 from dstaesse --- Created attachment 188130 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=188130&action=edit updated library code -- You are receiving this mail because: You are the assignee for the bug. __

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #14 from Mark Millard --- (In reply to Mark Millard from comment #13) Beyond my "form" vs "from" typo and "erguments" vs. "arguments" typo, I probably also should have put the word "called" in quotes: the __attribute__ ((constr

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #13 from Mark Millard --- (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

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #12 from dstaesse --- (In reply to Mark Millard from comment #11) Interesting. Doesn't the list of func_ptrs have the arguments here as well? /usr/src/lib/csu/common/ignore_init.c:extern void (*__init_array_start[])(int, char

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #11 from Mark Millard --- (In reply to dstaesse from comment #8) (In reply to dstaesse from comment #8) I took a quick grep for -r325700 (head): # grep -r __init_array_start /usr/src/* | more /usr/src/contrib/llvm/tools/lld/E

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #10 from dstaesse --- (In reply to Mark Millard from comment #9) Thanks a lot for taking time to help me out. I'm definitely no expert on this matter. Our target is restricted to POSIX. I've found mostly posts on stackoverflow

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #9 from Mark Millard --- (In reply to dstaesse from comment #7) I did not manage to find anything that mentioned the parameters/arguments: You found materials that I did not. What context(s) were they from? "portable way": wha

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #8 from dstaesse --- I agree that the documentation could be more specific about the nature of the functions that can have this attribute. It's true that most examples use functions without arguments but that could just be beca

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #7 from dstaesse --- (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

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #6 from Mark Millard --- (In reply to dstaesse from comment #4) Also: in looking around I find that every official webpage/document about this that shows examples shows functions with no arguments. (But none that I found has an

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 Mark Millard changed: What|Removed |Added CC||mar...@dsl-only.net --- Comment #5

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 --- Comment #4 from dstaesse --- Are you 100% sure about that? Doesn't this attribute work with functions that have a signature that is allowable for a main() function? I haven't heard any compiler complain, and we tried combinations of GNU

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 David Chisnall changed: What|Removed |Added CC||thera...@freebsd.org --- Comment

[Bug 223752] clang __attribute__((constructor)) gets wrong input parameters

2017-11-19 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223752 Conrad Meyer changed: What|Removed |Added Assignee|freebsd-b...@freebsd.org|freebsd-toolchain@FreeBSD.o