Subject: pkg/11360: undefined '
To: None <gnats-bugs@gnats.netbsd.org>
From: Nick Cuccia <cuccia@Talamasca.COM>
List: netbsd-bugs
Date: 11/01/2000 15:05:14
>Number:         11360
>Category:       pkg
>Synopsis:       undefined symbols beginning with 'machdep_sys_' in mit-pthreads pkg
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 01 15:05:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Nick Cuccia
>Release:        NetBSD-current 2000-10-31
>Organization:
The Talamasca.  We watch.  And we are always here.
>Environment:
System: NetBSD motherhouse 1.5_BETA NetBSD 1.5_BETA (TALAMASCA) #0: Wed Oct 25 11:04:17 PDT 2000 cuccia@motherhouse:/usr/src/sys/arch/sparc/compile/TALAMASCA sparc


>Description:
Applications attempting to link against the pthreads library generated
from the mit-pthreads-1.60b6 package on 1.5_BETA/sparc fail due to undefined
symbols whose names begin with 'machdep_sys_'.
>How-To-Repeat:
	1) login to a 1.5_BETA/sparc system
	2)
		# cd /usr/pkgsrc/mit-pthreads
		# make
		# cd work/pthreads-1_60_beta6/test
		# make

>Fix:

The following replacements to patch-au and patch-av, derived from the
mit-pthreads src included with mysql, appear to resolve this problem.

------------------------------------------------------------------------------

--- machdep/syscall-sparc-netbsd-1.3.S.orig	Wed Nov  1 13:06:24 2000
+++ machdep/syscall-sparc-netbsd-1.3.S	Thu Sep  9 05:52:09 1999
@@ -0,0 +1,172 @@
+/* ==== syscall.S ============================================================
+ * Copyright (c) 1994 Chris Provenzano, proven@mit.edu
+ * All rights reserved.
+ *
+ */
+
+#ifndef lint
+	.text
+	.asciz "$Id: patch-ar,v 1.1.1.1 1999/05/06 23:37:01 tv Exp $";
+#endif
+ 
+#include <machine/asm.h>
+#include <sys/syscall.h>
+
+#define	SYSCALL(x)					\
+	.globl _C_LABEL(machdep_sys_##x);		\
+							\
+_C_LABEL(machdep_sys_##x):;				\
+							\
+	mov SYS_##x, %g1;   				\
+	ta 0;						\
+	bcs,a 2b;					\
+	sub %r0,%o0,%o0;				\
+	retl							
+
+
+/*
+ * Initial asm stuff for all functions.
+ */
+	.text
+	.align	4
+
+/* ==========================================================================
+ * error code for all syscalls. The error value is returned as the negative
+ * of the errno value.
+ */
+
+1:
+	sub		%r0, %o0, %o0
+2:
+	retl
+	nop
+
+/* ==========================================================================
+ * machdep_sys_pipe()
+ */
+    .globl _C_LABEL(machdep_sys_pipe)
+
+_C_LABEL(machdep_sys_pipe):
+    mov  %o0, %o2
+    mov  SYS_pipe, %g1
+    ta  0
+    bcs 1b
+    nop
+    st  %o0, [ %o2 ]
+    st  %o1, [ %o2 + 4 ]
+    retl 
+    mov  %g0, %o0
+
+/* ==========================================================================
+ * machdep_sys_fork()
+ */
+    .globl _C_LABEL(machdep_sys_fork);
+
+_C_LABEL(machdep_sys_fork):;
+
+    mov SYS_fork, %g1;
+    ta 0;
+    bcs 1b;
+    nop;
+    dec %o1;
+    retl;
+    and %o0, %o1, %o0;	! return 0 in child, pid in parent
+
+#ifndef SYS___sigprocmask14
+/* ==========================================================================
+ * machdep_sys_sigprocmask()
+ */
+    .globl _C_LABEL(machdep_sys_sigprocmask);
+
+_C_LABEL(machdep_sys_sigprocmask):;
+
+    ld [%o1], %o1; 
+    mov SYS_sigprocmask, %g1;
+    ta 0;
+    bcs 1b;
+    nop;
+    retl
+    nop
+#endif
+
+#ifndef SYS___sigsuspend14
+/* ==========================================================================
+ * machdep_sys_sigsuspend()
+ */
+    .globl _C_LABEL(machdep_sys_sigsuspend);
+
+_C_LABEL(machdep_sys_sigsuspend):;
+
+    ld [%o0], %o0; 
+    mov SYS_sigsuspend, %g1;
+    ta 0;
+    bcs 1b;
+    nop;
+    retl
+    nop
+#endif
+
+/* ==========================================================================
+ * machdep_sys_fstat()
+ */
+    .globl _C_LABEL(machdep_sys_fstat);
+
+_C_LABEL(machdep_sys_fstat):;
+
+    mov SYS___fstat13, %g1;
+    ta 0;
+    bcs 1b;
+    nop;
+    retl
+    nop
+
+/* ==========================================================================
+ * machdep_sys___syscall()
+ */
+_machdep_sys___syscall:;
+
+    mov SYS___syscall, %g1;
+    ta 0;
+    bcs 1b;
+    nop;
+    retl
+    nop
+
+/* ==========================================================================
+ * machdep_sys_lseek()
+ */
+	.global _C_LABEL(machdep_sys_lseek)
+
+_C_LABEL(machdep_sys_lseek):
+	save %sp,-112,%sp
+	mov %i1,%o4
+	mov %i2,%o5
+	st %i3,[%sp+92]
+	mov 0,%o0
+	mov SYS_lseek,%o1
+	mov %i0,%o2
+	call _machdep_sys___syscall,0
+	mov 0,%o3
+	mov %o0,%i0
+	mov %o1,%i1
+	ret
+	restore
+
+/* ==========================================================================
+ * machdep_sys_ftruncate()
+ */
+	.global _C_LABEL(machdep_sys_ftruncate)
+
+_C_LABEL(machdep_sys_ftruncate):
+	save %sp,-104,%sp
+	mov %i1,%o4
+	mov %i2,%o5
+	mov 0,%o0
+	mov SYS_ftruncate,%o1
+	mov %i0,%o2
+	call _machdep_sys___syscall,0
+	mov 0,%o3
+	mov %o0,%o1
+	sra %o0,31,%o0
+	ret
+	restore %g0,%o1,%o0

--------------------------------------------------------------------------

--- machdep/syscall-template-sparc-netbsd-1.3.S.orig	Wed Nov  1 13:06:24 2000
+++ machdep/syscall-template-sparc-netbsd-1.3.S	Thu Sep  9 05:52:31 1999
@@ -0,0 +1,48 @@
+/* ==== syscall.S ============================================================
+ * Copyright (c) 1994 Chris Provenzano, proven@mit.edu
+ * All rights reserved.
+ *
+ */
+
+#include <machine/asm.h>
+#include <sys/syscall.h>
+
+#ifdef SYS___sigsuspend14
+#define SYS_sigsuspend SYS___sigsuspend14
+#endif
+#ifdef SYS___sigprocmask14
+#define SYS_sigprocmask SYS___sigprocmask14
+#endif
+
+#define	SYSCALL(x)						\
+	.globl _C_LABEL(machdep_sys_##x);			\
+								\
+_C_LABEL(machdep_sys_##x):;					\
+								\
+	mov SYS_##x, %g1;   					\
+	ta 0;							\
+	bcs,a 2b;						\
+	sub %r0,%o0,%o0;					\
+	retl;							\
+	nop
+
+/*
+ * Initial asm stuff for all functions.
+ */
+	.text
+	.align	4
+
+/* ==========================================================================
+ * error code for all syscalls. The error value is returned as the negative
+ * of the errno value.
+ */
+
+1:
+	sub		%r0, %o0, %o0
+2:
+	retl
+	nop
+
+#define XSYSCALL(NAME) SYSCALL(NAME)
+
+XSYSCALL(SYSCALL_NAME)
>Release-Note:
>Audit-Trail:
>Unformatted: