[PATCH 1/3] x86: Initialize CPU info via IFUNC relocation [BZ 26203]
Florian Weimer
fweimer@redhat.com
Fri Sep 18 08:06:05 GMT 2020
* H. J. Lu via Libc-alpha:
> X86 CPU features in ld.so are initialized by init_cpu_features, which is
> invoked by DL_PLATFORM_INIT from _dl_sysdep_start. But when ld.so is
> loaded by static executable, DL_PLATFORM_INIT is never called.
I don't think that's accurate. It's called from elf/dl-support.c in the
static case. But I agree that it's too late in this case.
> Also x86 cache info in libc.o and libc.a is initialized by a
> constructor which may be called too late. Instead, we should
> initialize x86 CPU features and cache info by initializing dummy
> function pointers via IFUNC relocation.
Why would ld put this special IRELATIVE relocation first? I'm sorry,
but this looks very brittle.
I think there's an existing mechanism for this corner case,
ARCH_SETUP_IREL. Could you use that?
Thanks,
Florian
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
More information about the Libc-alpha
mailing list