Subject: bin/2325: cc passes -K flag to as with -fPIC
To: None <gnats-bugs@NetBSD.ORG>
From: matthew green <mrg@eterna.com.au>
List: netbsd-bugs
Date: 04/14/1996 17:54:10
>Number:         2325
>Category:       bin
>Synopsis:       cc passes -K flag to as with -fpic
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 14 04:05:01 1996
>Last-Modified:
>Originator:     mr cooler
>Organization:
bozotic softwar foundation
>Release:        <NetBSD-current source date>300396
>Environment:
	
System: NetBSD splode.eterna.com.au 1.1B NetBSD 1.1B (_splode_) #294: Sat Mar 30 02:04:22 EST 1996 mrg@splode.eterna.com.au:/orb/q/build/src/sys/arch/sparc/compile/_splode_ sparc


>Description:

	cc is passing a -K flag to as(1) when called with -fPIC.  this
	causes as(1) to whine about it.

>How-To-Repeat:

	i found this while attempting to compile perl with a dynamic
	library libperl:

splode t/mrg/perl5.002> cc -v -c -O -DPIC -fPIC regcomp.c
gcc version 2.7.2
 /usr/libexec/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=7 -Dunix -Dsparc -D__NetBSD__ -D__unix__ -D__sparc__ -D__NetBSD__ -D__unix -D__sparc -Asystem(unix) -Asystem(NetBSD) -Acpu(sparc) -Amachine(sparc) -D__OPTIMIZE__ -DPIC regcomp.c /var/tmp/cc003884.i
GNU CPP version 2.7.2 (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include
End of search list.
 /usr/libexec/cc1 /var/tmp/cc003884.i -quiet -dumpbase regcomp.c -O -version -fPIC -o /var/tmp/cc003884.s
GNU C version 2.7.2 (sparc) compiled by GNU C version 2.7.2.
 as -k -K -o regcomp.o /var/tmp/cc003884.s
*unknown*: Assembler messages:
*unknown*:0: Warning: as: I don't understand 'K' flag.

	this doesn't occur with -fpic.


>Fix:

	as our as doesn't appear to have the -K flag at all, the
	following patch to gcc/arch/netbsd.h should do the right
	thing.

*** netbsd.h	1995/12/01 17:58:54	1.1.1.1
--- netbsd.h	1996/04/14 07:52:11
***************
*** 45,51 ****
     with the options for generating PIC code.  */
  
  #undef ASM_SPEC
! #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
  
  /* Provide a LIB_SPEC appropriate for NetBSD.  Just select the appropriate
     libc, depending on whether we're doing profiling.  */
--- 45,51 ----
     with the options for generating PIC code.  */
  
  #undef ASM_SPEC
! #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
  
  /* Provide a LIB_SPEC appropriate for NetBSD.  Just select the appropriate
     libc, depending on whether we're doing profiling.  */


>Audit-Trail:
>Unformatted: