summaryrefslogtreecommitdiff
path: root/tools/diffs/gccn.diff
blob: 67de60d11c7046b8b91861df8f54a9e42bd58de4 (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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
diff --git gcc-host-clean/fixincludes/mkfixinc.sh gcc-host-workdir/fixincludes/mkfixinc.sh
index 7112f4d..7aadf83 100755
--- gcc-host-clean/fixincludes/mkfixinc.sh
+++ gcc-host-workdir/fixincludes/mkfixinc.sh
@@ -12,6 +12,7 @@ target=fixinc.sh
 # Check for special fix rules for particular targets
 case $machine in
     i?86-*-cygwin* | \
+    *-mlibc* | \
     *-mingw32* | \
     powerpc-*-eabisim* | \
     powerpc-*-eabi*    | \
diff --git gcc-host-workdir/gcc/config/i386/orange.h gcc-host-workdir/gcc/config/i386/orange.h
new file mode 100644
index 0000000..e3017a9
--- /dev/null
+++ gcc-host-workdir/gcc/config/i386/orange.h
@@ -0,0 +1,30 @@
+#undef TARGET_ORANGE
+#define TARGET_ORANGE 1
+
+#undef LIB_SPEC
+#define LIB_SPEC "-lc"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%{!shared: %{static-pie|pie|!no-pie:Scrt1.o%s;:crt1.o%s}} crti.o%s %{shared|static-pie|pie|!no-pie:crtbeginS.o%s;:crtbegin.o%s}"
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "%{shared|static-pie|pie|!no-pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
+#define GNU_USER_LINK_EMULATION32 "elf_i386"
+#define GNU_USER_LINK_EMULATION64 "elf_x86_64"
+#define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
+
+#define GNU_USER_DYNAMIC_LINKER32 "/does_not_exist"
+#define GNU_USER_DYNAMIC_LINKER64 "/usr/lib/ld.so"
+#define GNU_USER_DYNAMIC_LINKERX32 "/does_not_exist"
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()         \
+  do {                                   \
+    builtin_define ("__orange__");    \
+    builtin_define ("__mlibc__");         \
+    builtin_define ("__unix__");         \
+    builtin_assert ("system=orange"); \
+    builtin_assert ("system=unix");      \
+    builtin_assert ("system=posix");     \
+  } while (0);
diff --git gcc-host-workdir/gcc/config/riscv/orange.h gcc-host-workdir/gcc/config/riscv/orange.h
new file mode 100644
index 0000000..5fd4f00
--- /dev/null
+++ gcc-host-workdir/gcc/config/riscv/orange.h
@@ -0,0 +1,46 @@
+#undef TARGET_ORANGE
+#define TARGET_ORANGE 1
+
+#undef LIB_SPEC
+#define LIB_SPEC "-lc"
+
+#define LD_EMUL_SUFFIX \
+  "%{mabi=lp64d:}" \
+  "%{mabi=lp64f:_lp64f}" \
+  "%{mabi=lp64:_lp64}" \
+  "%{mabi=ilp32d:}" \
+  "%{mabi=ilp32f:_ilp32f}" \
+  "%{mabi=ilp32:_ilp32}"
+
+#define GNU_USER_LINK_EMULATION "elf64lriscv"
+#define GNU_USER_DYNAMIC_LINKER "/usr/lib/ld.so"
+
+#define LINK_SPEC "\
+-melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv" LD_EMUL_SUFFIX " \
+%{mno-relax:--no-relax} \
+%{mbig-endian:-EB} \
+%{mlittle-endian:-EL} \
+%{shared} \
+  %{!shared: \
+    %{!static: \
+      %{!static-pie: \
+	%{rdynamic:-export-dynamic} \
+	-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
+    %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%{!shared: %{static-pie|pie|!no-pie:Scrt1.o%s;:crt1.o%s}} crti.o%s %{shared|static-pie|pie|!no-pie:crtbeginS.o%s;:crtbegin.o%s}"
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "%{shared|static-pie|pie|!no-pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()         \
+  do {                                   \
+    builtin_define ("__orange__");    \
+    builtin_define ("__mlibc__");         \
+    builtin_define ("__unix__");         \
+    builtin_assert ("system=orange"); \
+    builtin_assert ("system=unix");      \
+    builtin_assert ("system=posix");     \
+  } while (0);
diff --git gcc-host-clean/gcc/config.build gcc-host-workdir/gcc/config.build
index 7c80a0b..8fac7e4 100644
--- gcc-host-clean/gcc/config.build
+++ gcc-host-workdir/gcc/config.build
@@ -45,7 +45,7 @@
 build_xm_file=
 build_xm_defines=
 build_exeext=
-build_install_headers_dir=install-headers-tar
+build_install_headers_dir=install-headers-cp
 build_file_translate=
 
 # System-specific settings.
diff --git gcc-host-clean/gcc/config.gcc gcc-host-workdir/gcc/config.gcc
index 087aaa7..0bee278 100644
--- gcc-host-clean/gcc/config.gcc
+++ gcc-host-workdir/gcc/config.gcc
@@ -879,6 +879,15 @@ case ${target} in
   rust_target_objs="${rust_target_objs} freebsd-rust.o"
   target_has_targetrustm=yes
   ;;
+*-*-*-mlibc)
+  extra_options="$extra_options gnu-user.opt"
+  gas=yes
+  gnu_ld=yes
+  default_use_cxa_atexit=yes
+  use_gcc_stdint=wrap
+  tmake_file="${tmake_file} t-slibgcc"
+  thread_file='posix'
+  ;;
 *-*-fuchsia*)
   native_system_header_dir=/include
   tmake_file="t-fuchsia"
@@ -2320,6 +2329,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
 			;;
 	esac
 	;;
+x86_64-*-orange*)
+	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h gnu-user.h glibc-stdint.h i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h i386/orange.h"
+	;;
 x86_64-*-fuchsia*)
 	tmake_file="${tmake_file} i386/t-x86_64-elf"
 	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h fuchsia.h"
