aboutsummaryrefslogtreecommitdiff
path: root/builddeps/gcc.patch
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-03 20:17:22 -0500
committerIan Moffett <ian@osmora.org>2024-03-03 20:17:22 -0500
commite7dd2f1e547f895a5e3e0c9507b846984971d544 (patch)
treec7be99cc5ea0a69da5407384c272377929630262 /builddeps/gcc.patch
parentf1a10f336b93f657bb4065d2ba3b18fe3dcd3f94 (diff)
build: Use Hyra specific toolchain
Created patches for binutils and GCC tailored to Hyra Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'builddeps/gcc.patch')
-rw-r--r--builddeps/gcc.patch157
1 files changed, 157 insertions, 0 deletions
diff --git a/builddeps/gcc.patch b/builddeps/gcc.patch
new file mode 100644
index 0000000..d01c442
--- /dev/null
+++ b/builddeps/gcc.patch
@@ -0,0 +1,157 @@
+diff -ruN gcc-13.2.0-copy/config.sub gcc-13.2.0/config.sub
+--- gcc-13.2.0-copy/config.sub 2024-03-03 11:35:31.049089458 -0500
++++ gcc-13.2.0/config.sub 2024-03-03 11:43:08.078903300 -0500
+@@ -1749,7 +1749,7 @@
+ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
+- | fiwix* )
++ | fiwix* | hyra* )
+ ;;
+ # This one is extra strict with allowed versions
+ sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
+diff -ruN gcc-13.2.0-copy/fixincludes/mkfixinc.sh gcc-13.2.0/fixincludes/mkfixinc.sh
+--- gcc-13.2.0-copy/fixincludes/mkfixinc.sh 2024-03-03 11:35:30.112403110 -0500
++++ gcc-13.2.0/fixincludes/mkfixinc.sh 2024-03-03 11:43:52.212764492 -0500
+@@ -20,6 +20,8 @@
+ powerpcle-*-eabisim* | \
+ powerpcle-*-eabi* | \
+ *-*-vxworks7* | \
++ *-hyra* | \
++ *-*-hyra* | \
+ *-musl* )
+ # IF there is no include fixing,
+ # THEN create a no-op fixer and exit
+diff -ruN gcc-13.2.0-copy/gcc/config/hyra.h gcc-13.2.0/gcc/config/hyra.h
+--- gcc-13.2.0-copy/gcc/config/hyra.h 1969-12-31 19:00:00.000000000 -0500
++++ gcc-13.2.0/gcc/config/hyra.h 2024-03-03 11:45:20.143810858 -0500
+@@ -0,0 +1,29 @@
++#undef TARGET_HYRA
++#define TARGET_HYRA 1
++
++#undef LIB_SPEC
++#define LIB_SPEC "-lc"
++
++#undef STARTFILE_SPEC
++#define STARTFILE_SPEC "%{!shared:crt0.o%s} crti.o%s %{shared:crtbeginS.o%s;:crtbegin.o%s}"
++
++#undef ENDFILE_SPEC
++#define ENDFILE_SPEC "%{shared: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 "/usr/lib/ld_i386.so"
++#define GNU_USER_DYNAMIC_LINKER64 "/usr/lib/ld.so"
++#define GNU_USER_DYNAMIC_LINKERX32 "/usr/lib/ld32.so"
++
++#undef TARGET_OS_CPP_BUILTINS
++#define TARGET_OS_CPP_BUILTINS() \
++ do { \
++ builtin_define ("__hyra__"); \
++ builtin_define ("__unix__"); \
++ builtin_assert ("system=hyra"); \
++ builtin_assert ("system=unix"); \
++ builtin_assert ("system=posix"); \
++ } while (0);
+diff -ruN gcc-13.2.0-copy/gcc/config.gcc gcc-13.2.0/gcc/config.gcc
+--- gcc-13.2.0-copy/gcc/config.gcc 2024-03-03 11:35:31.552433364 -0500
++++ gcc-13.2.0/gcc/config.gcc 2024-03-03 11:47:40.945471968 -0500
+@@ -843,6 +843,15 @@
+ *-*-fuchsia*)
+ native_system_header_dir=/include
+ ;;
++*-*-hyra*)
++ 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'
++ ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi)
+ extra_options="$extra_options gnu-user.opt"
+ gas=yes
+@@ -2218,6 +2227,9 @@
+ 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"
+ ;;
++x86_64-*-hyra*)
++ 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 hyra.h"
++ ;;
+ ia64*-*-elf*)
+ tm_file="${tm_file} elfos.h newlib-stdint.h ia64/sysv4.h ia64/elf.h"
+ tmake_file="ia64/t-ia64"
+diff -ruN gcc-13.2.0-copy/libgcc/config.host gcc-13.2.0/libgcc/config.host
+--- gcc-13.2.0-copy/libgcc/config.host 2024-03-03 11:35:30.195738195 -0500
++++ gcc-13.2.0/libgcc/config.host 2024-03-03 11:49:47.703619260 -0500
+@@ -281,6 +281,11 @@
+ 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"
+ ;;
++*-*-hyra*)
++ 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"
+@@ -715,6 +720,10 @@
+ x86_64-*-fuchsia*)
+ tmake_file="$tmake_file t-libgcc-pic"
+ ;;
++x86_64-*-hyra*)
++ 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
+diff -ruN gcc-13.2.0-copy/libgcc/configure.ac gcc-13.2.0/libgcc/configure.ac
+--- gcc-13.2.0-copy/libgcc/configure.ac 2024-03-03 11:35:30.195738195 -0500
++++ gcc-13.2.0/libgcc/configure.ac 2024-03-03 11:50:05.950497937 -0500
+@@ -46,7 +46,7 @@
+ libgcc_topdir="${srcdir}/.."
+ fi
+ AC_SUBST(libgcc_topdir)
+-AC_CONFIG_AUX_DIR($libgcc_topdir)
++AC_CONFIG_AUX_DIR([.])
+ AC_CONFIG_HEADER(auto-target.h:config.in)
+
+ AC_ARG_ENABLE(shared,
+diff -ruN gcc-13.2.0-copy/libiberty/configure.ac gcc-13.2.0/libiberty/configure.ac
+--- gcc-13.2.0-copy/libiberty/configure.ac 2024-03-03 11:35:35.829189807 -0500
++++ gcc-13.2.0/libiberty/configure.ac 2024-03-03 11:50:29.010765475 -0500
+@@ -37,7 +37,7 @@
+ libiberty_topdir="${srcdir}/.."
+ fi
+ AC_SUBST(libiberty_topdir)
+-AC_CONFIG_AUX_DIR($libiberty_topdir)
++AC_CONFIG_AUX_DIR([.])
+
+ dnl Very limited version of automake's enable-maintainer-mode
+
+diff -ruN gcc-13.2.0-copy/libstdc++-v3/crossconfig.m4 gcc-13.2.0/libstdc++-v3/crossconfig.m4
+--- gcc-13.2.0-copy/libstdc++-v3/crossconfig.m4 2024-03-03 11:35:30.979087987 -0500
++++ gcc-13.2.0/libstdc++-v3/crossconfig.m4 2024-03-03 11:51:42.994954128 -0500
+@@ -140,6 +140,17 @@
+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
+ AC_SUBST(SECTION_FLAGS)
+ ;;
++*-hyra*)
++ GLIBCXX_CHECK_COMPILER_FEATURES
++ GLIBCXX_CHECK_LINKER_FEATURES
++ GLIBCXX_CHECK_MATH_SUPPORT
++ GLIBCXX_CHECK_STDLIB_SUPPORT
++ AC_DEFINE(_GLIBCXX_USE_DEV_RANDOM)
++ AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1)
++ GCC_CHECK_TLS
++ AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
++ AC_CHECK_FUNCS(timespec_get)
++ ;;
+
+ *-hpux*)
+ SECTION_FLAGS='-ffunction-sections -fdata-sections'