banan-os/toolchain/gcc-12.2.0.patch

167 lines
6.0 KiB
Diff

diff -ruN gcc-12.2.0/config.sub gcc-12.2.0-banan_os/config.sub
--- gcc-12.2.0/config.sub 2022-08-19 11:09:52.128656687 +0300
+++ gcc-12.2.0-banan_os/config.sub 2024-08-26 16:10:21.057075425 +0300
@@ -1749,7 +1749,7 @@
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
- | fiwix* )
+ | fiwix* | banan_os* )
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
diff -ruN gcc-12.2.0/fixincludes/mkfixinc.sh gcc-12.2.0-banan_os/fixincludes/mkfixinc.sh
--- gcc-12.2.0/fixincludes/mkfixinc.sh 2022-08-19 11:09:52.160657095 +0300
+++ gcc-12.2.0-banan_os/fixincludes/mkfixinc.sh 2024-08-26 16:26:29.728558199 +0300
@@ -11,6 +11,7 @@
# Check for special fix rules for particular targets
case $machine in
+ *-banan_os* | \
i?86-*-cygwin* | \
i?86-*-mingw32* | \
x86_64-*-mingw32* | \
diff -ruN gcc-12.2.0/gcc/config/banan_os.h gcc-12.2.0-banan_os/gcc/config/banan_os.h
--- gcc-12.2.0/gcc/config/banan_os.h 1970-01-01 02:00:00.000000000 +0200
+++ gcc-12.2.0-banan_os/gcc/config/banan_os.h 2024-08-26 16:20:51.429017406 +0300
@@ -0,0 +1,35 @@
+/* Useful if you wish to make target-specific GCC changes. */
+#undef TARGET_BANAN_OS
+#define TARGET_BANAN_OS 1
+
+/* Default arguments you want when running your
+ *-banan_os-gcc toolchain */
+#undef LIB_SPEC
+#define LIB_SPEC "-lc" /* link against C standard library */
+
+/* Files that are linked before user code.
+ The %s tells GCC to look for these files in the library directory. */
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%{!shared:crt0.o%s} crti.o%s crtbegin.o%s"
+
+/* Files that are linked after user code. */
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
+
+#undef LINK_SPEC
+#define LINK_SPEC "%{shared:-shared} %{static:-static} %{!shared: %{!static: %{rdynamic:-export-dynamic}}}"
+
+/* We don't have separate math library so don't link it. */
+#undef MATH_LIBRARY
+#define MATH_LIBRARY ""
+
+/* Additional predefined macros. */
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \
+ do { \
+ builtin_define ("__banan_os__"); \
+ builtin_define ("__unix__"); \
+ builtin_assert ("system=banan_os"); \
+ builtin_assert ("system=unix"); \
+ builtin_assert ("system=posix"); \
+ } while(0);
diff -ruN gcc-12.2.0/gcc/config.gcc gcc-12.2.0-banan_os/gcc/config.gcc
--- gcc-12.2.0/gcc/config.gcc 2022-08-19 11:09:52.552662114 +0300
+++ gcc-12.2.0-banan_os/gcc/config.gcc 2024-08-26 16:12:58.904718171 +0300
@@ -673,6 +673,12 @@
# Common parts for widely ported systems.
case ${target} in
+*-*-banan_os*)
+ gas=yes
+ gnu_ld=yes
+ default_use_cxa_atexit=yes
+ use_gcc_stdint=provide
+ ;;
*-*-darwin*)
tmake_file="t-darwin "
tm_file="${tm_file} darwin.h"
@@ -1870,6 +1876,12 @@
dwarf2=no
fi
;;
+i[34567]86-*-banan_os*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h banan_os.h"
+ ;;
+x86_64-*-banan_os*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h banan_os.h"
+ ;;
i[34567]86-*-darwin1[89]* | i[34567]86-*-darwin2*)
echo "Error: 32bit target is not supported after Darwin17" 1>&2
;;
diff -ruN gcc-12.2.0/libgcc/config.host gcc-12.2.0-banan_os/libgcc/config.host
--- gcc-12.2.0/libgcc/config.host 2022-08-19 11:09:54.664689148 +0300
+++ gcc-12.2.0-banan_os/libgcc/config.host 2024-08-26 16:25:09.397768608 +0300
@@ -698,6 +698,14 @@
hppa*-*-netbsd*)
tmake_file="$tmake_file pa/t-netbsd"
;;
+i[34567]86-*-banan_os*)
+ extra_parts="$extra_parts crti.o crtbegin.o crtend.o crtn.o"
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
+ ;;
+x86_64-*-banan_os*)
+ extra_parts="$extra_parts crti.o crtbegin.o crtend.o crtn.o"
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
+ ;;
i[34567]86-*-darwin*)
tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi"
tm_file="$tm_file i386/darwin-lib.h"
diff -ruN gcc-12.2.0/libstdc++-v3/acinclude.m4 gcc-12.2.0-banan_os/libstdc++-v3/acinclude.m4
--- gcc-12.2.0/libstdc++-v3/acinclude.m4 2022-08-19 11:09:55.380698313 +0300
+++ gcc-12.2.0-banan_os/libstdc++-v3/acinclude.m4 2024-08-26 19:03:18.261183636 +0300
@@ -1380,7 +1380,7 @@
ac_has_nanosleep=yes
ac_has_sched_yield=yes
;;
- openbsd*)
+ openbsd*|banan_os*)
ac_has_clock_monotonic=yes
ac_has_clock_realtime=yes
ac_has_nanosleep=yes
diff -ruN gcc-12.2.0/libstdc++-v3/configure gcc-12.2.0-banan_os/libstdc++-v3/configure
--- gcc-12.2.0/libstdc++-v3/configure 2022-08-19 11:09:55.416698774 +0300
+++ gcc-12.2.0-banan_os/libstdc++-v3/configure 2024-08-26 19:09:19.671026813 +0300
@@ -11904,6 +11904,11 @@
lt_cv_dlopen_self=yes
;;
+ banan_os*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
mingw* | pw32* | cegcc*)
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
@@ -20575,7 +20580,7 @@
ac_has_nanosleep=yes
ac_has_sched_yield=yes
;;
- openbsd*)
+ openbsd*|banan_os*)
ac_has_clock_monotonic=yes
ac_has_clock_realtime=yes
ac_has_nanosleep=yes
@@ -29245,7 +29250,7 @@
# This is a freestanding configuration; there is nothing to do here.
;;
- avr*-*-*)
+ avr*-*-* | *banan_os* )
$as_echo "#define HAVE_ACOSF 1" >>confdefs.h
$as_echo "#define HAVE_ASINF 1" >>confdefs.h
diff -ruN gcc-12.2.0/libstdc++-v3/crossconfig.m4 gcc-12.2.0-banan_os/libstdc++-v3/crossconfig.m4
--- gcc-12.2.0/libstdc++-v3/crossconfig.m4 2022-08-19 11:09:55.420698825 +0300
+++ gcc-12.2.0-banan_os/libstdc++-v3/crossconfig.m4 2024-08-26 18:53:31.865865576 +0300
@@ -9,7 +9,7 @@
# This is a freestanding configuration; there is nothing to do here.
;;
- avr*-*-*)
+ avr*-*-* | *banan_os* )
AC_DEFINE(HAVE_ACOSF)
AC_DEFINE(HAVE_ASINF)
AC_DEFINE(HAVE_ATAN2F)