Subject: Re: recent commits to gcc
To: Tom Yu <tlyu@mit.edu>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 11/30/1996 15:44:17
Tom Yu writes:

>Just tried that.  Bouyer's patches to share/mk applied with some minor
>tweaking.  I now get the following errors when I try to rebuild the
>libraries:
>
>cc  -DPIC -DSTRRCHR -O -DNLS -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT -I/usr/src/lib/libc/include -D__DBINTERFACE_PRIVATE -DPOSIX_MISTAKE -DFLOATING_POINT -Werror  -c /usr/src/lib/libc/string/rindex.c  -o strrchr.so
>creating accept.so
>as: unrecognized option `-k'
>cpp: output pipe has been closed

Yet another gotcha...

The -k is for  the `standard' NetBSD toolchain; binutils 2.x doesn't
recognise it.  I needed to patch /usr/src/lib/libc/sys/Makefile.inc.
Here's a patch with the relevant changes. Note there'll be some fuzz,
due to changes to /usr/src/lib/libc/sys/Makefile.inc  in the meantime.

--Jonathan



*** sys/Makefile.inc.dsg	Sun Oct 20 00:27:51 1996
--- sys/Makefile.inc	Tue Nov 19 04:12:42 1996
***************
*** 1,11 ****
! #	$NetBSD: Makefile.inc,v 1.44 1996/10/19 18:42:12 perry Exp $
  #	@(#)Makefile.inc	8.1 (Berkeley) 6/17/93
  
  # sys sources
  .PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/sys ${.CURDIR}/sys
  
  # modules with non-default implementations on at least one architecture:
! SRCS+=	Ovfork.S brk.S cerror.S exect.S fork.S pipe.S ptrace.S reboot.S \
  	sbrk.S setlogin.S sigpending.S sigprocmask.S sigreturn.S \
  	sigsuspend.S syscall.S
  
--- 1,11 ----
! #	$NetBSD: Makefile.inc,v 1.46 1996/11/19 02:48:26 jtc Exp $
  #	@(#)Makefile.inc	8.1 (Berkeley) 6/17/93
  
  # sys sources
  .PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/sys ${.CURDIR}/sys
  
  # modules with non-default implementations on at least one architecture:
! SRCS+=	Ovfork.S brk.S cerror.S exect.S fork.S pipe.S ptrace.S \
  	sbrk.S setlogin.S sigpending.S sigprocmask.S sigreturn.S \
  	sigsuspend.S syscall.S
  
***************
*** 16,21 ****
--- 16,22 ----
  # modules with default implementations on all architectures:
  ASM=	accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \
  	chown.o chroot.o \
+ 	clock_getres.o clock_gettime.o clock_settime.o \
  	close.o connect.o dup.o dup2.o execve.o fchdir.o \
  	fchflags.o fchmod.o fchown.o fcntl.o flock.o fpathconf.o fstat.o \
  	fstatfs.o fsync.o futimes.o \
***************
*** 26,34 ****
  	ktrace.o lfs_bmapv.o lfs_markv.o lfs_segclean.o lfs_segwait.o link.o \
  	listen.o lstat.o madvise.o mincore.o mkdir.o mkfifo.o mknod.o mlock.o \
  	mount.o mprotect.o msgctl.o msgget.o msgrcv.o msgsnd.o msync.o \
! 	munlock.o munmap.o nfssvc.o open.o pathconf.o poll.o \
  	profil.o quotactl.o \
! 	read.o readlink.o readv.o recvfrom.o recvmsg.o rename.o revoke.o \
  	rmdir.o select.o semconfig.o semget.o semop.o sendmsg.o sendto.o \
  	setegid.o seteuid.o setgid.o setgroups.o setitimer.o setpgid.o \
  	setpriority.o setregid.o setreuid.o \
--- 27,37 ----
  	ktrace.o lfs_bmapv.o lfs_markv.o lfs_segclean.o lfs_segwait.o link.o \
  	listen.o lstat.o madvise.o mincore.o mkdir.o mkfifo.o mknod.o mlock.o \
  	mount.o mprotect.o msgctl.o msgget.o msgrcv.o msgsnd.o msync.o \
! 	munlock.o munmap.o nfssvc.o ntp_adjtime.o ntp_gettime.o \
! 	open.o pathconf.o poll.o \
  	profil.o quotactl.o \
! 	read.o readlink.o readv.o reboot.o \
! 	recvfrom.o recvmsg.o rename.o revoke.o \
  	rmdir.o select.o semconfig.o semget.o semop.o sendmsg.o sendto.o \
  	setegid.o seteuid.o setgid.o setgroups.o setitimer.o setpgid.o \
  	setpriority.o setregid.o setreuid.o \
***************
*** 52,73 ****
  
  OBJS+=	${ASM} ${NOERR} ${PSEUDO}
  
- #
- # this really belongs in  /usr/share/mk/bsd.share.mk
- #
- .if (${MACHINE_ARCH} == "alpha")
- CPPPIC= -DPIC
- ASPIC=
- .else
- .if (${MACHINE_ARCH} == "mips")
- CPPPIC= -DPIC -DABICALLS
- ASPIC= -KPIC
- .else
- CPPPIC= -DPIC
- ASPIC= -k
- .endif
- .endif
- 
  ${PASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
  	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
--- 55,60 ----
***************
*** 75,84 ****
  	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
  	@rm -f ${.TARGET}.o
  
  ${SASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
  	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
! 	${CPP} ${CPPPIC} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} ${ASPIC} -o ${.TARGET}
  
  ${ASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
--- 62,78 ----
  	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
  	@rm -f ${.TARGET}.o
  
+ .if (${MACHINE_ARCH} != "alpha")
  ${SASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
  	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
! 	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -k -o ${.TARGET}
! .else
! ${SASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
! 	@echo creating ${.TARGET}
! 	@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
! 	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}
! .endif
  
  ${ASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
***************
*** 94,103 ****
  	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
  	@rm -f ${.TARGET}.o
  
  ${SNOERR}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
  	@printf '#include "SYS.h"\nRSYSCALL_NOERROR(${.PREFIX})\n' | \
! 	${CPP} ${CPPPIC} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} ${ASPIC} -o ${.TARGET}
  
  ${NOERR}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
--- 88,104 ----
  	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
  	@rm -f ${.TARGET}.o
  
+ .if (${MACHINE_ARCH} != "alpha")
  ${SNOERR}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
  	@printf '#include "SYS.h"\nRSYSCALL_NOERROR(${.PREFIX})\n' | \
! 	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -k -o ${.TARGET}
! .else
! ${SNOERR}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
! 	@echo creating ${.TARGET}
! 	@printf '#include "SYS.h"\nRSYSCALL_NOERROR(${.PREFIX})\n' | \
! 	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}
! .endif
  
  ${NOERR}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
***************
*** 113,122 ****
  	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
  	@rm -f ${.TARGET}.o
  
  ${SPSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
  	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
! 	${CPP} ${CPPPIC} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} ${ASPIC} -o ${.TARGET}
  ${PSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
  	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
--- 114,131 ----
  	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
  	@rm -f ${.TARGET}.o
  
+ .if (${MACHINE_ARCH} != "alpha")
+ ${SPSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
+ 	@echo creating ${.TARGET}
+ 	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
+ 	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -k -o ${.TARGET}
+ .else
  ${SPSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
  	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
! 	    ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}
! .endif
! 
  ${PSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h
  	@echo creating ${.TARGET}
  	@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \