Re: ppc/ppc64 and x86 vsyscalls

From: Ulrich Drepper
Date: Tue Mar 09 2004 - 16:17:24 EST


Benjamin Herrenschmidt wrote:

> Ok. So the challenge is to write the necessary code in the kernel
> to build that DSO based on the various functions after detection
> of the CPU type.
>
> Another option would be to pre-build a bunch of them at kernel compile
> time. I have to investigate. The risk is that we end up with too
> many combinations, thus bloating the kernel image.

You can create one "big" DSO which covers all the configured processors.
Then at kernel start time, you determine the actual processor and
adjust the symbol table offsets to point to the correct version. There
is no requirement that the table used is identical to the one on disk.
It's loaded into ordinary memory which can be modified.

The tricky part of this would be to determine the symbol table slots.
But even this is quite simple. Just locate the symbol table in the
ELF-way, then iterate over the entries and use strcmp() for the names
and act upon match. What you shouldn't do is to generate pointer to the
symbol table entries somewhere. This is probably fragile and not worth
the few cycles you'll save.

--
â Ulrich Drepper â Red Hat, Inc. â 444 Castro St â Mountain View, CA â
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/