summaryrefslogtreecommitdiff
path: root/tools/4.10/gcc/nios2/nios2-gcc-4.1-rtems-20110818.diff
blob: 39e605ca119ab64c446889f9680b8189427e6a97 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
diff -ruN gcc-4.1.orig/config-ml.in gcc-4.1/config-ml.in
--- gcc-4.1.orig/config-ml.in	2011-04-26 11:29:52.000000000 +1000
+++ gcc-4.1/config-ml.in	2011-08-06 10:24:23.000000000 +1000
@@ -892,13 +892,48 @@
 	fi
     fi
 
-    if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
-	--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
-	${ac_configure_args} ${ml_srcdiroption} ; then
-      true
-    else
-      exit 1
-    fi
+    case $(uname) in
+	MINGW32*)
+	    #
+ 	    # Work around bugs in MSYS sed or bash. The CC in
+	    # ${ac_configure_args} overrides the CC built above
+	    # I do not know if the CC should have been stripped
+	    # before this script. It seems sed in MSYS does not
+	    # handle:
+	    #    $ echo "'XX=hello' 'YY=world' 'CC=gcc -O3'" | sed -e "s/\'CC=.*\'//g"
+	    #
+	    tmp_IFS=$IFS
+	    IFS="'"
+	    tmp__ac_configure_args=
+	    for o in ${ac_configure_args}
+	    do
+		o=$(echo $o | sed -e 's/ *$//g')
+		case $o in
+		    CC=*) ;;
+		    '') ;;
+		    *) tmp__ac_configure_args="${tmp__ac_configure_args} "\'$o\' ;;
+		esac
+	    done
+	    IFS=$tmp_IFS
+
+	    if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
+		--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
+		${tmp__ac_configure_args} ${ml_srcdiroption} ; then
+		true
+	    else
+		exit 1
+	    fi
+	    ;;
+	*)
+	    if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
+		--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
+		${ac_configure_args} ${ml_srcdiroption} ; then
+		true
+	    else
+		exit 1
+	    fi
+	    ;;
+    esac
 
     cd ${ML_POPDIR}
 
diff -ruN gcc-4.1.orig/gcc/DEV-PHASE gcc-4.1/gcc/DEV-PHASE
--- gcc-4.1.orig/gcc/DEV-PHASE	2011-04-26 11:29:52.000000000 +1000
+++ gcc-4.1/gcc/DEV-PHASE	2011-08-06 10:24:25.000000000 +1000
@@ -0,0 +1 @@
+RTEMS (chrisj@rtems.org) NIOS2 gcc-4.1-11.0/newlib-1.19.0
diff -ruN gcc-4.1.orig/gcc/config/nios2/crti.asm gcc-4.1/gcc/config/nios2/crti.asm
--- gcc-4.1.orig/gcc/config/nios2/crti.asm	2011-04-26 11:29:54.000000000 +1000
+++ gcc-4.1/gcc/config/nios2/crti.asm	2011-08-18 11:14:30.000000000 +1000
@@ -67,6 +67,11 @@
 	stw	r16, 12(sp)
 	stw	fp, 8(sp)
 	addi	fp, sp, 8
+
+#if !defined(__rtems__)
+/* FIXME: Disabled for now.
+ * Causes undefined refs to _GLOBAL_OFFSET_TABLE_
+ */
 	nextpc	r22
 #ifdef __nios2_6b__
 1:	movhi20	r2, %hi20adj(_GLOBAL_OFFSET_TABLE_ - 1b)
@@ -76,7 +81,7 @@
 	addi	r2, r2, %lo(_GLOBAL_OFFSET_TABLE_ - 1b)
 #endif
 	add	r22, r22, r2
-	
+#endif
 	
 	.section	".fini"
 	.align	2
@@ -94,6 +99,11 @@
 	stw	r16, 12(sp)
 	stw	fp, 8(sp)
 	addi	fp, sp, 8
+
+#if !defined(__rtems__)
+/* FIXME: Disabled for now.
+ * Causes undefined refs to _GLOBAL_OFFSET_TABLE_ 
+ */
 	nextpc	r22
 #ifdef __nios2_6b__
 1:	movhi20	r2, %hi20adj(_GLOBAL_OFFSET_TABLE_ - 1b)
