On 2020-05-31 19:17, Theo de Raadt wrote:
Paul Irofti <p...@irofti.net> wrote:
Yeah, I just followed the dlfcn/dlfcn_stubs.c example from libc. Which
I see now it is commented out...
--- lib/libc/dlfcn/init.c.before Sat May 30 23:26:35 2020
+++ lib/libc/dlfcn/init.c Sat May 30 18:00:45 2020
@@ -70,7 +70,7 @@
/* provide definitions for these */
const dl_cb *_dl_cb __relro = NULL;
-#if defined(__amd64)
+#if defined(__amd64__) || defined(__powerpc__)
uint64_t (*const tc_get_timecount)(void) = tc_get_timecount_md;
#else
uint64_t (*const tc_get_timecount)(void) = NULL;
1) I think adding _md to the name is superflous. There will never
be a MI version, so tc_get_timecount() is enough.
What about pvclock(4)?
What about it? Is it MI?
It is used by two architectures. There is also glxpcib. Of course we can
have a copy of each in arch/*/usertc.c
2) I hope we can get away from #ifdef __ arch__.
Maybe this can be split into architectures which
a) have a function called tc_get_timecount()
or
b) tc_get_timecount is #define'd to NULL, though I don't
know which MD include file to do that in
If we go with something like this or with something like -DTIMEKEEP,
how do we handle the different PROTO_WRAP vs. PROTO_NORMAL
declarations? Split them in MD headers? But then we end up in the same
place. Sort of.
Sorry you lost me here.
I was talking about kettenis@'s idea that this will help us lose the
wrapper on architectures that do not support user clock_gettime.
In lib/libc/hidden/time.h we have PROTO_WRAP(clock_gettime); instead of
PROTO_NORMAL(clock_gettime) and all the libc calls to clock_gettime()
are now WRAP(clock_gettime).
So we will have to keep the wrapper even for architectures that just
fallback to the system call.
The only way not to do that is to add a different macro? Or to create MD
files for wrap and non-wrap architectures.
> [aggressive defined-defined comment]
I am more than happy to lose the ifdef maze as you know I always have
been in such situations.
The reason I put that there is because I could not figure out another
way to do that nicely.
My diff has already split this into arch's that have tc_get_timecount()
and those that do not; your point a).
We need to do point b): identify a proper include file.
Paul