Subject: port-sparc/7557: /usr/lib/c++rt0.o breaks with -fPIC code on sparc
To: None <gnats-bugs@gnats.netbsd.org>
From: None <abs@mono.org>
List: netbsd-bugs
Date: 05/11/1999 14:22:49
>Number:         7557
>Category:       port-sparc
>Synopsis:       /usr/lib/c++rt0.o breaks with -fPIC code on sparc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-sparc-maintainer (NetBSD/sparc Portmaster)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 11 14:20:02 1999
>Last-Modified:
>Originator:     David Brownlee <abs@mono.org>
>Organization:
<a href="http://www.mono.org/">Monochrome</a>
>Release:        NetBSD 1.4
>Environment:
	
System: NetBSD charon.anim.dreamworks.com 1.4 NetBSD 1.4 (GENERIC) #0: Sun May 9 03:00:22 MEST 1999 pk@flambard:/usr/src/sys/arch/sparc/compile/GENERIC sparc


>Description:
	On sparc -fpic and -fPIC produce different, and incompatible code.
	/usr/lib/c++rt0.o is compiled -fpic, which means it cannot work with
	-fPIC code.
	In particular this breaks compilation of KDE.

>How-To-Repeat:
	Attempt to compile KDE from pkgsrc
>Fix:
	Unpleasant workaround:
		cd /usr/src/lib/csu/c++
		cc -O2 -fPIC -DLIBC_SCCS -c c++rt0.c
		mv /usr/lib/c++rt0.o /usr/lib/c++rt0.o.pic
		mv c++rt0.o /usr/lib/c++rt0.o
		[ compile KDE ]
		[ move original c++rt0.o back ]

	Fix would probably be either to
		a) compile all pic code -fPIC
	or
		b) compile c++rt0.o both PIC and pic, and tweak toolchain to
		   use correct one depending on flags passed to cc.

>Audit-Trail:
>Unformatted: