Subject: bin/17317: MKPIC=="no" is not fully supported
To: None <gnats-bugs@gnats.netbsd.org>
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>
List: netbsd-bugs
Date: 06/19/2002 17:48:57
>Number:         17317
>Category:       bin
>Synopsis:       MKPIC=="no" is not fully supported
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 19 01:25:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Ian Dall
>Release:        NetBSD 1.5ZC
>Organization:
private
>Environment:
	
	
System: NetBSD gateway.beware.dropbear.id.au 1.5ZC NetBSD 1.5ZC (SIBYL) #2: Sat Jun 15 00:22:45 CST 2002 ian@sibyl.beware.dropbear.id.au:/usr1/local/src/netbsd/src/sys/arch/pc532/compile/SIBYL pc532
Architecture: ns32k
Machine: pc532
>Description:
	

With MKPIC == "no" the build process still tries to build ld.aout_so
and ld.elf_so. It also attempts to link with crt0.o (which is not
built) instead of scrt0.o. Both these fail with a linker which doesn't
support PIC.

>How-To-Repeat:
	
>Fix:
	
The following patch suppresses building of ld.aout_so
and ld.elf_so when MKPIC == "no" and arranges to link with scrt0.o.

Index: netbsd/src/libexec/Makefile
diff -c netbsd/src/libexec/Makefile:1.1.1.2 netbsd/src/libexec/Makefile:1.2
*** netbsd/src/libexec/Makefile:1.1.1.2	Sat Mar 30 07:57:32 2002
--- netbsd/src/libexec/Makefile	Tue Jun 11 23:15:33 2002
***************
*** 3,12 ****
  
  .include <bsd.own.mk>
  
! SUBDIR=	atrun comsat fingerd ftpd getNAME getty identd ld.aout_so \
! 	ld.elf_so lfs_cleanerd mail.local makekey makewhatis rexecd \
  	rlogind rmail rshd rpc.rquotad rpc.rstatd rpc.rusersd rpc.rwalld \
  	rpc.sprayd talkd telnetd tftpd uucpd
  
  .if (${MKKERBEROS} != "no")
  # Heimdal/KTH Kerberos
--- 3,16 ----
  
  .include <bsd.own.mk>
  
! SUBDIR=	atrun comsat fingerd ftpd getNAME getty identd \
! 	lfs_cleanerd mail.local makekey makewhatis rexecd \
  	rlogind rmail rshd rpc.rquotad rpc.rstatd rpc.rusersd rpc.rwalld \
  	rpc.sprayd talkd telnetd tftpd uucpd
+ 
+ .if (${MKPIC} != "no")
+ SUBDRI+= ld.aout_so ld.elf_so
+ .endif
  
  .if (${MKKERBEROS} != "no")
  # Heimdal/KTH Kerberos
Index: netbsd/src/share/mk/bsd.prog.mk
diff -c netbsd/src/share/mk/bsd.prog.mk:1.1.1.5 netbsd/src/share/mk/bsd.prog.mk:1.2
*** netbsd/src/share/mk/bsd.prog.mk:1.1.1.5	Wed Apr 10 21:42:03 2002
--- netbsd/src/share/mk/bsd.prog.mk	Fri Jun  7 16:55:40 2002
***************
*** 34,40 ****
--- 34,44 ----
  .endif
  
  .ifndef LIBCRT0
+ .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "")
+ LIBCRT0=	${DESTDIR}/usr/lib/scrt0.o
+ .else
  LIBCRT0=	${DESTDIR}/usr/lib/crt0.o
+ .endif
  .MADE: ${LIBCRT0}
  .endif
  
>Release-Note:
>Audit-Trail:
>Unformatted: