Date: Tue, 10 Oct 2000 10:34:09 +1100 From: Benno Rice <benno@jeamland.net> To: freebsd-ppc@freebsd.org Subject: Re: Patches for compilation of libstand Message-ID: <20001010103409.B24741@hiro.netizen.com.au> In-Reply-To: <20001010103307.A24741@hiro.netizen.com.au>; from benno@jeamland.net on Tue, Oct 10, 2000 at 10:33:07AM %2B1100 References: <20001010103307.A24741@hiro.netizen.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Tue, Oct 10, 2000 at 10:33:07AM +1100, Benno Rice wrote:
[snip]
And this time, I'll actually attach the stuff. =)
--
Benno Rice "No, no. We're *sweet* and
XNFP Aries Dark Subculture- *innocent* evil bastards."
friendly Internet Geek
benno@jeamland.net "Defend your joy"
[-- Attachment #2 --]
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libstand/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- Makefile 2000/08/11 23:18:37 1.17
+++ Makefile 2000/10/09 10:59:15
@@ -12,8 +12,14 @@
NOPIC= YES
MAN3= libstand.3
+# XXX NetBSD's lint barfs over some of the files in here, and -Werror causes
+# a lot of problems.
+NOLINT= YES
+NOGCCERROR= YES
+
# Mostly OK, some of the libc imports are a bit noisy
-CFLAGS+= -Wall
+# XXX NetBSD doesn't seem to look in the current directory for headers.
+CFLAGS+= -Wall -I.
.if ${MACHINE_ARCH} == "alpha"
CFLAGS+= -mno-fp-regs
@@ -21,6 +27,9 @@
.if ${MACHINE_ARCH} == "i386"
CFLAGS+= -mpreferred-stack-boundary=2
.endif
+.if ${MACHINE_ARCH} == "powerpc"
+CFLAGS+= -msoft-float
+.endif
# standalone components and stuff we have modified locally
@@ -33,7 +42,7 @@
# string functions from libc
.PATH: ${.CURDIR}/../libc/string
-.if ${MACHINE_ARCH} == "i386"
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc"
SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
Index: cd9660.c
===================================================================
RCS file: /home/ncvs/src/lib/libstand/cd9660.c,v
retrieving revision 1.5
diff -u -r1.5 cd9660.c
--- cd9660.c 2000/04/29 20:47:07 1.5
+++ cd9660.c 2000/10/09 10:55:18
@@ -85,6 +85,9 @@
#define cdb2devb(bno) ((bno) * ISO_DEFAULT_BLOCK_SIZE / DEV_BSIZE)
+#ifndef __NetBSD__
+/* NetBSD defines these in isofs/cd9660/iso.h */
+
/* XXX these should be in the system headers */
static __inline int
isonum_722(p)
@@ -99,6 +102,8 @@
{
return (*p << 24)|(p[1] << 16)|(p[2] << 8)|p[3];
}
+
+#endif
static int
dirmatch(path, dp)
Index: stand.h
===================================================================
RCS file: /home/ncvs/src/lib/libstand/stand.h,v
retrieving revision 1.23
diff -u -r1.23 stand.h
--- stand.h 2000/09/16 13:42:56 1.23
+++ stand.h 2000/10/09 11:37:38
@@ -195,7 +195,10 @@
/* sbrk emulation */
extern void setheap(void *base, void *top);
+#if !defined(__NetBSD__) || !defined(_UNISTD_H_)
+/* XXX NetBSD's sbrk has different prototype to ours */
extern char *sbrk(int incr);
+#endif
/* Matt Dillon's zalloc/zmalloc */
extern void *malloc(size_t bytes);
@@ -231,7 +234,7 @@
extern int close(int);
extern void closeall(void);
extern ssize_t read(int, void *, size_t);
-extern ssize_t write(int, void *, size_t);
+extern ssize_t write(int, const void *, size_t);
extern struct dirent *readdirfd(int);
extern void srandom(u_long seed);
@@ -337,7 +340,12 @@
extern void putchar(int);
extern int devopen(struct open_file *, const char *, const char **);
extern int devclose(struct open_file *f);
+#ifndef __NetBSD__
extern void panic(const char *, ...) __dead2;
+#else
+/* XXX NetBSD has __dead but not __dead2. I'm assuming they're similar. */
+extern void panic(const char *, ...) __dead;
+#endif
extern struct fs_ops *file_system[];
extern struct devsw *devsw[];
@@ -362,5 +370,11 @@
#define malloc(x) malloc_debug(x, __FILE__, __LINE__)
#define free(x) free_debug(x, __FILE__, __LINE__)
+
+#endif
+
+#ifdef __NetBSD__
+
+#include <sys/inttypes.h>
#endif
Index: write.c
===================================================================
RCS file: /home/ncvs/src/lib/libstand/write.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 write.c
--- write.c 1998/08/20 08:19:55 1.1.1.1
+++ write.c 2000/10/09 11:07:22
@@ -70,7 +70,7 @@
ssize_t
write(fd, dest, bcount)
int fd;
- void *dest;
+ const void *dest;
size_t bcount;
{
register struct open_file *f = &files[fd];
Index: zalloc_defs.h
===================================================================
RCS file: /home/ncvs/src/lib/libstand/zalloc_defs.h,v
retrieving revision 1.6
diff -u -r1.6 zalloc_defs.h
--- zalloc_defs.h 1999/08/28 00:05:35 1.6
+++ zalloc_defs.h 2000/10/09 11:01:12
@@ -49,6 +49,10 @@
typedef unsigned long iaddr_t; /* unsigned int same size as pointer */
typedef long saddr_t; /* signed int same size as pointer */
#endif
+#ifdef __powerpc__
+typedef unsigned int iaddr_t; /* unsigned int same size as pointer */
+typedef int saddr_t; /* signed int same size as pointer */
+#endif
#include "zalloc_mem.h"
[-- Attachment #3 --]
/* $NetBSD: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $ */
#include <machine/asm.h>
#if defined(LIBC_SCCS)
.text
.asciz "$NetBSD: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $"
#endif
/*
* C library -- _setjmp, _longjmp
*
* _longjmp(a,v)
* will generate a "return(v?v:1)" from the last call to
* _setjmp(a)
* by restoring registers from the stack.
* The previous signal state is NOT restored.
*/
ENTRY(_setjmp)
mflr 11
mfcr 12
mr 10,1
mr 9,2
stmw 9,8(3)
li 3,0
blr
ENTRY(_longjmp)
lmw 9,8(3)
mtlr 11
mtcr 12
mr 2,9
mr 1,10
or. 3,4,4
bnelr
li 3,1
blr
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001010103409.B24741>