@@ -2519,6 +2531,13 @@ microblaze*-*-elf)
 	cxx_target_objs="${cxx_target_objs} microblaze-c.o"
 	tmake_file="${tmake_file} microblaze/t-microblaze"
         ;;
+riscv*-*-orange*)
+	tm_file="${tm_file} elfos.h gnu-user.h glibc-stdint.h riscv/orange.h"
+	tmake_file="${tmake_file} riscv/t-riscv"
+	gnu_ld=yes
+	gas=yes
+	gcc_cv_initfini_array=yes
+	;;
 riscv*-*-linux*)
 	tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} riscv/linux.h"
 	case "x${enable_multilib}" in
diff --git gcc-host-clean/gcc/cp/module.cc gcc-host-workdir/gcc/cp/module.cc
index 1deadcc..9b72332 100644
--- gcc-host-clean/gcc/cp/module.cc
+++ gcc-host-workdir/gcc/cp/module.cc
@@ -1697,8 +1697,10 @@ elf_in::defrost (const char *name)
 	      set_error (errno);
 	  else
 	    {
+#ifndef __orange__
 	      if (madvise (mapping, hdr.pos, MADV_RANDOM))
 		goto fail;
+#endif
 
 	      /* These buffers are never NULL in this case.  */
 	      strtab.buffer = mapping + strtab.pos;
@@ -1808,8 +1810,10 @@ elf_in::begin (location_t loc)
     }
   /* We'll be hopping over this randomly.  Some systems declare the
      first parm as char *, and other declare it as void *.  */
+#ifndef __orange__
   if (madvise (reinterpret_cast <char *> (mapping), size, MADV_RANDOM))
     goto fail;
+#endif
 
   hdr.buffer = (char *)mapping;
 #else
diff --git gcc-host-clean/libatomic/configure.tgt gcc-host-workdir/libatomic/configure.tgt
index 6db039d..e4fc391 100644
--- gcc-host-clean/libatomic/configure.tgt
+++ gcc-host-workdir/libatomic/configure.tgt
@@ -151,7 +151,7 @@ case "${target}" in
   *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \
   | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly* \
   | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
-  | *-*-darwin* | *-*-aix* | *-*-cygwin*)
+  | *-*-darwin* | *-*-aix* | *-*-cygwin* | *-*-mlibc*)
 	# POSIX system.  The OS is supported.
 	config_path="${config_path} posix"
 	;;
diff --git gcc-host-clean/libcpp/Makefile.in gcc-host-workdir/libcpp/Makefile.in
index bb07e46..821fe80 100644
--- gcc-host-clean/libcpp/Makefile.in
+++ gcc-host-workdir/libcpp/Makefile.in
@@ -32,10 +32,10 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 CATALOGS = $(patsubst %,po/%,@CATALOGS@)
 CC = @CC@
-CFLAGS = @CFLAGS@
+override CFLAGS := @CFLAGS@
 WARN_CFLAGS = @warn@ @c_warn@ @WARN_PEDANTIC@ @WERROR@
 CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@
+override CXXFLAGS := @CXXFLAGS@
 WARN_CXXFLAGS = @warn@ @WARN_PEDANTIC@ @WERROR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -45,7 +45,7 @@ INCINTL = @INCINTL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
-LDFLAGS = @LDFLAGS@
+override LDFLAGS := @LDFLAGS@
 LIBICONV = @LIBICONV@
 LIBINTL = @LIBINTL@
 PACKAGE = @PACKAGE@
diff --git gcc-host-clean/libgcc/config.host gcc-host-workdir/libgcc/config.host
index 6a88ee5..86bd7f3 100644
--- gcc-host-clean/libgcc/config.host
+++ gcc-host-workdir/libgcc/config.host
@@ -310,6 +310,11 @@ case ${host} in
   tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-fuchsia"
   extra_parts="crtbegin.o crtend.o"
   ;;
+*-*-*-mlibc)
+  extra_parts="$extra_parts crtbegin.o crtbeginS.o crtend.o crtendS.o"
+  tmake_file="$tmake_file t-crtstuff-pic"
+  tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-libgcc-pic"
+  ;;
 *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi)
   tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
   extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
@@ -767,6 +772,10 @@ x86_64-*-elf* | x86_64-*-rtems*)
 x86_64-*-fuchsia*)
 	tmake_file="$tmake_file t-libgcc-pic"
 	;;
+x86_64-*-*-mlibc)
+	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+	tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules"
+	;;
 i[34567]86-*-dragonfly*)
 	tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
 	md_unwind_header=i386/dragonfly-unwind.h
@@ -1349,6 +1358,10 @@ pru-*-*)
 	tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl t-softfp t-gnu-prefix pru/t-pru"
 	tm_file="$tm_file pru/pru-abi.h"
 	;;
+riscv*-*-mlibc*)
+    tmake_file="${tmake_file} riscv/t-crtstuff riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc"
+    extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
+	;;
 riscv*-*-linux*)
 	tmake_file="${tmake_file} riscv/t-crtstuff riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc"
 	extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
diff --git gcc-host-clean/libstdc++-v3/configure gcc-host-workdir/libstdc++-v3/configure
index 819a1d8..52df448 100755
--- gcc-host-clean/libstdc++-v3/configure
+++ gcc-host-workdir/libstdc++-v3/configure
@@ -38856,7 +38856,7 @@ $as_echo "#define HAVE_TLS 1" >>confdefs.h
 
   fi
     ;;
-  *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-cygwin* | *-solaris*)
+  *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-cygwin* | *-solaris* | *-mlibc*)
 
   # All these tests are for C++; save the language and the compiler flags.
   # The CXXFLAGS thing is suspicious, but based on similar bits previously
diff --git gcc-host-clean/libstdc++-v3/include/bits/ios_base.h gcc-host-workdir/libstdc++-v3/include/bits/ios_base.h
index b94b2cd..1a5eaa5 100644
--- gcc-host-clean/libstdc++-v3/include/bits/ios_base.h
+++ gcc-host-workdir/libstdc++-v3/include/bits/ios_base.h
@@ -225,7 +225,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   enum _Ios_Seekdir
     {
-      _S_beg = 0,
+      _S_beg = 1,
       _S_cur = _GLIBCXX_STDIO_SEEK_CUR,
       _S_end = _GLIBCXX_STDIO_SEEK_END,
       _S_ios_seekdir_end = 1L << 16