From aed116911d10ca78d0ce26412334c1561138729e Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Mon, 16 Feb 2015 22:13:03 +0000 Subject: [PATCH] Unbreak sparc64 after r276630 by calling __sparc_sigtramp_setup signal trampoline as part of the MD __sys_sigaction again. Submitted by: kib (initial versions) MFC after: 3 days --- lib/libc/sparc64/sys/Makefile.inc | 2 +- lib/libc/sparc64/sys/{sigaction.S => sigaction1.S} | 5 +++-- lib/libc/sys/Makefile.inc | 8 +++++++- sys/sparc64/include/asm.h | 10 ++++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) rename lib/libc/sparc64/sys/{sigaction.S => sigaction1.S} (94%) diff --git a/lib/libc/sparc64/sys/Makefile.inc b/lib/libc/sparc64/sys/Makefile.inc index 031af1965228..726c0c944971 100644 --- a/lib/libc/sparc64/sys/Makefile.inc +++ b/lib/libc/sparc64/sys/Makefile.inc @@ -12,7 +12,7 @@ SRCS+= __sparc_sigtramp_setup.c \ CFLAGS+= -I${LIBC_SRCTOP}/sparc64/fpu -MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction.S +MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction1.S # Don't generate default code for these syscalls: NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o diff --git a/lib/libc/sparc64/sys/sigaction.S b/lib/libc/sparc64/sys/sigaction1.S similarity index 94% rename from lib/libc/sparc64/sys/sigaction.S rename to lib/libc/sparc64/sys/sigaction1.S index 7d32f975af20..219a238cdb2a 100644 --- a/lib/libc/sparc64/sys/sigaction.S +++ b/lib/libc/sparc64/sys/sigaction1.S @@ -29,7 +29,8 @@ __FBSDID("$FreeBSD$"); #include "SYS.h" -_SYSENTRY(sigaction) + WEAK_REFERENCE(__sys_sigaction, _sigaction) +ENTRY(__sys_sigaction) PIC_PROLOGUE(%o3, %o4) SET(sigcode_installed, %o4, %o3) lduw [%o3], %o4 @@ -44,6 +45,6 @@ _SYSENTRY(sigaction) 1: _SYSCALL(sigaction) retl nop -_SYSEND(sigaction) +END(__sys_sigaction) .comm sigcode_installed, 4, 4 diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index e8ec58e7a088..0edf644bae5f 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -65,7 +65,6 @@ INTERPOSED = \ sendmsg \ sendto \ setcontext \ - sigaction \ sigprocmask \ sigsuspend \ sigtimedwait \ @@ -76,6 +75,13 @@ INTERPOSED = \ write \ writev +.if ${MACHINE_CPUARCH} == "sparc64" +SRCS+= sigaction.c +NOASM+= sigaction.o +.else +INTERPOSED+= sigaction +.endif + SRCS+= ${INTERPOSED:S/$/.c/} NOASM+= ${INTERPOSED:S/$/.o/} PSEUDO+= ${INTERPOSED:C/^.*$/_&.o/} diff --git a/sys/sparc64/include/asm.h b/sys/sparc64/include/asm.h index dea06c547f9e..69a53beccb92 100644 --- a/sys/sparc64/include/asm.h +++ b/sys/sparc64/include/asm.h @@ -102,6 +102,16 @@ CNAME(x): #define ENTRY(x) _ENTRY(x) #define END(x) .size x, . - x +/* + * WEAK_REFERENCE(): create a weak reference alias from sym. + * The macro is not a general asm macro that takes arbitrary names, + * but one that takes only C names. It does the non-null name + * translation inside the macro. + */ +#define WEAK_REFERENCE(sym, alias) \ + .weak CNAME(alias); \ + .equ CNAME(alias),CNAME(sym) + /* * Kernel RCS ID tag and copyright macros */