|
From: <ba...@us...> - 2006-09-18 00:26:42
|
Revision: 369
http://svn.sourceforge.net/cadcdev/?rev=369&view=rev
Author: bardtx
Date: 2006-09-17 17:26:35 -0700 (Sun, 17 Sep 2006)
Log Message:
-----------
kos: Add dc-chain updated to GCC 3.4.6:
https://sourceforge.net/mailarchive/message.php?msg_id=28482460
Added Paths:
-----------
kos/utils/dc-chain/
kos/utils/dc-chain/00PATCHES
kos/utils/dc-chain/00README
kos/utils/dc-chain/Makefile
kos/utils/dc-chain/download.sh
kos/utils/dc-chain/patches/
kos/utils/dc-chain/patches/gcc-3.4.6.diff
kos/utils/dc-chain/patches/newlib-1.12.0-kos.diff
kos/utils/dc-chain/unpack.sh
Added: kos/utils/dc-chain/00PATCHES
===================================================================
--- kos/utils/dc-chain/00PATCHES (rev 0)
+++ kos/utils/dc-chain/00PATCHES 2006-09-18 00:26:35 UTC (rev 369)
@@ -0,0 +1,21 @@
+gcc-3.4.6-diff:
+- Defines SUPPORT_WEAK 0 in config/sh/kos.h so that pthreads will not create
+ weak symbols (GNU ld does not extract weak symbols from archives).
+- Do not build m2/m2e/m4-single/m4 by default. Should be unnecessary once
+ we have a sh-kos-elf target.
+- Adds config/sh/kos.h to config.gcc. Note: this is under sh-elf-unknown.
+ Once we have a sh-kos-elf target, that should be corrected.
+- Add sh4/atomicity.h stub, not currently used. Requires addition of spinlock
+ or interrupt disable/enable code. Currently we use the generic atomicity
+ functions, which use pthreads (slow).
+- Correct bug (?) in config/generic/atomicity.h (_GLIBCXX_ macros undefined).
+- Add sh-unknown-elf defines to libstdc++/crossconfig.m4 -- this was done by
+ default (accident?) prior to 3.4.
+
+Generic newlib fixups (applied directly after newlib is installed):
+ cp $(kos_base)/include/pthread.h $(newlib_inc) # KOS pthread.h is modified
+ cp $(kos_base)/include/sys/_pthread.h $(newlib_inc)/sys # to define _POSIX_THREADS
+ cp $(kos_base)/include/sys/sched.h $(newlib_inc)/sys # pthreads to kthreads mapping
+ ln -nsf $(kos_base)/include/kos $(newlib_inc) # so KOS includes are available as kos/file.h
+ ln -nsf $(kos_base)/kernel/arch/dreamcast/include/arch $(newlib_inc) # kos/thread.h requires arch/arch.h
+ ln -nsf $(kos_base)/kernel/arch/dreamcast/include/dc $(newlib_inc) # arch/arch.h requires dc/video.h
Added: kos/utils/dc-chain/00README
===================================================================
--- kos/utils/dc-chain/00README (rev 0)
+++ kos/utils/dc-chain/00README 2006-09-18 00:26:35 UTC (rev 369)
@@ -0,0 +1,25 @@
+dc-chain 0.1
+------------
+
+This package contains a Makefile which both simplifies building the Dreamcast
+toolchain, and gives you substantial control.
+
+On the minimum hassle side, 'make' will patch everything (using patches/*.diff)
+and build both the sh and arm toolchains. 'make erase=1' will erase the build
+directories as they become safe to delete, to save space. And as for a more
+complex example, 'make patch-gcc build-sh4-gcc-pass1 thread_model=single' will
+build a patched, single-threaded sh4 gcc pass 1 compiler. Please see the
+comments at the top of the Makefile for more options.
+
+Before you start, change the variables in the User Configuration section to
+match your environment. They can be overridden at the command line as well.
+
+Then untar your binutils, gcc-core, and optionally newlib and gcc-g++
+distributions into this directory (or copy Makefile and patches/ into your
+build directory.) Also, ensure the KOS distribution is unpacked, and set
+its path in the Makefile, because some KOS includes are copied over to newlib.
+
+Finally, run make. If anything goes wrong, check the output in logs/.
+
+Some patches are included in this package as well. As of this writing,
+they patch newlib to work with KOS and gcc-3.4.6 to use POSIX threads.
Added: kos/utils/dc-chain/Makefile
===================================================================
--- kos/utils/dc-chain/Makefile (rev 0)
+++ kos/utils/dc-chain/Makefile 2006-09-18 00:26:35 UTC (rev 369)
@@ -0,0 +1,205 @@
+#!/bin/bash
+# Dreamcast toolchain makefile by Jim Ursetto
+# adapted from Stalin's build script version 0.3
+#
+# Interesting parameters:
+# erase=0|1 Erase build directories on the fly to save space
+# thread_model=posix|single Set gcc threading model
+# verbose=0|1 Display
+#
+# Interesting targets (you can 'make' any of these):
+# all: patch build
+# patch: patch-gcc patch-newlib patch-kos
+# build: build-sh4 build-arm
+# build-sh4: build-sh4-binutils build-sh4-gcc
+# build-arm: build-arm-binutils build-arm-gcc
+# build-sh4-gcc: build-sh4-gcc-pass1 build-sh4-newlib build-sh4-gcc-pass2
+# build-arm-gcc: build-arm-gcc-pass1
+# build-sh4-newlib: build-sh4-newlib-only fixup-sh4-newlib
+
+# User configuration
+sh_target=sh-elf
+arm_target=arm-elf
+sh_prefix := /opt/dc/$(sh_target)
+arm_prefix := /opt/dc/$(arm_target)
+# kos_root: KOS subversion root (contains kos/ and kos-ports/)
+kos_root=~/prj/svn
+# kos_base: equivalent of KOS_BASE (contains include/ and kernel/)
+kos_base=$(kos_root)/kos
+binutils_ver=2.15
+gcc_ver=3.4.6
+newlib_ver=1.12.0
+thread_model=posix
+erase=0
+verbose=0
+
+# Makefile variables
+install=$(prefix)/bin
+pwd := $(shell pwd)
+patches := $(pwd)/patches
+logdir := $(pwd)/logs
+PATH := $(sh_prefix)/bin:$(arm_prefix)/bin:$(PATH)
+binutils_dir=binutils-$(binutils_ver)
+gcc_dir=gcc-$(gcc_ver)
+newlib_dir=newlib-$(newlib_ver)
+
+all: patch build
+
+# ---- patch {{{
+gcc_patches := $(wildcard $(patches)/gcc-$(gcc_ver)*.diff)
+newlib_patches := $(wildcard $(patches)/newlib-$(newlib_ver)*.diff)
+kos_patches := $(wildcard $(patches)/kos-*.diff)
+
+patch_targets=patch-gcc patch-newlib patch-kos
+
+patch: $(patch_targets)
+patch-gcc: $(gcc_patches)
+patch-newlib: $(newlib_patches)
+patch-kos: $(kos_patches)
+
+$(newlib_patches):
+ cd $(newlib_dir); patch -p1 < $@
+
+$(gcc_patches):
+ cd $(gcc_dir); patch -p1 < $@
+
+$(kos_patches):
+ cd $(kos_root); patch -p1 < $@
+
+# ---- }}}
+
+# ---- build {{{
+
+build: build-sh4 build-arm
+# build-sh4: build-sh4-binutils build-sh4-gcc
+build-sh4: build-sh4-gcc
+build-arm: build-arm-binutils build-arm-gcc
+# build-sh4-gcc: build-sh4-gcc-pass1 build-sh4-newlib build-sh4-gcc-pass2
+build-sh4-gcc: build-sh4-newlib build-sh4-gcc-pass2
+build-arm-gcc: build-arm-gcc-pass1
+ $(clean_arm_hack)
+#build-sh4-newlib: build-sh4-newlib-only fixup-sh4-newlib
+build-sh4-newlib: fixup-sh4-newlib
+
+# Ensure that, no matter where we enter, prefix and target are set correctly.
+build_sh4_targets=build-sh4-binutils build-sh4-gcc build-sh4-gcc-pass1 build-sh4-newlib build-sh4-newlib-only build-sh4-gcc-pass2
+build_arm_targets=build-arm-binutils build-arm-gcc build-arm-gcc-pass1
+$(build_sh4_targets): prefix = $(sh_prefix)
+$(build_sh4_targets): target = $(sh_target)
+$(build_arm_targets): extra_configure_args = ""
+$(build_arm_targets): prefix = $(arm_prefix)
+$(build_arm_targets): target = $(arm_target)
+$(build_arm_targets): extra_configure_args = "--with-arch=armv4"
+
+# To avoid code repetition, we use the same commands for both
+# architectures. But we can't create a single target called
+# build-binutils for both sh4 and arm, because phony targets
+# can't be run multiple times. So we create multiple targets.
+build_binutils = build-sh4-binutils build-arm-binutils
+build_gcc_pass1 = build-sh4-gcc-pass1 build-arm-gcc-pass1
+build_newlib = build-sh4-newlib-only
+build_gcc_pass2 = build-sh4-gcc-pass2
+
+# Here we use the essentially same code for multiple targets,
+# differing only by the current state of the variables below.
+$(build_binutils): build = build-binutils-$(target)-$(binutils_ver)
+$(build_binutils): src_dir = binutils-$(binutils_ver)
+$(build_binutils): log = $(logdir)/$(build).log
+$(build_binutils): logdir
+ @echo "+++ Building $(src_dir) to $(build)..."
+ -mkdir -p $(build)
+ > $(log)
+ cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) $(to_log)
+ make -C $(build) all install $(to_log)
+ $(clean_up)
+
+$(build_gcc_pass1) $(build_gcc_pass2): build = build-gcc-$(target)-$(gcc_ver)
+$(build_gcc_pass1) $(build_gcc_pass2): src_dir = gcc-$(gcc_ver)
+$(build_gcc_pass1): log = $(logdir)/$(build)-pass1.log
+$(build_gcc_pass1): logdir
+ @echo "+++ Building $(src_dir) to $(build) (pass 1)..."
+ -mkdir -p $(build)
+ > $(log)
+ cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --without-headers --with-newlib --enable-languages=c $(extra_configure_args) $(to_log)
+ make -C $(build) all-gcc install-gcc $(to_log)
+
+$(build_newlib): build = build-newlib-$(target)-$(newlib_ver)
+$(build_newlib): src_dir = newlib-$(newlib_ver)
+$(build_newlib): log = $(logdir)/$(build).log
+$(build_newlib): logdir
+ @echo "+++ Building $(src_dir) to $(build)..."
+ -mkdir -p $(build)
+ > $(log)
+ cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) $(to_log)
+ make -C $(build) all install CC_FOR_TARGET=$(install)/$(target)-gcc AS_FOR_TARGET=$(install)/$(target)-as \
+ LD_FOR_TARGET=$(install)/$(target)-ld AR_FOR_TARGET=$(install)/$(target)-ar \
+ RANLIB_FOR_TARGET=$(install)/$(target)-ranlib $(to_log)
+ $(clean_up)
+
+fixup-sh4-newlib: newlib_inc=$(sh_prefix)/$(sh_target)/include
+fixup-sh4-newlib:
+ @echo "+++ Fixing up sh4 newlib includes..."
+ cp $(kos_base)/include/pthread.h $(newlib_inc) # KOS pthread.h is modified
+ cp $(kos_base)/include/sys/_pthread.h $(newlib_inc)/sys # to define _POSIX_THREADS
+ cp $(kos_base)/include/sys/sched.h $(newlib_inc)/sys # pthreads to kthreads mapping
+ ln -nsf $(kos_base)/include/kos $(newlib_inc) # so KOS includes are available as kos/file.h
+ ln -nsf $(kos_base)/kernel/arch/dreamcast/include/arch $(newlib_inc) # kos/thread.h requires arch/arch.h
+ ln -nsf $(kos_base)/kernel/arch/dreamcast/include/dc $(newlib_inc) # arch/arch.h requires dc/video.h
+
+$(build_gcc_pass2): log = $(logdir)/$(build)-pass2.log
+$(build_gcc_pass2): logdir
+ @echo "+++ Building $(src_dir) to $(build) (pass 2)..."
+ -mkdir -p $(build)
+ > $(log)
+ cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --with-newlib \
+ --enable-threads=$(thread_model) --enable-languages=c,c++ $(to_log)
+ make -C $(build) all install $(to_log)
+ $(clean_up)
+
+# ---- }}}}
+
+# ---- support {{{
+
+clean:
+ -rm -rf build-newlib-$(sh_target)-$(newlib_ver)
+ -rm -rf build-newlib-$(arm_target)-$(newlib_ver)
+ -rm -rf build-gcc-$(sh_target)-$(gcc_ver)
+ -rm -rf build-gcc-$(arm_target)-$(gcc_ver)
+ -rm -rf build-binutils-$(sh_target)-$(binutils_ver)
+ -rm -rf build-binutils-$(arm_target)-$(binutils_ver)
+
+logdir:
+ @mkdir -p $(logdir)
+
+# If erase=1, erase build directories on the fly.
+ifeq (1,$(erase))
+ define clean_up
+ @echo "+++ Cleaning up $(build)..."
+ -rm -rf $(build)
+ endef
+ # Hack to clean up ARM gcc pass 1
+ define clean_arm_hack
+ @echo "+++ Cleaning up build-gcc-$(arm_target)-$(gcc_ver)..."
+ -rm -rf build-gcc-$(arm_target)-$(gcc_ver)
+ endef
+endif
+
+# If verbose=1, display output to screen as well as log files
+ifeq (1,$(verbose))
+ to_log = 2>&1 | tee -a $(log)
+else
+ to_log = >> $(log) 2>&1
+endif
+
+# ---- }}}
+
+# ---- phony targets {{{
+
+.PHONY: $(patch_targets)
+.PHONY: $(newlib_patches) $(gcc_patches) $(kos_patches)
+.PHONY: all build patch build-sh4 build-arm $(build_sh4_targets) $(build_arm_targets) clean
+.PHONY: build-binutils build-newlib build-gcc-pass1 build-gcc-pass2 fixup-sh4-newlib
+
+# ---- }}}}
+
+# vim:tw=0:fdm=marker:fdc=2:fdl=1
Property changes on: kos/utils/dc-chain/Makefile
___________________________________________________________________
Name: svn:executable
+ *
Added: kos/utils/dc-chain/download.sh
===================================================================
--- kos/utils/dc-chain/download.sh (rev 0)
+++ kos/utils/dc-chain/download.sh 2006-09-18 00:26:35 UTC (rev 369)
@@ -0,0 +1,5 @@
+#!/bin/sh
+wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-2.15.tar.bz2 || exit 1
+wget -c ftp://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2 || exit 1
+wget -c ftp://sources.redhat.com/pub/newlib/newlib-1.12.0.tar.gz || exit 1
+
Property changes on: kos/utils/dc-chain/download.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: kos/utils/dc-chain/patches/gcc-3.4.6.diff
===================================================================
--- kos/utils/dc-chain/patches/gcc-3.4.6.diff (rev 0)
+++ kos/utils/dc-chain/patches/gcc-3.4.6.diff 2006-09-18 00:26:35 UTC (rev 369)
@@ -0,0 +1,299 @@
+diff -ruN gcc-3.4.6/gcc/config/sh/kos.h gcc-3.4.6-kos/gcc/config/sh/kos.h
+--- gcc-3.4.6/gcc/config/sh/kos.h 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.6-kos/gcc/config/sh/kos.h 2006-05-29 12:07:52.000000000 +0200
+@@ -0,0 +1,20 @@
++/* Definition of KOS target on SH for GNU C compiler.
++
++ Copyright (C) 2004 Jim Ursetto
++
++GCC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GCC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GCC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#define SUPPORTS_WEAK 0
+diff -ruN gcc-3.4.6/gcc/config/sh/t-sh gcc-3.4.6-kos/gcc/config/sh/t-sh
+--- gcc-3.4.6/gcc/config/sh/t-sh 2003-06-03 21:01:22.000000000 +0200
++++ gcc-3.4.6-kos/gcc/config/sh/t-sh 2006-05-29 12:07:52.000000000 +0200
+@@ -22,7 +22,7 @@
+ cat $(srcdir)/config/fp-bit.c >> fp-bit.c
+
+ MULTILIB_ENDIAN = ml
+-MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) m2/m2e/m4-single-only/m4-single/m4
++MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) m4-single-only
+ MULTILIB_DIRNAMES=
+ MULTILIB_MATCHES = m2=m3 m2e=m3e m2=m4-nofpu
+ MULTILIB_EXCEPTIONS = ml
+diff -ruN gcc-3.4.6/gcc/config.gcc gcc-3.4.6-kos/gcc/config.gcc
+--- gcc-3.4.6/gcc/config.gcc 2005-07-19 23:08:48.000000000 +0200
++++ gcc-3.4.6-kos/gcc/config.gcc 2006-05-29 12:07:52.000000000 +0200
+@@ -1910,6 +1910,7 @@
+ ;;
+ esac
+ tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/embed-elf.h"
++ tm_file="${tm_file} sh/kos.h"
+ case ${target} in
+ sh64*)
+ tmake_file="${tmake_file} sh/t-sh64"
+diff -ruN gcc-3.4.6/libstdc++-v3/config/cpu/generic/atomicity.h gcc-3.4.6-kos/libstdc++-v3/config/cpu/generic/atomicity.h
+--- gcc-3.4.6/libstdc++-v3/config/cpu/generic/atomicity.h 2004-03-18 18:38:22.000000000 +0100
++++ gcc-3.4.6-kos/libstdc++-v3/config/cpu/generic/atomicity.h 2006-05-29 12:07:52.000000000 +0200
+@@ -28,6 +28,9 @@
+ // the GNU General Public License.
+
+ #include <bits/atomicity.h>
++/* If c++config.h is not included, the _GLIBCXX_ macros won't be brought in
++ * and gthreads will be set to single mode. Bug? */
++#include <bits/c++config.h>
+ #include <bits/concurrence.h>
+
+ namespace __gnu_internal
+diff -ruN gcc-3.4.6/libstdc++-v3/config/cpu/sh4/atomicity.h gcc-3.4.6-kos/libstdc++-v3/config/cpu/sh4/atomicity.h
+--- gcc-3.4.6/libstdc++-v3/config/cpu/sh4/atomicity.h 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.6-kos/libstdc++-v3/config/cpu/sh4/atomicity.h 2006-05-29 12:07:52.000000000 +0200
+@@ -0,0 +1,52 @@
++// Low-level functions for atomic operations: SH4 version -*- C++ -*-
++
++// Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++// Copyright (C) 2004 Jim Ursetto
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++#error SH4 atomicity file incomplete
++#include <bits/atomicity.h>
++
++namespace __gnu_cxx
++{
++ _Atomic_word
++ __attribute__ ((__unused__))
++ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
++ {
++ register _Atomic_word __result;
++ __asm__ __volatile__("");
++ __result = *__mem;
++ *__mem += __val;
++ __asm__ __volatile__("");
++ return __result;
++ }
++
++ void
++ __attribute__ ((__unused__))
++ __atomic_add(volatile _Atomic_word* __mem, int __val)
++ { __exchange_and_add(__mem, __val); }
++} // namespace __gnu_cxx
+diff -ruN gcc-3.4.6/libstdc++-v3/config/cpu/sh4/atomic_word.h gcc-3.4.6-kos/libstdc++-v3/config/cpu/sh4/atomic_word.h
+--- gcc-3.4.6/libstdc++-v3/config/cpu/sh4/atomic_word.h 1970-01-01 01:00:00.000000000 +0100
++++ gcc-3.4.6-kos/libstdc++-v3/config/cpu/sh4/atomic_word.h 2006-05-29 12:07:52.000000000 +0200
+@@ -0,0 +1,35 @@
++// Low-level type for atomic operations -*- C++ -*-
++
++// Copyright (C) 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++#ifndef _GLIBCXX_ATOMIC_WORD_H
++#define _GLIBCXX_ATOMIC_WORD_H 1
++
++typedef int _Atomic_word;
++
++#endif
+diff -ruN gcc-3.4.6/libstdc++-v3/configure gcc-3.4.6-kos/libstdc++-v3/configure
+--- gcc-3.4.6/libstdc++-v3/configure 2005-02-01 07:31:23.000000000 +0100
++++ gcc-3.4.6-kos/libstdc++-v3/configure 2006-05-29 12:07:52.000000000 +0200
+@@ -93503,6 +93503,104 @@
+ _ACEOF
+
+ ;;
++ sh-unknown-elf)
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_ACOSF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_ASINF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_ATAN2F 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_ATANF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_CEILF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_COPYSIGN 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_COPYSIGNF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_COSF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_COSHF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_EXPF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_FABSF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_FLOORF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_FMODF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_FREXPF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_LDEXPF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_LOG10F 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_LOGF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_MODFF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_POWF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_SINF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_SINHF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_SQRTF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_TANF 1
++_ACEOF
++
++ cat >>confdefs.h <<\_ACEOF
++#define HAVE_TANHF 1
++_ACEOF
++
++ ;;
+ *)
+ { { echo "$as_me:$LINENO: error: No support for this host/target combination." >&5
+ echo "$as_me: error: No support for this host/target combination." >&2;}
+diff -ruN gcc-3.4.6/libstdc++-v3/crossconfig.m4 gcc-3.4.6-kos/libstdc++-v3/crossconfig.m4
+--- gcc-3.4.6/libstdc++-v3/crossconfig.m4 2005-02-01 07:31:23.000000000 +0100
++++ gcc-3.4.6-kos/libstdc++-v3/crossconfig.m4 2006-05-29 12:07:52.000000000 +0200
+@@ -503,6 +503,32 @@
+ AC_DEFINE(HAVE_TANHF)
+ AC_DEFINE(HAVE_TANHL)
+ ;;
++ sh-unknown-elf)
++ AC_DEFINE(HAVE_ACOSF)
++ AC_DEFINE(HAVE_ASINF)
++ AC_DEFINE(HAVE_ATAN2F)
++ AC_DEFINE(HAVE_ATANF)
++ AC_DEFINE(HAVE_CEILF)
++ AC_DEFINE(HAVE_COPYSIGN)
++ AC_DEFINE(HAVE_COPYSIGNF)
++ AC_DEFINE(HAVE_COSF)
++ AC_DEFINE(HAVE_COSHF)
++ AC_DEFINE(HAVE_EXPF)
++ AC_DEFINE(HAVE_FABSF)
++ AC_DEFINE(HAVE_FLOORF)
++ AC_DEFINE(HAVE_FMODF)
++ AC_DEFINE(HAVE_FREXPF)
++ AC_DEFINE(HAVE_LDEXPF)
++ AC_DEFINE(HAVE_LOG10F)
++ AC_DEFINE(HAVE_LOGF)
++ AC_DEFINE(HAVE_MODFF)
++ AC_DEFINE(HAVE_POWF)
++ AC_DEFINE(HAVE_SINF)
++ AC_DEFINE(HAVE_SINHF)
++ AC_DEFINE(HAVE_SQRTF)
++ AC_DEFINE(HAVE_TANF)
++ AC_DEFINE(HAVE_TANHF)
++ ;;
+ *)
+ AC_MSG_ERROR([No support for this host/target combination.])
+ ;;
Added: kos/utils/dc-chain/patches/newlib-1.12.0-kos.diff
===================================================================
--- kos/utils/dc-chain/patches/newlib-1.12.0-kos.diff (rev 0)
+++ kos/utils/dc-chain/patches/newlib-1.12.0-kos.diff 2006-09-18 00:26:35 UTC (rev 369)
@@ -0,0 +1,435 @@
+diff -ruN newlib-1.12.0/config-ml.in newlib-1.12.0-kos/config-ml.in
+--- newlib-1.12.0/config-ml.in 2004-01-04 16:42:16.000000000 -0800
++++ newlib-1.12.0-kos/config-ml.in 2004-08-07 09:30:51.000000000 -0700
+@@ -196,19 +196,19 @@
+
+ if [ "${ml_toplevel_p}" = yes ]; then
+
+-multidirs=
+-for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
+- dir=`echo $i | sed -e 's/;.*$//'`
+- if [ "${dir}" = "." ]; then
+- true
+- else
+- if [ -z "${multidirs}" ]; then
+- multidirs="${dir}"
+- else
+- multidirs="${multidirs} ${dir}"
+- fi
+- fi
+-done
++multidirs=ml/m4-single-only
++#for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
++# dir=`echo $i | sed -e 's/;.*$//'`
++# if [ "${dir}" = "." ]; then
++# true
++# else
++# if [ -z "${multidirs}" ]; then
++# multidirs="${dir}"
++# else
++# multidirs="${multidirs} ${dir}"
++# fi
++# fi
++#done
+
+ # Target libraries are configured for the host they run on, so we check
+ # $host here, not $target.
+diff -ruN newlib-1.12.0/newlib/configure.host newlib-1.12.0-kos/newlib/configure.host
+--- newlib-1.12.0/newlib/configure.host 2004-02-02 08:59:51.000000000 -0800
++++ newlib-1.12.0-kos/newlib/configure.host 2004-08-07 10:34:46.000000000 -0700
+@@ -178,6 +178,7 @@
+ ;;
+ sh | sh64)
+ machine_dir=sh
++ newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED -DABORT_PROVIDED -fno-crossjumping -fno-optimize-sibling-calls"
+ ;;
+ sparc*)
+ machine_dir=sparc
+diff -ruN newlib-1.12.0/newlib/libc/sys/sh/ftruncate.c newlib-1.12.0-kos/newlib/libc/sys/sh/ftruncate.c
+--- newlib-1.12.0/newlib/libc/sys/sh/ftruncate.c 2003-07-10 08:31:30.000000000 -0700
++++ newlib-1.12.0-kos/newlib/libc/sys/sh/ftruncate.c 2004-08-07 09:40:01.000000000 -0700
+@@ -2,8 +2,8 @@
+ #include <sys/types.h>
+ #include "sys/syscall.h"
+
+-int
++/* int
+ ftruncate (int file, off_t length)
+ {
+ return __trap34 (SYS_ftruncate, file, length, 0);
+-}
++} */
+diff -ruN newlib-1.12.0/newlib/libc/sys/sh/sys/_types.h newlib-1.12.0-kos/newlib/libc/sys/sh/sys/_types.h
+--- newlib-1.12.0/newlib/libc/sys/sh/sys/_types.h 1969-12-31 16:00:00.000000000 -0800
++++ newlib-1.12.0-kos/newlib/libc/sys/sh/sys/_types.h 2004-08-07 09:22:27.000000000 -0700
+@@ -0,0 +1,42 @@
++/* ANSI C namespace clean utility typedefs */
++
++/* This file defines various typedefs needed by the system calls that support
++ the C library. Basically, they're just the POSIX versions with an '_'
++ prepended. This file lives in the `sys' directory so targets can provide
++ their own if desired (or they can put target dependant conditionals here).
++*/
++
++#ifndef _SYS__TYPES_H
++#define _SYS__TYPES_H
++
++#include "lock.h"
++
++typedef long _off_t;
++__extension__ typedef long long _off64_t;
++
++#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
++typedef int _ssize_t;
++#else
++typedef long _ssize_t;
++#endif
++
++#define __need_wint_t
++#include <stddef.h>
++
++/* Conversion state information. */
++typedef struct
++{
++ int __count;
++ union
++ {
++ wint_t __wch;
++ unsigned char __wchb[4];
++ } __value; /* Value so far. */
++} _mbstate_t;
++
++typedef _LOCK_RECURSIVE_T _flock_t;
++
++/* Iconv descriptor type */
++typedef void *_iconv_t;
++
++#endif /* _SYS__TYPES_H */
+diff -ruN newlib-1.12.0/newlib/libc/sys/sh/sys/lock.h newlib-1.12.0-kos/newlib/libc/sys/sh/sys/lock.h
+--- newlib-1.12.0/newlib/libc/sys/sh/sys/lock.h 1969-12-31 16:00:00.000000000 -0800
++++ newlib-1.12.0-kos/newlib/libc/sys/sh/sys/lock.h 2004-08-07 10:41:28.000000000 -0700
+@@ -0,0 +1,36 @@
++#ifndef __SYS_LOCK_H__
++#define __SYS_LOCK_H__
++
++/* Map everything (approximately) to KOS stuff. Note that if the definition
++ of spinlock_t changes size, or the definition of SPINLOCK_INITIALIZER
++ changes, this will also have to be changed. */
++typedef int _LOCK_T;
++typedef struct { int a, b, c; } _LOCK_RECURSIVE_T;
++
++#define __LOCK_INIT(class,lock) class _LOCK_T lock = 0;
++#define __LOCK_INIT_RECURSIVE(class,lock) class _LOCK_T lock = { 0, 0, 0 };
++#define __lock_init(lock) __newlib_lock_init(&(lock))
++#define __lock_init_recursive(lock) __newlib_lock_init_recursive(&(lock))
++#define __lock_close(lock) __newlib_lock_close(&(lock))
++#define __lock_close_recursive(lock) __newlib_lock_close_recursive(&(lock))
++#define __lock_acquire(lock) __newlib_lock_acquire(&(lock))
++#define __lock_acquire_recursive(lock) __newlib_lock_acquire_recursive(&(lock))
++#define __lock_try_acquire(lock) __newlib_lock_try_acquire(&(lock))
++#define __lock_try_acquire_recursive(lock) __newlib_lock_try_acquire_recursive(&(lock))
++#define __lock_release(lock) __newlib_lock_release(&(lock))
++#define __lock_release_recursive(lock) __newlib_lock_release_recursive(&(lock))
++
++/* These are defined in KOS */
++void __newlib_lock_init(_LOCK_T *);
++void __newlib_lock_close(_LOCK_T *);
++void __newlib_lock_acquire(_LOCK_T *);
++void __newlib_lock_try_acquire(_LOCK_T *);
++void __newlib_lock_release(_LOCK_T *);
++
++void __newlib_lock_init_recursive(_LOCK_RECURSIVE_T *);
++void __newlib_lock_close_recursive(_LOCK_RECURSIVE_T *);
++void __newlib_lock_acquire_recursive(_LOCK_RECURSIVE_T *);
++void __newlib_lock_try_acquire_recursive(_LOCK_RECURSIVE_T *);
++void __newlib_lock_release_recursive(_LOCK_RECURSIVE_T *);
++
++#endif /* __SYS_LOCK_H__ */
+diff -ruN newlib-1.12.0/newlib/libc/sys/sh/syscalls.c newlib-1.12.0-kos/newlib/libc/sys/sh/syscalls.c
+--- newlib-1.12.0/newlib/libc/sys/sh/syscalls.c 2001-02-01 13:25:56.000000000 -0800
++++ newlib-1.12.0-kos/newlib/libc/sys/sh/syscalls.c 2004-08-07 10:24:07.000000000 -0700
+@@ -1,221 +1,2 @@
+-#include <_ansi.h>
+-#include <sys/types.h>
+-#include <sys/stat.h>
+-#include <sys/time.h>
+-#include "sys/syscall.h"
+-int errno;
+-
+-/* This is used by _sbrk. */
+-register char *stack_ptr asm ("r15");
+-
+-int
+-_read (int file,
+- char *ptr,
+- int len)
+-{
+- return __trap34 (SYS_read, file, ptr, len);
+-}
+-
+-int
+-_lseek (int file,
+- int ptr,
+- int dir)
+-{
+- return __trap34 (SYS_lseek, file, ptr, dir);
+-}
+-
+-int
+-_write ( int file,
+- char *ptr,
+- int len)
+-{
+- return __trap34 (SYS_write, file, ptr, len);
+-}
+-
+-int
+-_close (int file)
+-{
+- return __trap34 (SYS_close, file, 0, 0);
+-}
+-
+-int
+-_link (char *old, char *new)
+-{
+- return -1;
+-}
+-
+-caddr_t
+-_sbrk (int incr)
+-{
+- extern char end; /* Defined by the linker */
+- static char *heap_end;
+- char *prev_heap_end;
+-
+- if (heap_end == 0)
+- {
+- heap_end = &end;
+- }
+- prev_heap_end = heap_end;
+- if (heap_end + incr > stack_ptr)
+- {
+- _write (1, "Heap and stack collision\n", 25);
+- abort ();
+- }
+- heap_end += incr;
+- return (caddr_t) prev_heap_end;
+-}
+-
+-int
+-_fstat (int file,
+- struct stat *st)
+-{
+- st->st_mode = S_IFCHR;
+- return 0;
+-}
+-
+-int
+-_open (const char *path,
+- int flags)
+-{
+- return __trap34 (SYS_open, path, flags, 0);
+-}
+-
+-int
+-_creat (const char *path,
+- int mode)
+-{
+- return __trap34 (SYS_creat, path, mode, 0);
+-}
+-
+-int
+-_unlink ()
+-{
+- return -1;
+-}
+-
+-isatty (fd)
+- int fd;
+-{
+- return 1;
+-}
+-
+-_exit (n)
+-{
+- return __trap34 (SYS_exit, n, 0, 0);
+-}
+-
+-_kill (n, m)
+-{
+- return __trap34 (SYS_exit, 0xdead, 0, 0);
+-}
+-
+-_getpid (n)
+-{
+- return 1;
+-}
+-
+-_raise ()
+-{
+-}
+-
+-int
+-_stat (const char *path, struct stat *st)
+-
+-{
+- return __trap34 (SYS_stat, path, st, 0);
+-}
+-
+-int
+-_chmod (const char *path, short mode)
+-{
+- return __trap34 (SYS_chmod, path, mode);
+-}
+-
+-int
+-_chown (const char *path, short owner, short group)
+-{
+- return __trap34 (SYS_chown, path, owner, group);
+-}
+-
+-int
+-_utime (path, times)
+- const char *path;
+- char *times;
+-{
+- return __trap34 (SYS_utime, path, times);
+-}
+-
+-int
+-_fork ()
+-{
+- return __trap34 (SYS_fork);
+-}
+-
+-int
+-_wait (statusp)
+- int *statusp;
+-{
+- return __trap34 (SYS_wait);
+-}
+-
+-int
+-_execve (const char *path, char *const argv[], char *const envp[])
+-{
+- return __trap34 (SYS_execve, path, argv, envp);
+-}
+-
+-int
+-_execv (const char *path, char *const argv[])
+-{
+- return __trap34 (SYS_execv, path, argv);
+-}
+-
+-int
+-_pipe (int *fd)
+-{
+- return __trap34 (SYS_pipe, fd);
+-}
+-
+-/* This is only provided because _gettimeofday_r and _times_r are
+- defined in the same module, so we avoid a link error. */
+-clock_t
+-_times (struct tms *tp)
+-{
+- return -1;
+-}
+-
+-int
+-_gettimeofday (struct timeval *tv, struct timezone *tz)
+-{
+- tv->tv_usec = 0;
+- tv->tv_sec = __trap34 (SYS_time);
+- return 0;
+-}
+-
+-static inline int
+-__setup_argv_for_main (int argc)
+-{
+- char **argv;
+- int i = argc;
+-
+- argv = __builtin_alloca ((1 + argc) * sizeof (*argv));
+-
+- argv[i] = NULL;
+- while (i--) {
+- argv[i] = __builtin_alloca (1 + __trap34 (SYS_argnlen, i));
+- __trap34 (SYS_argn, i, argv[i]);
+- }
+-
+- return main (argc, argv);
+-}
+-
+-int
+-__setup_argv_and_call_main ()
+-{
+- int argc = __trap34 (SYS_argc);
+-
+- if (argc <= 0)
+- return main (argc, NULL);
+- else
+- return __setup_argv_for_main (argc);
+-}
++// This is put in here to cause link errors if a proper newlib isn't present.
++int __newlib_kos_patch = 1;
+diff -ruN newlib-1.12.0/newlib/libc/sys/sh/trap.S newlib-1.12.0-kos/newlib/libc/sys/sh/trap.S
+--- newlib-1.12.0/newlib/libc/sys/sh/trap.S 2002-02-07 23:11:13.000000000 -0800
++++ newlib-1.12.0-kos/newlib/libc/sys/sh/trap.S 2004-08-07 09:39:14.000000000 -0700
+@@ -1,43 +0,0 @@
+-#if __SH5__
+- .mode SHmedia
+-#if __SH5__ == 32 && __SHMEDIA__
+- .section .text..SHmedia32, "ax"
+-#else
+- .text
+-#endif
+- .global ___trap34
+-___trap34:
+- movi 34, r0
+- trapa r0
+- pt/l ret, tr1
+- ptabs/l r18, tr0
+- beqi r1, 0, tr1
+-#if __SH5__ == 64
+- movi ((_errno >> 48) & 65535), r0
+- shori ((_errno >> 32) & 65535), r0
+- shori ((_errno >> 16) & 65535), r0
+-#else
+- movi ((_errno >> 16) & 65535), r0
+-#endif
+- shori (_errno & 65535), r0
+- stx.l r0, r63, r1
+-ret:
+- blink tr0, r63
+-
+-#else
+- .text
+- .global ___trap34
+-___trap34:
+- trapa #34
+- tst r1,r1 ! r1 is errno
+- bt ret
+- mov.l perrno,r2
+- mov.l r1,@r2
+-ret:
+- rts
+- nop
+-
+- .align 2
+-perrno:
+- .long _errno
+-#endif /* ! __SH5__ */
+diff -ruN newlib-1.12.0/newlib/libc/sys/sh/truncate.c newlib-1.12.0-kos/newlib/libc/sys/sh/truncate.c
+--- newlib-1.12.0/newlib/libc/sys/sh/truncate.c 2003-07-10 08:31:30.000000000 -0700
++++ newlib-1.12.0-kos/newlib/libc/sys/sh/truncate.c 2004-08-07 09:39:55.000000000 -0700
+@@ -2,8 +2,8 @@
+ #include <sys/types.h>
+ #include "sys/syscall.h"
+
+-int
++/* int
+ truncate (const char *path, off_t length)
+ {
+ return __trap34 (SYS_truncate, path, length, 0);
+-}
++} */
Added: kos/utils/dc-chain/unpack.sh
===================================================================
--- kos/utils/dc-chain/unpack.sh (rev 0)
+++ kos/utils/dc-chain/unpack.sh 2006-09-18 00:26:35 UTC (rev 369)
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+rm -rf binutils-2.15 gcc-3.4.6 newlib-1.12.0
+
+tar jxf binutils-2.15.tar.bz2 || exit 1
+tar jxf gcc-3.4.6.tar.bz2 || exit 1
+tar zxf newlib-1.12.0.tar.gz || exit 1
Property changes on: kos/utils/dc-chain/unpack.sh
___________________________________________________________________
Name: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|