From 8e377d9241ed4098b58d3531c80aa2c0cb285077 Mon Sep 17 00:00:00 2001 From: Aleksa Vučković Date: Thu, 13 Jan 2022 01:17:04 +0100 Subject: bugfixes and additions --- files/aleksa-binutils-2.37.diff | 96 ++++++++++++++++++++++++++++++ files/aleksa-gcc-11.2.0.diff | 119 ++++++++++++++++++++++++++++++++++++++ files/crt0.s | 31 ++++++++++ scripts/aleksa-binutils-2.37.diff | 96 ------------------------------ scripts/aleksa-gcc-11.2.0.diff | 119 -------------------------------------- scripts/install_headers.sh | 10 ++-- scripts/setup.sh | 38 +++++++----- 7 files changed, 272 insertions(+), 237 deletions(-) create mode 100644 files/aleksa-binutils-2.37.diff create mode 100644 files/aleksa-gcc-11.2.0.diff create mode 100644 files/crt0.s delete mode 100644 scripts/aleksa-binutils-2.37.diff delete mode 100644 scripts/aleksa-gcc-11.2.0.diff diff --git a/files/aleksa-binutils-2.37.diff b/files/aleksa-binutils-2.37.diff new file mode 100644 index 0000000..79cde93 --- /dev/null +++ b/files/aleksa-binutils-2.37.diff @@ -0,0 +1,96 @@ +diff '--color=auto' -ruN ../binutils-2.37/bfd/config.bfd ./binutils-2.37/bfd/config.bfd +--- ../binutils-2.37/bfd/config.bfd 2021-07-08 13:37:19.000000000 +0200 ++++ ./binutils-2.37/bfd/config.bfd 2022-01-11 18:51:11.272879682 +0100 +@@ -223,6 +223,18 @@ + + case "${targ}" in + # START OF targmatch.h ++ i[3-7]86-*-aleksa*) ++ targ_defvec=i386_elf32_vec ++ targ_selvecs= ++ targ64_selvecs=x86_64_elf64_vec ++ ;; ++#ifdef BFD64 ++ x86_64-*-aleksa*) ++ targ_defvec=x86_64_elf64_vec ++ targ_selvecs=i386_elf32_vec ++ want64=true ++ ;; ++#endif + #ifdef BFD64 + aarch64-*-darwin*) + targ_defvec=aarch64_mach_o_vec +diff '--color=auto' -ruN ../binutils-2.37/config.sub ./binutils-2.37/config.sub +--- ../binutils-2.37/config.sub 2021-07-08 13:37:19.000000000 +0200 ++++ ./binutils-2.37/config.sub 2022-01-11 18:51:18.386212846 +0100 +@@ -1729,7 +1729,8 @@ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ +- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) ++ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* \ ++ | aleksa*) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) +diff '--color=auto' -ruN ../binutils-2.37/gas/configure.tgt binutils-2.37/gas/configure.tgt +--- ../binutils-2.37/gas/configure.tgt ./2021-07-08 13:37:19.000000000 +0200 ++++ ./binutils-2.37/gas/configure.tgt 2022-01-11 18:51:33.739545802 +0100 +@@ -123,6 +123,7 @@ + generic_target=${cpu_type}-$vendor-$os + # Note: This table is alpha-sorted, please try to keep it that way. + case ${generic_target} in ++ i386-*-aleksa*) fmt=elf ;; + aarch64*-*-elf*) fmt=elf;; + aarch64*-*-fuchsia*) fmt=elf;; + aarch64*-*-genode*) fmt=elf;; +diff '--color=auto' -ruN ../binutils-2.37/ld/configure.tgt ./binutils-2.37/ld/configure.tgt +--- ../binutils-2.37/ld/configure.tgt 2021-07-08 13:37:20.000000000 +0200 ++++ ./binutils-2.37/ld/configure.tgt 2022-01-11 18:51:48.049545452 +0100 +@@ -43,6 +43,15 @@ + # Please try to keep this table more or less in alphabetic order - it + # makes it much easier to lookup a specific archictecture. + case "${targ}" in ++i[3-7]86-*-aleksa*) ++ targ_emul=elf_i386_aleksa ++ targ_extra_emuls=elf_i386 ++ targ64_extra_emuls="elf_x86_64_aleksa elf_x86_64" ++ ;; ++x86_64-*-aleksa*) ++ targ_emul=elf_x86_64_aleksa ++ targ_extra_emuls="elf_i386_aleksa elf_x86_64 elf_i386" ++ ;; + aarch64_be-*-elf) targ_emul=aarch64elfb + targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" + ;; +diff '--color=auto' -ruN ../binutils-2.37/ld/emulparams/elf_i386_aleksa.sh ./binutils-2.37/ld/emulparams/elf_i386_aleksa.sh +--- ../binutils-2.37/ld/emulparams/elf_i386_aleksa.sh 1970-01-01 01:00:00.000000000 +0100 ++++ ./binutils-2.37/ld/emulparams/elf_i386_aleksa.sh 2022-01-11 18:50:49.516213552 +0100 +@@ -0,0 +1,3 @@ ++. ${srcdir}/emulparams/elf_i386.sh ++GENERATE_SHLIB_SCRIPT=yes ++GENERATE_PIE_SCRIPT=yes +diff '--color=auto' -ruN ../binutils-2.37/ld/emulparams/elf_x86_64_aleksa.sh ./binutils-2.37/ld/emulparams/elf_x86_64_aleksa.sh +--- ../binutils-2.37/ld/emulparams/elf_x86_64_aleksa.sh 1970-01-01 01:00:00.000000000 +0100 ++++ ./binutils-2.37/ld/emulparams/elf_x86_64_aleksa.sh 2022-01-11 18:50:49.516213552 +0100 +@@ -0,0 +1 @@ ++. ${srcdir}/emulparams/elf_x86_64.sh +diff '--color=auto' -ruN ../binutils-2.37/ld/Makefile.am ./binutils-2.37/ld/Makefile.am +--- ../binutils-2.37/ld/Makefile.am 2021-07-08 13:37:20.000000000 +0200 ++++ ./binutils-2.37/ld/Makefile.am 2022-01-11 18:50:49.516213552 +0100 +@@ -277,6 +277,7 @@ + eelf32xtensa.c \ + eelf32z80.c \ + eelf_i386.c \ ++ eelf_i386_aleksa.c \ + eelf_i386_be.c \ + eelf_i386_fbsd.c \ + eelf_i386_ldso.c \ +@@ -453,6 +454,7 @@ + eelf_k1om.c \ + eelf_k1om_fbsd.c \ + eelf_x86_64.c \ ++ eelf_x86_64_aleksa.c \ + eelf_x86_64_cloudabi.c \ + eelf_x86_64_fbsd.c \ + eelf_x86_64_sol2.c \ diff --git a/files/aleksa-gcc-11.2.0.diff b/files/aleksa-gcc-11.2.0.diff new file mode 100644 index 0000000..3373721 --- /dev/null +++ b/files/aleksa-gcc-11.2.0.diff @@ -0,0 +1,119 @@ +diff '--color=auto' -ruN ../../gcc-11.2.0/fixincludes/mkfixinc.sh ./gcc-11.2.0/fixincludes/mkfixinc.sh +--- ../../gcc-11.2.0/fixincludes/mkfixinc.sh 2021-07-28 08:55:06.644278372 +0200 ++++ ./gcc-11.2.0/fixincludes/mkfixinc.sh 2022-01-11 18:37:07.379567018 +0100 +@@ -11,6 +11,7 @@ + + # Check for special fix rules for particular targets + case $machine in ++ *-aleksa* | \ + i?86-*-cygwin* | \ + i?86-*-mingw32* | \ + x86_64-*-mingw32* | \ +diff '--color=auto' -ruN ../../gcc-11.2.0/gcc/config/aleksa.h ./gcc-11.2.0/gcc/config/aleksa.h +--- ../../gcc-11.2.0/gcc/config/aleksa.h 1970-01-01 01:00:00.000000000 +0100 ++++ ./gcc-11.2.0/gcc/config/aleksa.h 2022-01-11 18:31:15.382909005 +0100 +@@ -0,0 +1,28 @@ ++/* Useful if you wish to make target-specific GCC changes. */ ++#undef TARGET_ALEKSA ++#define TARGET_ALEKSA 1 ++ ++/* Default arguments you want when running your ++ i686-aleksa-gcc/x86_64-aleksa-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 "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" ++ ++/* Additional predefined macros. */ ++#undef TARGET_OS_CPP_BUILTINS ++#define TARGET_OS_CPP_BUILTINS() \ ++ do { \ ++ builtin_define ("__aleksa__"); \ ++ builtin_define ("__unix__"); \ ++ builtin_assert ("system=aleksa"); \ ++ builtin_assert ("system=unix"); \ ++ builtin_assert ("system=posix"); \ ++ } while(0); +diff '--color=auto' -ruN ../../gcc-11.2.0/gcc/config.gcc ./gcc-11.2.0/gcc/config.gcc +--- ../../gcc-11.2.0/gcc/config.gcc 2021-07-28 08:55:07.000283339 +0200 ++++ ./gcc-11.2.0/gcc/config.gcc 2022-01-11 18:30:02.532910796 +0100 +@@ -686,6 +686,12 @@ + + # Common parts for widely ported systems. + case ${target} in ++*-*-aleksa*) ++ gas=yes ++ gnu_ld=yes ++ default_use_cxa_atexit=yes ++ use_gcc_stdint=wrap ++ ;; + *-*-darwin*) + tmake_file="t-darwin " + tm_file="${tm_file} darwin.h" +@@ -1084,6 +1090,12 @@ + esac + + case ${target} in ++i[34567]86-*-aleksa*) ++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h aleksa.h" ++ ;; ++x86_64-*-aleksa*) ++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h aleksa.h" ++ ;; + aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h" +diff '--color=auto' -ruN ../../gcc-11.2.0/libgcc/config.host ./gcc-11.2.0/libgcc/config.host +--- ../../gcc-11.2.0/libgcc/config.host 2021-07-28 08:55:08.752307785 +0200 ++++ ./gcc-11.2.0/libgcc/config.host 2022-01-11 18:33:33.522905613 +0100 +@@ -356,6 +356,14 @@ + esac + + case ${host} in ++i[34567]86-*-aleksa*) ++ 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-*-aleksa*) ++ 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" ++ ;; + aarch64*-*-elf | aarch64*-*-rtems*) + extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o" + extra_parts="$extra_parts crtfastmath.o" +diff '--color=auto' -ruN ../../gcc-11.2.0/libstdc++-v3/crossconfig.m4 ./gcc-11.2.0/libstdc++-v3/crossconfig.m4 +--- ../../gcc-11.2.0/libstdc++-v3/crossconfig.m4 2021-07-28 08:55:09.228314429 +0200 ++++ ./gcc-11.2.0/libstdc++-v3/crossconfig.m4 2022-01-11 18:32:31.719573793 +0100 +@@ -5,6 +5,12 @@ + AC_DEFUN([GLIBCXX_CROSSCONFIG],[ + # Base decisions on target environment. + case "${host}" in ++ *-aleksa*) ++ GLIBCXX_CHECK_COMPILER_FEATURES ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_MATH_SUPPORT ++ GLIBCXX_CHECK_STDLIB_SUPPORT ++ ;; + arm*-*-symbianelf*) + # This is a freestanding configuration; there is nothing to do here. + ;; +diff '--color=auto' -ruN ../../gcc-11.2.0/config.sub ./gcc-11.2.0/config.sub +--- ../../gcc-11.2.0/config.sub 2021-07-28 08:55:06.620278039 +0200 ++++ ./gcc-11.2.0/config.sub 2022-01-11 18:41:19.216227511 +0100 +@@ -1725,7 +1725,8 @@ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ +- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) ++ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* \ ++ | aleksa*) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) diff --git a/files/crt0.s b/files/crt0.s new file mode 100644 index 0000000..8c735f1 --- /dev/null +++ b/files/crt0.s @@ -0,0 +1,31 @@ +.section .text + +.global _start +_start: + # Set up end of the stack frame linked list. + movl $0, %ebp + pushl %ebp # rip=0 + pushl %ebp # rbp=0 + movl %esp, %ebp + + # We need those in a moment when we call main. + pushl %esi + pushl %edi + + # Prepare signals, memory allocation, stdio and such. +# call initialize_standard_library + + # Run the global constructors. + call _init + + # Restore argc and argv. + popl %edi + popl %esi + + # Run main + call main + + # Terminate the process with the exit code. + movl %eax, %edi +# call exit +.size _start, . - _start diff --git a/scripts/aleksa-binutils-2.37.diff b/scripts/aleksa-binutils-2.37.diff deleted file mode 100644 index 79cde93..0000000 --- a/scripts/aleksa-binutils-2.37.diff +++ /dev/null @@ -1,96 +0,0 @@ -diff '--color=auto' -ruN ../binutils-2.37/bfd/config.bfd ./binutils-2.37/bfd/config.bfd ---- ../binutils-2.37/bfd/config.bfd 2021-07-08 13:37:19.000000000 +0200 -+++ ./binutils-2.37/bfd/config.bfd 2022-01-11 18:51:11.272879682 +0100 -@@ -223,6 +223,18 @@ - - case "${targ}" in - # START OF targmatch.h -+ i[3-7]86-*-aleksa*) -+ targ_defvec=i386_elf32_vec -+ targ_selvecs= -+ targ64_selvecs=x86_64_elf64_vec -+ ;; -+#ifdef BFD64 -+ x86_64-*-aleksa*) -+ targ_defvec=x86_64_elf64_vec -+ targ_selvecs=i386_elf32_vec -+ want64=true -+ ;; -+#endif - #ifdef BFD64 - aarch64-*-darwin*) - targ_defvec=aarch64_mach_o_vec -diff '--color=auto' -ruN ../binutils-2.37/config.sub ./binutils-2.37/config.sub ---- ../binutils-2.37/config.sub 2021-07-08 13:37:19.000000000 +0200 -+++ ./binutils-2.37/config.sub 2022-01-11 18:51:18.386212846 +0100 -@@ -1729,7 +1729,8 @@ - | skyos* | haiku* | rdos* | toppers* | drops* | es* \ - | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ - | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ -- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) -+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* \ -+ | aleksa*) - ;; - # This one is extra strict with allowed versions - sco3.2v2 | sco3.2v[4-9]* | sco5v6*) -diff '--color=auto' -ruN ../binutils-2.37/gas/configure.tgt binutils-2.37/gas/configure.tgt ---- ../binutils-2.37/gas/configure.tgt ./2021-07-08 13:37:19.000000000 +0200 -+++ ./binutils-2.37/gas/configure.tgt 2022-01-11 18:51:33.739545802 +0100 -@@ -123,6 +123,7 @@ - generic_target=${cpu_type}-$vendor-$os - # Note: This table is alpha-sorted, please try to keep it that way. - case ${generic_target} in -+ i386-*-aleksa*) fmt=elf ;; - aarch64*-*-elf*) fmt=elf;; - aarch64*-*-fuchsia*) fmt=elf;; - aarch64*-*-genode*) fmt=elf;; -diff '--color=auto' -ruN ../binutils-2.37/ld/configure.tgt ./binutils-2.37/ld/configure.tgt ---- ../binutils-2.37/ld/configure.tgt 2021-07-08 13:37:20.000000000 +0200 -+++ ./binutils-2.37/ld/configure.tgt 2022-01-11 18:51:48.049545452 +0100 -@@ -43,6 +43,15 @@ - # Please try to keep this table more or less in alphabetic order - it - # makes it much easier to lookup a specific archictecture. - case "${targ}" in -+i[3-7]86-*-aleksa*) -+ targ_emul=elf_i386_aleksa -+ targ_extra_emuls=elf_i386 -+ targ64_extra_emuls="elf_x86_64_aleksa elf_x86_64" -+ ;; -+x86_64-*-aleksa*) -+ targ_emul=elf_x86_64_aleksa -+ targ_extra_emuls="elf_i386_aleksa elf_x86_64 elf_i386" -+ ;; - aarch64_be-*-elf) targ_emul=aarch64elfb - targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" - ;; -diff '--color=auto' -ruN ../binutils-2.37/ld/emulparams/elf_i386_aleksa.sh ./binutils-2.37/ld/emulparams/elf_i386_aleksa.sh ---- ../binutils-2.37/ld/emulparams/elf_i386_aleksa.sh 1970-01-01 01:00:00.000000000 +0100 -+++ ./binutils-2.37/ld/emulparams/elf_i386_aleksa.sh 2022-01-11 18:50:49.516213552 +0100 -@@ -0,0 +1,3 @@ -+. ${srcdir}/emulparams/elf_i386.sh -+GENERATE_SHLIB_SCRIPT=yes -+GENERATE_PIE_SCRIPT=yes -diff '--color=auto' -ruN ../binutils-2.37/ld/emulparams/elf_x86_64_aleksa.sh ./binutils-2.37/ld/emulparams/elf_x86_64_aleksa.sh ---- ../binutils-2.37/ld/emulparams/elf_x86_64_aleksa.sh 1970-01-01 01:00:00.000000000 +0100 -+++ ./binutils-2.37/ld/emulparams/elf_x86_64_aleksa.sh 2022-01-11 18:50:49.516213552 +0100 -@@ -0,0 +1 @@ -+. ${srcdir}/emulparams/elf_x86_64.sh -diff '--color=auto' -ruN ../binutils-2.37/ld/Makefile.am ./binutils-2.37/ld/Makefile.am ---- ../binutils-2.37/ld/Makefile.am 2021-07-08 13:37:20.000000000 +0200 -+++ ./binutils-2.37/ld/Makefile.am 2022-01-11 18:50:49.516213552 +0100 -@@ -277,6 +277,7 @@ - eelf32xtensa.c \ - eelf32z80.c \ - eelf_i386.c \ -+ eelf_i386_aleksa.c \ - eelf_i386_be.c \ - eelf_i386_fbsd.c \ - eelf_i386_ldso.c \ -@@ -453,6 +454,7 @@ - eelf_k1om.c \ - eelf_k1om_fbsd.c \ - eelf_x86_64.c \ -+ eelf_x86_64_aleksa.c \ - eelf_x86_64_cloudabi.c \ - eelf_x86_64_fbsd.c \ - eelf_x86_64_sol2.c \ diff --git a/scripts/aleksa-gcc-11.2.0.diff b/scripts/aleksa-gcc-11.2.0.diff deleted file mode 100644 index 3373721..0000000 --- a/scripts/aleksa-gcc-11.2.0.diff +++ /dev/null @@ -1,119 +0,0 @@ -diff '--color=auto' -ruN ../../gcc-11.2.0/fixincludes/mkfixinc.sh ./gcc-11.2.0/fixincludes/mkfixinc.sh ---- ../../gcc-11.2.0/fixincludes/mkfixinc.sh 2021-07-28 08:55:06.644278372 +0200 -+++ ./gcc-11.2.0/fixincludes/mkfixinc.sh 2022-01-11 18:37:07.379567018 +0100 -@@ -11,6 +11,7 @@ - - # Check for special fix rules for particular targets - case $machine in -+ *-aleksa* | \ - i?86-*-cygwin* | \ - i?86-*-mingw32* | \ - x86_64-*-mingw32* | \ -diff '--color=auto' -ruN ../../gcc-11.2.0/gcc/config/aleksa.h ./gcc-11.2.0/gcc/config/aleksa.h ---- ../../gcc-11.2.0/gcc/config/aleksa.h 1970-01-01 01:00:00.000000000 +0100 -+++ ./gcc-11.2.0/gcc/config/aleksa.h 2022-01-11 18:31:15.382909005 +0100 -@@ -0,0 +1,28 @@ -+/* Useful if you wish to make target-specific GCC changes. */ -+#undef TARGET_ALEKSA -+#define TARGET_ALEKSA 1 -+ -+/* Default arguments you want when running your -+ i686-aleksa-gcc/x86_64-aleksa-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 "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" -+ -+/* Additional predefined macros. */ -+#undef TARGET_OS_CPP_BUILTINS -+#define TARGET_OS_CPP_BUILTINS() \ -+ do { \ -+ builtin_define ("__aleksa__"); \ -+ builtin_define ("__unix__"); \ -+ builtin_assert ("system=aleksa"); \ -+ builtin_assert ("system=unix"); \ -+ builtin_assert ("system=posix"); \ -+ } while(0); -diff '--color=auto' -ruN ../../gcc-11.2.0/gcc/config.gcc ./gcc-11.2.0/gcc/config.gcc ---- ../../gcc-11.2.0/gcc/config.gcc 2021-07-28 08:55:07.000283339 +0200 -+++ ./gcc-11.2.0/gcc/config.gcc 2022-01-11 18:30:02.532910796 +0100 -@@ -686,6 +686,12 @@ - - # Common parts for widely ported systems. - case ${target} in -+*-*-aleksa*) -+ gas=yes -+ gnu_ld=yes -+ default_use_cxa_atexit=yes -+ use_gcc_stdint=wrap -+ ;; - *-*-darwin*) - tmake_file="t-darwin " - tm_file="${tm_file} darwin.h" -@@ -1084,6 +1090,12 @@ - esac - - case ${target} in -+i[34567]86-*-aleksa*) -+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h aleksa.h" -+ ;; -+x86_64-*-aleksa*) -+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h aleksa.h" -+ ;; - aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) - tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h" - tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h" -diff '--color=auto' -ruN ../../gcc-11.2.0/libgcc/config.host ./gcc-11.2.0/libgcc/config.host ---- ../../gcc-11.2.0/libgcc/config.host 2021-07-28 08:55:08.752307785 +0200 -+++ ./gcc-11.2.0/libgcc/config.host 2022-01-11 18:33:33.522905613 +0100 -@@ -356,6 +356,14 @@ - esac - - case ${host} in -+i[34567]86-*-aleksa*) -+ 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-*-aleksa*) -+ 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" -+ ;; - aarch64*-*-elf | aarch64*-*-rtems*) - extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o" - extra_parts="$extra_parts crtfastmath.o" -diff '--color=auto' -ruN ../../gcc-11.2.0/libstdc++-v3/crossconfig.m4 ./gcc-11.2.0/libstdc++-v3/crossconfig.m4 ---- ../../gcc-11.2.0/libstdc++-v3/crossconfig.m4 2021-07-28 08:55:09.228314429 +0200 -+++ ./gcc-11.2.0/libstdc++-v3/crossconfig.m4 2022-01-11 18:32:31.719573793 +0100 -@@ -5,6 +5,12 @@ - AC_DEFUN([GLIBCXX_CROSSCONFIG],[ - # Base decisions on target environment. - case "${host}" in -+ *-aleksa*) -+ GLIBCXX_CHECK_COMPILER_FEATURES -+ GLIBCXX_CHECK_LINKER_FEATURES -+ GLIBCXX_CHECK_MATH_SUPPORT -+ GLIBCXX_CHECK_STDLIB_SUPPORT -+ ;; - arm*-*-symbianelf*) - # This is a freestanding configuration; there is nothing to do here. - ;; -diff '--color=auto' -ruN ../../gcc-11.2.0/config.sub ./gcc-11.2.0/config.sub ---- ../../gcc-11.2.0/config.sub 2021-07-28 08:55:06.620278039 +0200 -+++ ./gcc-11.2.0/config.sub 2022-01-11 18:41:19.216227511 +0100 -@@ -1725,7 +1725,8 @@ - | skyos* | haiku* | rdos* | toppers* | drops* | es* \ - | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ - | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ -- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) -+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* \ -+ | aleksa*) - ;; - # This one is extra strict with allowed versions - sco3.2v2 | sco3.2v[4-9]* | sco5v6*) diff --git a/scripts/install_headers.sh b/scripts/install_headers.sh index ae0e560..99e7266 100755 --- a/scripts/install_headers.sh +++ b/scripts/install_headers.sh @@ -1,14 +1,12 @@ #!/bin/sh SYSROOT="/opt/aleksa" -GCC_DIR=$(gcc --print-file-name=) +SYSROOT_INCLUDE=$SYSROOT/usr/include if [ ! -d mykernel ]; then git clone "https://github.com/aleksav013/mykernel" fi -rm -rf "$SYSROOT/usr/include" -mkdir -p "$SYSROOT/usr/include" -cp -r "$GCC_DIR"include/* "$SYSROOT/usr/include" -cp -r mykernel/src/include/* "$SYSROOT/usr/include" -cp "$SYSROOT/usr/include/stdint-gcc.h" "$SYSROOT/usr/include/stdint.h" +rm -rf "$SYSROOT_INCLUDE" +mkdir -p "$SYSROOT_INCLUDE" +cp -r mykernel/src/include/* "$SYSROOT_INCLUDE" diff --git a/scripts/setup.sh b/scripts/setup.sh index 38fc428..1340090 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -31,7 +31,7 @@ patch_gnu() if [ ! -d "./binutils-2.37" ]; then cp -r "../binutils-2.37" . - patch -p0 < "../scripts/aleksa-binutils-2.37.diff" + patch -p0 < "../files/aleksa-binutils-2.37.diff" cd "./binutils-2.37/ld" || exit sed -i "s/2.69/2.71/" "Makefile.am" aclocal @@ -41,17 +41,23 @@ patch_gnu() if [ ! -d "./gcc-11.2.0" ]; then cp -r "../gcc-11.2.0" . - patch -p0 < "../scripts/aleksa-gcc-11.2.0.diff" + patch -p0 < "../files/aleksa-gcc-11.2.0.diff" cd "./gcc-11.2.0/libstdc++-v3" || exit sed -i "s/2.69/2.71/" "../config/override.m4" autoreconf cd "../.." || exit fi + cd ".." || exit +} + +install_headers() +{ + ./scripts/install_headers.sh } build_binutils() { - cd "./binutils-2.37" || exit + cd "./mine/binutils-2.37" || exit mkdir -p build cd build || exit @@ -66,17 +72,12 @@ build_binutils() make -j4 make install - cd "../.." || exit -} - -install_headers() -{ - ../scripts/install_headers.sh + cd "../../.." || exit } build_gcc() { - cd "./gcc-11.2.0" || exit + cd "./mine/gcc-11.2.0" || exit mkdir -p build cd build || exit @@ -86,18 +87,22 @@ build_gcc() --prefix="$SYSROOT/usr" \ --with-sysroot="$SYSROOT" \ --disable-nls \ + --disable-plugin \ --enable-languages=c,c++ fi - make -j4 all-gcc - make -j4 all-target-libgcc + make -j4 all-gcc all-target-libgcc + make install-gcc install-target-libgcc - make -k check || true + cd "../../.." || exit +} - make install-gcc - make install-target-libgcc +additions() +{ + GCC_INCLUDE=$(i686-aleksa-gcc --print-file-name=) - cd "../.." || exit + i686-aleksa-as files/crt0.s -o "$GCC_INCLUDE/crt0.o" + touch "$GCC_INCLUDE/libc.a" } main() @@ -108,6 +113,7 @@ main() install_headers build_binutils build_gcc + additions } main -- cgit v1.2.3