diff options
author | Zack Weinberg <zackw@panix.com> | 2018-03-18 17:12:42 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2018-03-26 08:27:47 -0400 |
commit | 65a7c4c9272f1b14a2b87733bf4dbb564c3dd1d2 (patch) | |
tree | 4071e1a9510db7601199bd81d045374a94ab044c /sysdeps/generic/sysdep.h | |
parent | 3dfd23eb4bdc7707048b115548e2238dacef064e (diff) | |
download | glibc-65a7c4c9272f1b14a2b87733bf4dbb564c3dd1d2.tar.gz |
RFC: Introduce pt-compat-stubs and use it to replace pt-vfork.
I am looking into the possibility of eliminating all of the duplicate
function definitions from libpthread, replacing them with
properly-tagged weak compatibility symbols that just call the
definition in libc. Because one of the duplicated functions is vfork,
the calls to libc absolutely must reuse the stack frame (a "sibcall"
in GCC internals jargon), and on several important targets, GCC does
not implement sibcalls, or only implements them for intra-module
calls. But we only need to implement a single special case,
sibcalling a function with exactly the same signature, from
immediately after the caller's own entry point; so doing it by hand in
assembly language is not a crazy notion. I believe I have managed to
turn the trick for all currently-supported targets. This patch just
converts the existing vfork stub, so that review can focus on the new
sysdep.h SIBCALL macros.
* sysdeps/generic/pt-compat-stubs.S: New file.
* nptl/Makefile (libpthread-routines): Remove pt-vfork, add
pt-compat-stubs.
(libpthread-shared-only-routines): Add pt-compat-stubs.
* posix/vfork.c: Define __libc_vfork as well as __vfork and vfork.
* sysdeps/generic/sysdep.h (SIBCALL): New macro to perform
sibling calls; the generic definition errors out if used.
* sysdeps/aarch64/sysdep.h, sysdeps/arm/sysdep.h
* sysdeps/hppa/sysdep.h, sysdeps/ia64/sysdep.h
* sysdeps/m68k/sysdep.h, sysdeps/microblaze/sysdep.h
* sysdeps/nios2/sysdep.h, sysdeps/powerpc/powerpc32/sysdep.h
* sysdeps/powerpc/powerpc64/sysdep.h, sysdeps/s390/s390-32/sysdep.h
* sysdeps/s390/s390-64/sysdep.h, sysdeps/tile/sysdep.h
* sysdeps/unix/alpha/sysdep.h, sysdeps/unix/mips/mips32/sysdep.h
* sysdeps/unix/mips/mips64/n32/sysdep.h
* sysdeps/unix/mips/mips64/n64/sysdep.h
* sysdeps/unix/sysv/linux/riscv/sysdep.h
* sysdeps/x86/sysdep.h
Provide appropriate architecture-specific definitions of
SIBCALL and, if necessary, SIBCALL_ENTRY.
* nptl/pt-vfork.c
* sysdeps/unix/sysv/linux/aarch64/pt-vfork.c
* sysdeps/unix/sysv/linux/m68k/pt-vfork.c
* sysdeps/unix/sysv/linux/tile/pt-vfork.c
* sysdeps/unix/sysv/linux/alpha/pt-vfork.S
* sysdeps/unix/sysv/linux/hppa/pt-vfork.S
* sysdeps/unix/sysv/linux/ia64/pt-vfork.S
* sysdeps/unix/sysv/linux/microblaze/pt-vfork.S
* sysdeps/unix/sysv/linux/mips/pt-vfork.S
* sysdeps/unix/sysv/linux/riscv/pt-vfork.S
* sysdeps/unix/sysv/linux/s390/pt-vfork.S
* sysdeps/unix/sysv/linux/sh/pt-vfork.S
* sysdeps/unix/sysv/linux/sparc/pt-vfork.S
Remove file.
Diffstat (limited to 'sysdeps/generic/sysdep.h')
-rw-r--r-- | sysdeps/generic/sysdep.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sysdeps/generic/sysdep.h b/sysdeps/generic/sysdep.h index 934d4da839..59e8ec237a 100644 --- a/sysdeps/generic/sysdep.h +++ b/sysdeps/generic/sysdep.h @@ -33,9 +33,20 @@ # ifndef JUMPTARGET # define JUMPTARGET(sym) sym # endif + +/* Make a "sibling call" to DEST -- that is, transfer control to DEST + as-if it had been the function called by the caller of this function. + DEST is likely to be defined in a different shared object. Only + ever used immediately after ENTRY. Must not touch the stack at + all, and must preserve all argument and call-saved registers. */ +# ifndef SIBCALL +# define SIBCALL(dest) \ + .error "Missing definition of SIBCALL" +# endif #endif -/* Makros to generate eh_frame unwind information. */ + +/* Macros to generate eh_frame unwind information. */ #ifdef __ASSEMBLER__ # define cfi_startproc .cfi_startproc # define cfi_endproc .cfi_endproc |