On 2020-05-31 18:25, Theo de Raadt wrote:
Mark Kettenis <mark.kette...@xs4all.nl> wrote:
I changed __amd64 to __amd64__ because I didn't find __powerpc. I'm
not sure, but one might move the list of arches to dlfcn/Makefile.inc
and do -DTIMEKEEP, like how thread/Makefile.inc does -DFUTEX. One
might drop the tc_get_timecount function pointer and just always call
the function #ifdef TIMEKEEP.
Yes, we prefer the __xxx__ variants in OpenBSD code; thanks for
catching that. The benefit of the TIMEKEEP define would be that we
can eliminate the fallback code completely on architectures that don't
implement this functionality.
...
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)?
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.