1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

* elf/dl-runtime.c (fixup, profile_fixup): The final arg to _dl_lookup_*symbol is DL_LOOKUP_NOPLT not ELF_MACHINE_JMP_SLOT. * elf/elf.h (EM_SPARC64): Remove. (EM_SPARC32PLUS, EM_SPARCV9): Add. (HWCAP_SPARC_V9): Add. * elf/ldsodefs.h (_dl_hwcap): Declare. * sysdeps/sparc/sparc32/dl-machine.h (_dl_hwcap, _dl_hwcap_mask): Weaken so dlopen from static progies works. (WEAKADDR): New macro. (elf_machine_matches_host): Accept EM_SPARC32PLUS on a v9 cpu. (LD_SO_PRELOAD): New macro. (elf_machine_fixup_plt): Cope with weak _dl_hwcap. (elf_machine_rela): Weaken _dl_rtld_map. * sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Rename __libc_clone to __clone, and remove the later's alias. * sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c: Copy to/from the kernel's structure.

1998-04-06  Jakub Jelinek <jj@sunsite.ms.mff.cuni.cz>

	* elf/dl-runtime.c (fixup, profile_fixup): The final arg to
	_dl_lookup_*symbol is DL_LOOKUP_NOPLT not ELF_MACHINE_JMP_SLOT.

	* elf/elf.h (EM_SPARC64): Remove.
	(EM_SPARC32PLUS, EM_SPARCV9): Add.
	(HWCAP_SPARC_V9): Add.

	* elf/ldsodefs.h (_dl_hwcap): Declare.
	* sysdeps/sparc/sparc32/dl-machine.h (_dl_hwcap, _dl_hwcap_mask):
	Weaken so dlopen from static progies works.
	(WEAKADDR): New macro.
	(elf_machine_matches_host): Accept EM_SPARC32PLUS on a v9 cpu.
	(LD_SO_PRELOAD): New macro.
	(elf_machine_fixup_plt): Cope with weak _dl_hwcap.
	(elf_machine_rela): Weaken _dl_rtld_map.

	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Rename __libc_clone
	to __clone, and remove the later's alias.
	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise.

	* sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c: Copy to/from
	the kernel's structure.

	* sysdeps/generic/libc-start.c: Allow init and fini to be null.
This commit is contained in:
Richard Henderson
1998-04-06 19:08:46 +00:00
parent a55400166d
commit 4194bc660f
10 changed files with 172 additions and 150 deletions

View File

@@ -21,120 +21,65 @@
#include <syscall.h>
#include <sys/signal.h>
#include <errno.h>
#include <kernel_sigaction.h>
/* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. */
int __libc_missing_rt_sigs;
/* Commented out while I figure out what the fuck goes on */
long ____sig_table [NSIG];
#if 0
/* The kernel will deliver signals in the old way if the signal
number is a positive number. The kernel will deliver a signal
with the new stack layout if the signal number is a negative number.
Our sigaction code takes care of selecting the type of kernel we are
using at runtime. */
extern void ____sparc_signal_trampoline (int);
int
__trampoline_sigaction (int sig, struct sigaction *new, struct sigaction *old)
{
int ret;
int need_to_hide_trick = 0;
__sighandler_t old_sh;
if (new)
{
if (new->sa_handler != SIG_DFL && new->sa_handler != SIG_IGN)
{
old_sh = ____sig_table[sig];
____sig_table[sig] = (long int) new->sa_handler;
new->sa_handler = ____sparc_signal_trampoline;
need_to_hide_trick = 1;
}
}
__asm__("or %%g0,%0,%%g1\n\t"
"or %%g0,%1,%%o0\n\t"
"or %%g0,%2,%%o1\n\t"
"or %%g0,%3,%%o2\n\t"
"t 0x10\n\t"
"bcc 1f\n\t"
"or %%o0, %%g0, %0\n\t"
"sub %%g0, %%o0, %0\n\t"
"1:"
: "=r" (ret), "=r" ((long int) sig), "=r" ((long int) new),
"=r" ((long int) old)
: "0" (__NR_sigaction), "1" (sig), "2" (new), "3" (old)
: "g1", "o0", "o1", "o2");
if (ret >= 0)
{
if (old && old->sa_handler == ____sparc_signal_trampoline)
{
if (need_to_hide_trick)
old->sa_handler = old_sh;
else
old->sa_handler = ____sig_table[sig];
}
if (need_to_hide_trick)
new->sa_handler = ____sig_table[sig];
return 0;
}
__set_errno (-ret);
return -1;
}
#else
# define __new_sigaction __sigaction
#endif
int
__new_sigaction (int sig, __const struct sigaction *new, struct sigaction *old)
__sigaction (int sig, __const struct sigaction *act, struct sigaction *oact)
{
int ret;
struct kernel_sigaction k_sigact, k_osigact;
/* Magic to tell the kernel we are using "new-style" signals, in that
the signal table is not kept in userspace. Not the same as the
really-new-style rt signals. */
sig = -sig;
__asm__("or %%g0,%0,%%g1\n\t"
"or %%g0,%1,%%o0\n\t"
"or %%g0,%2,%%o1\n\t"
"or %%g0,%3,%%o2\n\t"
"t 0x10\n\t"
"bcc 1f\n\t"
"or %%o0, %%g0, %0\n\t"
"sub %%g0,%%o0,%0\n\t"
"1:"
: "=r" (ret), "=r" ((long int) sig), "=r" ((long int) new),
"=r" ((long int) old)
: "0" (__NR_sigaction), "1" (sig), "2" (new), "3" (old)
: "g1", "o0", "o1", "o2");
if (act)
{
k_sigact.sa_handler = act->sa_handler;
k_sigact.sa_mask = act->sa_mask.__val[0];
k_sigact.sa_flags = act->sa_flags;
}
{
register int r_syscallnr __asm__("%g1") = __NR_sigaction;
register int r_sig __asm__("%o0") = sig;
register struct kernel_sigaction *r_act __asm__("%o1");
register struct kernel_sigaction *r_oact __asm__("%o2");
r_act = act ? &k_sigact : NULL;
r_oact = oact ? &k_osigact : NULL;
__asm__ __volatile__("t 0x10\n\t"
"bcc 1f\n\t"
" nop\n\t"
" sub %%g0,%%o0,%%o0\n"
"1:"
: "=r"(r_sig)
: "r"(r_syscallnr), "r"(r_act), "r"(r_oact),
"0"(r_sig));
ret = r_sig;
}
if (ret >= 0)
return 0;
{
if (oact)
{
oact->sa_handler = k_osigact.sa_handler;
oact->sa_mask.__val[0] = k_osigact.sa_mask;
oact->sa_flags = k_osigact.sa_flags;
oact->sa_restorer = NULL;
}
return 0;
}
__set_errno (-ret);
return -1;
}
#if 0
int
__sigaction (int sig, __const struct sigaction *new, struct sigaction *old)
{
static (*sigact_routine) (int, __const struct sigaction *, struct sigaction *);
int ret;
struct sigaction sa;
if (sigact_routine)
return (*sigact_routine) (sig, new, old);
ret = __new_sigaction (1, NULL, &sa);
if (ret == -1)
sigact_routine = __trampoline_sigaction;
else
sigact_routine = __new_sigaction;
return __sigaction (sig, new, old);
}
#endif
weak_alias (__sigaction, sigaction);