new syscall stub support for ia64 libc
Jakub Jelinek
jakub@redhat.com
Thu Oct 30 09:09:00 GMT 2003
On Thu, Oct 30, 2003 at 12:04:22AM -0800, David Mosberger wrote:
> Hi Jakub,
>
> >>>>> On Wed, 29 Oct 2003 08:44:36 +0100, Jakub Jelinek <jakub@redhat.com> said:
>
> Jakub> Yes, please post a forward ported complete tested patch (the last
> Jakub> version of the patch I and Ulrich saw was incomplete (but lead to
> Jakub> discovery of a linker bug)).
> Jakub> NPTL is now in sources CVS, so things are way easier for diffing...
>
> OK, here is a preliminary patch. Some comments:
>
> - The "assert (ph->p_vaddr == GL(dl_sysinfo_dso)" check in elf/rtld.c
> is too strict. On ia64, we have two LOAD segments, so the check
> can't possibly succeed:
>
> $ readelf -l arch/ia64/kernel/gate.so |grep LOAD
> LOAD 0x0000000000000000 0xa000000000010000 0xa000000000010000
> LOAD 0x0000000000000000 0xa000000000020000 0xa000000000020000
Can you readelf -Wl arch/ia64/kernel/gate.so |grep LOAD
(or grep -A1 LOAD instead), or better yet readelf -Wa arch/ia64/kernel/gate.so
? I'd like to understand why you need the second LOAD segment, what stuff
has it in etc.
> The patch below simply #if's out the code, but perhaps a better
> fix would be to check ph->p_vaddr only for the first LOAD segment?
Yeah, that's doable, add some variable #ifndef NDEBUG, increment it for
each PT_LOAD and use it in the assert.
> - The changes to linuxthreads/{manager,pthread}.c are almost certainly
> wrong, but I'm not sure I understand how you want things set up to
> ensure that single-threaded apps use the new stub but linuxthread
> apps use the old one.
IMHO NEED_DL_SYSINFO should be defined in both NPTL and
Linuxthread ia64/dl-sysdep.h, while USE_DL_SYSINFO only in NPTL.
And sysdep.h should use sysinfo only if USE_DL_SYSINFO is defined.
Then linuxthreads will work just fine (use break always, who cares)
and NPTL will use VDSO.
> - The libc-start.c change is also "wrong" but since DL_SYSDEP_OSCHECK()
> may do syscalls, it is necessary to do __pthread_initialize_minimal()
> first, as otherwise the minimal thread descriptor isn't setup.
This is handled on IA-32 by providing DL_SYSINFO_DEFAULT (and defining
USE_DL_SYSINFO). This means the few syscalls in DL_SYSDEP_OSCHECK will
use the break insn and the rest will use VDSO if available.
Jakub
More information about the Libc-hacker
mailing list