@@ -102,7 +112,5 @@
 1:	movhi	r2, %hiadj(_GLOBAL_OFFSET_TABLE_ - 1b)
 	addi	r2, r2, %lo(_GLOBAL_OFFSET_TABLE_ - 1b)
 #endif
-        
 	add	r22, r22, r2
-	
-
+#endif
diff -ruN gcc-4.1.orig/gcc/config/nios2/nios2-protos.h gcc-4.1/gcc/config/nios2/nios2-protos.h
--- gcc-4.1.orig/gcc/config/nios2/nios2-protos.h	2011-04-26 11:29:54.000000000 +1000
+++ gcc-4.1/gcc/config/nios2/nios2-protos.h	2011-08-06 10:24:23.000000000 +1000
@@ -88,3 +88,5 @@
 extern int nios2_return_in_memory (tree);
 
 #endif /* TREE_CODE */
+
+rtx nios2_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode);
diff -ruN gcc-4.1.orig/gcc/config/nios2/rtems.h gcc-4.1/gcc/config/nios2/rtems.h
--- gcc-4.1.orig/gcc/config/nios2/rtems.h	1970-01-01 10:00:00.000000000 +1000
+++ gcc-4.1/gcc/config/nios2/rtems.h	2011-08-17 17:06:39.000000000 +1000
@@ -0,0 +1,29 @@
+/* Definitions for rtems targeting a NIOS2 using ELF.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Contributed by Chris Johns (chrisj@rtems.org).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+/* Specify predefined symbols in preprocessor.  */
+
+#define TARGET_OS_CPP_BUILTINS()	\
+do {					\
+  builtin_define ("__rtems__");		\
+  builtin_define ("__USE_INIT_FINI__"); \
+  builtin_assert ("system=rtems");	\
+} while (0)
diff -ruN gcc-4.1.orig/gcc/config/nios2/t-rtems gcc-4.1/gcc/config/nios2/t-rtems
--- gcc-4.1.orig/gcc/config/nios2/t-rtems	1970-01-01 10:00:00.000000000 +1000
+++ gcc-4.1/gcc/config/nios2/t-rtems	2011-08-18 06:03:59.000000000 +1000
@@ -0,0 +1,4 @@
+# Multilibs for NIOS2 RTEMS targets.
+
+# Use all.
+
diff -ruN gcc-4.1.orig/gcc/config.gcc gcc-4.1/gcc/config.gcc
--- gcc-4.1.orig/gcc/config.gcc	2011-04-26 11:29:54.000000000 +1000
+++ gcc-4.1/gcc/config.gcc	2011-08-06 10:24:23.000000000 +1000
@@ -1447,6 +1447,10 @@
 		thread_file='posix'
 	fi
 	;;
+nios2-*-rtems*)
+	tm_file=" elfos.h ${tm_file} dbxelf.h nios2/rtems.h rtems.h"
+	tmake_file="${tmake_file} nios2/t-nios2 t-rtems nios2/t-rtems"
+	;;
 nios2*-*-*)
 	tm_file="elfos.h ${tm_file}"
         tmake_file="${tmake_file} nios2/t-nios2"
diff -ruN gcc-4.1.orig/libiberty/strsignal.c gcc-4.1/libiberty/strsignal.c
--- gcc-4.1.orig/libiberty/strsignal.c	2011-04-26 11:30:12.000000000 +1000
+++ gcc-4.1/libiberty/strsignal.c	2011-08-06 10:24:23.000000000 +1000
@@ -404,10 +404,10 @@
 
 #ifndef HAVE_STRSIGNAL
 
-const char *
+char *
 strsignal (int signo)
 {
-  const char *msg;
+  char *msg;
   static char buf[32];
 
 #ifndef HAVE_SYS_SIGLIST
@@ -428,12 +428,12 @@
     {
       /* In range, but no sys_siglist or no entry at this index. */
       sprintf (buf, "Signal %d", signo);
-      msg = (const char *) buf;
+      msg = buf;
     }
   else
     {
       /* In range, and a valid message.  Just return the message. */
-      msg = (const char *) sys_siglist[signo];
+      msg = (char *) sys_siglist[signo];
     }
   
   return (msg);
@@ -549,7 +549,7 @@
 #ifndef HAVE_PSIGNAL
 
 void
-psignal (unsigned signo, char *message)
+psignal (int signo, const char *message)
 {
   if (signal_names == NULL)
     {