Skip to content

Commit

Permalink
toaru: Add target definition for ToaruOS
Browse files Browse the repository at this point in the history
  • Loading branch information
klange committed Apr 20, 2021
1 parent f00b571 commit efc2a78
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config.sub
Expand Up @@ -581,6 +581,10 @@ case $1 in
basic_machine=pdp10-xkl
os=tops20
;;
toaru)
basic_machine=x86_64-pc
os=toaru
;;
tpf)
basic_machine=s390x-ibm
os=tpf
Expand Down Expand Up @@ -1363,7 +1367,7 @@ case $os in
| os2* | vos* | palmos* | uclinux* | nucleus* \
| morphos* | superux* | rtmk* | windiss* \
| powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
| skyos* | haiku* | rdos* | toppers* | drops* | es* \
| skyos* | haiku* | rdos* | toppers* | drops* | es* | toaru* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix)
Expand Down
2 changes: 2 additions & 0 deletions fixincludes/mkfixinc.sh
Expand Up @@ -14,6 +14,8 @@ case $machine in
i?86-*-cygwin* | \
i?86-*-mingw32* | \
x86_64-*-mingw32* | \
i?86-*-toaru* | \
x86_64-*-toaru* | \
powerpc-*-eabisim* | \
powerpc-*-eabi* | \
powerpc-*-rtems* | \
Expand Down
12 changes: 12 additions & 0 deletions gcc/config.gcc
Expand Up @@ -963,6 +963,12 @@ case ${target} in
esac
target_has_targetdm=yes
;;
*-*-toaru*)
gas=yes
gnu_ld=yes
default_use_cxa_atexit=yes
use_gcc_stdint=wrap
;;
*-*-*vms*)
extra_options="${extra_options} vms/vms.opt"
xmake_file=vms/x-vms
Expand Down Expand Up @@ -1908,6 +1914,12 @@ x86_64-*-rdos*)
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/rdos.h i386/rdos64.h"
tmake_file="i386/t-i386elf t-svr4"
;;
i[34567]86-*-toaru)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h toaru.h"
;;
x86_64-*-toaru*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h toaru.h"
;;
i[34567]86-*-dragonfly*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h"
tmake_file="${tmake_file} i386/t-crtstuff"
Expand Down
21 changes: 21 additions & 0 deletions gcc/config/toaru.h
@@ -0,0 +1,21 @@
#undef TARGET_OS_CPP_BUILTINS
#define TARGET_OS_CPP_BUILTINS() \
do { \
builtin_define_std ("toaru"); \
builtin_define_std ("unix"); \
builtin_assert ("system=toaru"); \
builtin_assert ("system=unix"); \
} while (0);

#undef STARTFILE_SPEC
#define STARTFILE_SPEC "%{!shared: %{!pg:crt0.o%s}} crti.o%s %{!shared:crtbegin.o%s}"

#undef ENDFILE_SPEC
#define ENDFILE_SPEC "%{!shared:crtend.o%s} crtn.o%s"

#undef LIB_SPEC
#define LIB_SPEC "%{pthread:-lpthread} -lc"

#undef LINK_SPEC
#define LINK_SPEC "%{shared:-shared} %{static:-static} %{!shared: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld.so}}}"

8 changes: 8 additions & 0 deletions libgcc/config.host
Expand Up @@ -886,6 +886,14 @@ x86_64-*-mingw*)
extra_parts="$extra_parts vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o"
fi
;;
i[34567]87-*-toaru*)
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-*-toaru*)
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"
;;
ia64*-*-elf*)
extra_parts="$extra_parts crtbeginS.o crtendS.o crtfastmath.o"
tmake_file="ia64/t-ia64 ia64/t-ia64-elf ia64/t-eh-ia64 t-crtfm t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat"
Expand Down
6 changes: 6 additions & 0 deletions libstdc++-v3/crossconfig.m4
Expand Up @@ -243,6 +243,12 @@ case "${host}" in
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
;;
*-toaru*)
GLIBCXX_CHECK_COMPILER_FEATURES
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
;;
*-tpf)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
SECTION_LDFLAGS='-Wl,--gc-sections $SECTION_LDFLAGS'
Expand Down

0 comments on commit efc2a78

Please sign in to comment.