Subject: toolchain/20554: gcc should predefine __sparcv9
To: None <gnats-bugs@gnats.netbsd.org>
From: john heasley <heas@shrubbery.net>
List: netbsd-bugs
Date: 03/02/2003 22:22:32
>Number:         20554
>Category:       toolchain
>Synopsis:       gcc should predefine __sparcv9
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 02 14:23:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     john heasley
>Release:        NetBSD 1.6L
>Organization:
	
>Environment:
	
	
System: NetBSD guelah 1.6L NetBSD 1.6L (guelah) #3: Thu Jan 23 06:35:30 UTC 2003 root@guelah:/sys/arch/sparc64/compile/guelah sparc64
Architecture: sparc64
Machine: sparc64
>Description:
	some 3rd-party source, xfree among them, uses __sparcv9 to determine
	size of long long and among other things.  gcc 3.1 (on solaris 2.9)
	and sun CC (solaris 2.8) define this for 64-bit compilation.
>How-To-Repeat:
	inspection of xfree imake templates and gcc/sunCC predefines.
>Fix:
	apply this patch (i believe this is correct; "works for me").

Index: sparc.h
===================================================================
RCS file: /cvsroot/src/gnu/dist/toolchain/gcc/config/sparc/sparc.h,v
retrieving revision 1.4
diff -u -u -r1.4 sparc.h
--- sparc.h	2002/05/03 17:47:57	1.4
+++ sparc.h	2003/03/02 22:21:39
@@ -129,8 +129,8 @@
 #define ASM_CPU32_DEFAULT_SPEC ""
 
 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
-/* ??? What does Sun's CC pass?  */
-#define CPP_CPU64_DEFAULT_SPEC "-D__sparc_v9__"
+/* Sun's CC passes __sparcv9 */
+#define CPP_CPU64_DEFAULT_SPEC "-D__sparc_v9__ -D__sparcv9"
 /* ??? It's not clear how other assemblers will handle this, so by default
    use GAS.  Sun's Solaris assembler recognizes -xarch=v8plus, but this case
    is handled in sol2.h.  */
>Release-Note:
>Audit-Trail:
>Unformatted: