summaryrefslogtreecommitdiff
blob: 64a5b631f4263c04a6037942d6259c81b52066de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
FreeBSD only works on Sparc64 and freeBSD code relies on the __sparc64__ define.
gcc only defines __sparc64__ if -mcpu is not used.
gcc-4 defaults to using -mcpu=ultrasparc on FreeBSD.

This causes us a problem. Infact, FreeBSD developers sent gcc a patch to always
define __sparc64__ when using -mcpu=ultrasparc, but this was rejected by most
people including NetBSD developers.

The correct solution is to use __sparc__.
If platform detection is required, or the code is obviously 64 bit then we can
use the __arch64__ define as well.
This combination should be supported by all gcc versions:)

diff -ur gnu.orig/usr.bin/binutils/gdb/freebsd-uthread.c gnu/usr.bin/binutils/gdb/freebsd-uthread.c
--- gnu.orig/usr.bin/binutils/gdb/freebsd-uthread.c	2003-11-12 08:33:18 +0000
+++ gnu/usr.bin/binutils/gdb/freebsd-uthread.c	2006-10-10 20:27:16 +0100
@@ -454,7 +454,7 @@
 
 #endif
 
-#ifdef __sparc64__
+#ifdef __sparc__
 
 static char jmpmap[125] = {
   -1
diff -ur gnu.orig/usr.bin/binutils/libbfd/bfd.h gnu/usr.bin/binutils/libbfd/bfd.h
--- gnu.orig/usr.bin/binutils/libbfd/bfd.h	2004-07-08 18:05:32 +0100
+++ gnu/usr.bin/binutils/libbfd/bfd.h	2006-10-10 20:29:03 +0100
@@ -63,7 +63,7 @@
 #define BFD_HOST_64BIT_LONG 0
 #define BFD_HOST_64_BIT long long
 #define BFD_HOST_U_64_BIT unsigned long long
-#elif defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__ia64__)
+#elif defined(__alpha__) || (defined(__sparc__) && defined(__arch64__)) || defined(__amd64__) || defined(__ia64__)
 /* The word size of the default bfd target.  */
 #define BFD_DEFAULT_TARGET_SIZE 64
 #define BFD_HOST_64BIT_LONG 1
diff -ur gnu.orig/usr.bin/binutils/libiberty/config.h gnu/usr.bin/binutils/libiberty/config.h
--- gnu.orig/usr.bin/binutils/libiberty/config.h	2004-06-16 08:09:41 +0100
+++ gnu/usr.bin/binutils/libiberty/config.h	2006-10-10 20:30:34 +0100
@@ -7,7 +7,7 @@
 
 
 /* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
-#ifdef __sparc64__
+#ifdef __sparc__
 #define BYTEORDER 4321
 #else
 #define BYTEORDER 1234
@@ -325,7 +325,7 @@
 
 /* Define if the host machine stores words of multi-word integers in
    big-endian order. */
-#ifdef __sparc64__
+#ifdef __sparc__
 #define HOST_WORDS_BIG_ENDIAN 1
 #endif
 
@@ -366,7 +366,7 @@
 #define TIME_WITH_SYS_TIME 1
 
 /* whether byteorder is bigendian */
-#ifdef __sparc64__
+#ifdef __sparc__
 #define WORDS_BIGENDIAN 1
 #endif
 
diff -ur gnu.orig/usr.bin/cc/cc_tools/auto-host.h gnu/usr.bin/cc/cc_tools/auto-host.h
--- gnu.orig/usr.bin/cc/cc_tools/auto-host.h	2004-07-28 06:27:20 +0100
+++ gnu/usr.bin/cc/cc_tools/auto-host.h	2006-10-10 20:31:36 +0100
@@ -526,7 +526,7 @@
 #if defined(__i386__) || defined(__powerpc__) || defined(__strongarm__)
 /* The number of bytes in type long */
 # define SIZEOF_LONG SIZEOF_INT
-#elif defined(__alpha__) || defined(__sparc64__) || defined(__ia64__) || defined(__amd64__)
+#elif defined(__alpha__) || (defined(__sparc__) && defined(__arch64__)) || defined(__ia64__) || defined(__amd64__)
 # define SIZEOF_LONG SIZEOF_LONG_LONG
 #else
 # error "I don't know what arch this is."