Hosted GCC cross-compiler for x86_64-luna!!!
This commit is contained in:
parent
dc0fd428d3
commit
ba52e389a5
137
tools/gcc.patch
Normal file
137
tools/gcc.patch
Normal file
@ -0,0 +1,137 @@
|
||||
diff --color -rN -u gcc-12.2.0/config.sub build/gcc-12.2.0/config.sub
|
||||
--- a/gcc-12.2.0/config.sub 2022-08-19 10:09:52.128656687 +0200
|
||||
+++ b/gcc-12.2.0/config.sub 2022-10-02 11:27:45.660055384 +0200
|
||||
@@ -1723,7 +1723,7 @@
|
||||
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
|
||||
| sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
|
||||
| hiux* | abug | nacl* | netware* | windows* \
|
||||
- | os9* | macos* | osx* | ios* \
|
||||
+ | os9* | macos* | osx* | ios* | luna* \
|
||||
| mpw* | magic* | mmixware* | mon960* | lnews* \
|
||||
| amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
|
||||
| aos* | aros* | cloudabi* | sortix* | twizzler* \
|
||||
diff --color -rN -u gcc-12.2.0/fixincludes/mkfixinc.sh build/gcc-12.2.0/fixincludes/mkfixinc.sh
|
||||
--- a/gcc-12.2.0/fixincludes/mkfixinc.sh 2022-08-19 10:09:52.160657095 +0200
|
||||
+++ b/gcc-12.2.0/fixincludes/mkfixinc.sh 2022-10-02 11:27:45.662055397 +0200
|
||||
@@ -12,6 +12,8 @@
|
||||
# Check for special fix rules for particular targets
|
||||
case $machine in
|
||||
i?86-*-cygwin* | \
|
||||
+ *-luna* | \
|
||||
+ *-*-luna* | \
|
||||
i?86-*-mingw32* | \
|
||||
x86_64-*-mingw32* | \
|
||||
powerpc-*-eabisim* | \
|
||||
diff --color -rN -u gcc-12.2.0/gcc/config/i386/x86_64-luna-kernel build/gcc-12.2.0/gcc/config/i386/x86_64-luna-kernel
|
||||
--- a/dev/null 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/gcc-12.2.0/gcc/config/i386/x86_64-luna-kernel 2022-10-02 11:45:30.955856133 +0200
|
||||
@@ -0,0 +1,4 @@
|
||||
+#Add libgcc multilib variant without red-zone requirement, for use in the kernel
|
||||
+
|
||||
+MULTILIB_OPTIONS += mno-red-zone
|
||||
+MULTILIB_DIRNAMES += no-red-zone
|
||||
\ No newline at end of file
|
||||
diff --color -rN -u gcc-12.2.0/gcc/config/luna.h build/gcc-12.2.0/gcc/config/luna.h
|
||||
--- a/dev/null 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/gcc-12.2.0/gcc/config/luna.h 2022-10-02 11:27:45.663055404 +0200
|
||||
@@ -0,0 +1,40 @@
|
||||
+#undef TARGET_LUNA
|
||||
+#define TARGET_LUNA 1
|
||||
+
|
||||
+/* Default arguments you want when running your
|
||||
+ i686-luna-gcc/x86_64-luna-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"
|
||||
+
|
||||
+#undef PID_TYPE
|
||||
+#define PID_TYPE "long int"
|
||||
+
|
||||
+#undef SIZE_TYPE
|
||||
+#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
|
||||
+
|
||||
+/* Ensure that ptrdiff_t matches the actual pointer size */
|
||||
+#undef PTRDIFF_TYPE
|
||||
+#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
|
||||
+
|
||||
+/* Additional predefined macros. */
|
||||
+#undef TARGET_OS_CPP_BUILTINS
|
||||
+#define TARGET_OS_CPP_BUILTINS() \
|
||||
+ do { \
|
||||
+ builtin_define("__luna__"); \
|
||||
+ builtin_define("__unix__"); \
|
||||
+ builtin_assert("system=luna"); \
|
||||
+ builtin_assert("system=unix"); \
|
||||
+ builtin_assert("system=posix"); \
|
||||
+ } while (0);
|
||||
+
|
||||
+#undef LINK_SPEC
|
||||
+#define LINK_SPEC "-z max-page-size=4096"
|
||||
\ No newline at end of file
|
||||
diff --color -rN -u gcc-12.2.0/gcc/config.gcc build/gcc-12.2.0/gcc/config.gcc
|
||||
--- a/gcc-12.2.0/gcc/config.gcc 2022-08-19 10:09:52.552662114 +0200
|
||||
+++ b/gcc-12.2.0/gcc/config.gcc 2022-10-02 11:45:18.311797546 +0200
|
||||
@@ -895,6 +895,12 @@
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
+*-*-luna*)
|
||||
+ gas=yes
|
||||
+ gnu_ld=yes
|
||||
+ default_use_cxa_atexit=yes
|
||||
+ use_gcc_stdint=provide
|
||||
+ ;;
|
||||
*-*-netbsd*)
|
||||
tm_p_file="${tm_p_file} netbsd-protos.h"
|
||||
tmake_file="t-netbsd t-slibgcc"
|
||||
@@ -1901,6 +1907,13 @@
|
||||
x86_64-*-elf*)
|
||||
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
|
||||
;;
|
||||
+i[34567]86-*-luna*)
|
||||
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h luna.h"
|
||||
+ ;;
|
||||
+x86_64-*-luna*)
|
||||
+ tmake_file="${tmake_file} i386/x86_64-luna-kernel"
|
||||
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h luna.h"
|
||||
+ ;;
|
||||
x86_64-*-rtems*)
|
||||
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rtemself.h rtems.h"
|
||||
;;
|
||||
diff --color -rN -u gcc-12.2.0/libgcc/config.host build/gcc-12.2.0/libgcc/config.host
|
||||
--- a/gcc-12.2.0/libgcc/config.host 2022-08-19 10:09:54.664689148 +0200
|
||||
+++ b/gcc-12.2.0/libgcc/config.host 2022-10-02 11:27:45.671055461 +0200
|
||||
@@ -783,6 +783,14 @@
|
||||
;;
|
||||
i[34567]86-*-lynxos*)
|
||||
;;
|
||||
+i[34567]86-*-luna*)
|
||||
+ 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-*-luna*)
|
||||
+ 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-*-nto-qnx*)
|
||||
tmake_file="$tmake_file i386/t-nto t-libgcc-pic"
|
||||
extra_parts=crtbegin.o
|
||||
diff --color -rN -u gcc-12.2.0/libgcc/libgcov.h build/gcc-12.2.0/libgcc/libgcov.h
|
||||
--- a/gcc-12.2.0/libgcc/libgcov.h 2022-08-19 10:09:54.728689966 +0200
|
||||
+++ b/gcc-12.2.0/libgcc/libgcov.h 2022-10-02 11:41:48.571807335 +0200
|
||||
@@ -194,6 +194,7 @@
|
||||
#endif
|
||||
|
||||
#include "gcov-io.h"
|
||||
+#include <stdint.h>
|
||||
|
||||
/* Structures embedded in coveraged program. The structures generated
|
||||
by write_profile must match these. */
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
source $(dirname $0)/env.sh
|
||||
|
||||
export LUNA_GCC_VERSION_REQUIRED=12.1.0
|
||||
export LUNA_GCC_VERSION_REQUIRED=12.2.0
|
||||
export LUNA_BINUTILS_VERSION_REQUIRED=2.38
|
||||
|
||||
export BUILD_PREFIX=$LUNA_ROOT/toolchain/x86-64-luna
|
||||
|
@ -4,7 +4,7 @@ source $(dirname $0)/setup-env.sh
|
||||
|
||||
cd $LUNA_ROOT
|
||||
|
||||
if [ ! -x $(command -v x86_64-elf-as) ]
|
||||
if [ ! -x $(command -v x86_64-luna-as) ]
|
||||
then
|
||||
echo Binutils should be cross-built before GCC.
|
||||
exit 1
|
||||
@ -23,13 +23,21 @@ echo Extracting GCC...
|
||||
|
||||
tar xf toolchain/tarballs/gcc-$LUNA_GCC_VERSION_REQUIRED.tar.xz -C toolchain/build/
|
||||
|
||||
echo Patching Binutils...
|
||||
|
||||
cd toolchain
|
||||
|
||||
patch -u -i $LUNA_ROOT/tools/gcc.patch -p 1 -d build
|
||||
|
||||
cd -
|
||||
|
||||
echo Configuring GCC...
|
||||
|
||||
mkdir -p toolchain/build/gcc
|
||||
|
||||
cd toolchain/build/gcc
|
||||
|
||||
../gcc-$LUNA_GCC_VERSION_REQUIRED/configure --prefix="$PREFIX" --target=$TARGET --disable-nls --enable-languages=c,c++ --without-headers
|
||||
../gcc-$LUNA_GCC_VERSION_REQUIRED/configure --prefix="$BUILD_PREFIX" --target=$BUILD_TARGET --disable-nls --with-sysroot=$BUILD_SYSROOT --enable-languages=c,c++ --without-headers
|
||||
|
||||
echo Building GCC...
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
set -e
|
||||
source $(dirname $0)/setup-env.sh
|
||||
|
||||
if [ -x "$(command -v x86_64-elf-gcc)" ]
|
||||
if [ -x "$(command -v x86_64-luna-gcc)" ]
|
||||
then
|
||||
if [ "$(x86_64-elf-gcc --version | head -n 1 | awk '{ print $3 }')" == "$LUNA_GCC_VERSION_REQUIRED" ]
|
||||
if [ "$(x86_64-luna-gcc --version | head -n 1 | awk '{ print $3 }')" == "$LUNA_GCC_VERSION_REQUIRED" ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user