Noux: update GCC to version 4.6.1

This patch updates GCC to version 4.6.1 and enables tool chain support for
x86_64 and ARM.

Fixes #266.
This commit is contained in:
Christian Prochaska 2012-07-03 12:56:25 +02:00 committed by Norman Feske
parent 7a25bf2d19
commit e39200d8c6
15 changed files with 389 additions and 453 deletions

View File

@ -3,6 +3,6 @@ SPECS += arm
#
# Configure target CPU
#
CC_OPT += -march=armv5
CC_MARCH += -march=armv5
include $(call select_from_repositories,mk/spec-arm.mk)

View File

@ -3,6 +3,6 @@ SPECS += arm
#
# Configure target CPU
#
CC_OPT += -march=armv7-a
CC_MARCH += -march=armv7-a
include $(call select_from_repositories,mk/spec-arm.mk)

View File

@ -33,7 +33,7 @@ NOUX_PKG ?= $(TARGET)
LIBS += cxx env libc libm libc_noux
NOUX_PKG_DIR = $(wildcard $(REP_DIR)/contrib/$(NOUX_PKG)-*)
NOUX_PKG_DIR ?= $(wildcard $(REP_DIR)/contrib/$(NOUX_PKG)-*)
PWD = $(shell pwd)
@ -68,8 +68,15 @@ NOUX_BUILD_OUTPUT_FILTER = 2>&1 | sed "s/^/ [$(NOUX_PKG)] /"
endif
ifeq ($(findstring arm, $(SPECS)), arm)
NOUX_CONFIGURE_ARGS += --host arm-elf-eabi
else
ifeq ($(findstring x86, $(SPECS)), x86)
NOUX_CONFIGURE_ARGS += --host x86_64-elf
endif
endif
NOUX_CONFIGURE_ARGS += --srcdir=$(NOUX_PKG_DIR)
NOUX_CONFIGURE_ARGS += --host x86-freebsd
NOUX_CONFIGURE_ARGS += --prefix $(PWD)/install
CONFIG_GUESS_SCRIPT = $(NOUX_PKG_DIR)/config.guess)
@ -104,9 +111,9 @@ NOUX_LIBS_A = $(filter %.a, $(sort $(LINK_ITEMS)) $(EXT_OBJECTS) $(LIBGCC))
NOUX_LIBS_SO = $(filter %.so,$(sort $(LINK_ITEMS)) $(EXT_OBJECTS) $(LIBGCC))
NOUX_LIBS += $(NOUX_LIBS_A) $(NOUX_LIBS_SO) $(NOUX_LIBS_A)
NOUX_ENV += CC='$(CC)' LD='$(LD)' AR='$(AR)' STRIP='$(STRIP)' LIBS='$(NOUX_LIBS)' \
NOUX_ENV += CC='$(CC)' CXX='$(CXX)' LD='$(LD)' AR='$(AR)' STRIP='$(STRIP)' LIBS='$(NOUX_LIBS)' \
LDFLAGS='$(NOUX_LDFLAGS)' CFLAGS='$(NOUX_CFLAGS)' \
CPPFLAGS='$(NOUX_CPPFLAGS)'
CPPFLAGS='$(NOUX_CPPFLAGS)' CXXFLAGS='$(NOUX_CXXFLAGS)'
NOUX_ENV += CC_FOR_BUILD=gcc LD_FOR_BUILD=ld \
CFLAGS_FOR_BUILD='$(NOUX_CFLAGS_FOR_BUILD)' \
@ -127,6 +134,7 @@ Makefile reconfigure: noux_env.sh
noux_env.sh:
$(VERBOSE)rm -f $@
$(VERBOSE)echo "export CC='$(CC)'" >> $@
$(VERBOSE)echo "export CXX='$(CXX)'" >> $@
$(VERBOSE)echo "export AR='$(AR)'" >> $@
$(VERBOSE)echo "export LD='$(LD)'" >> $@
$(VERBOSE)echo "export CPPFLAGS='$(NOUX_CPPFLAGS)'" >> $@

View File

@ -1,4 +1,4 @@
GCC_VERSION = 4.4.5
GCC_VERSION = 4.6.1
GCC = gcc-$(GCC_VERSION)
GCC_URL = ftp://ftp.fu-berlin.de/gnu/gcc
@ -10,7 +10,7 @@ GCC_CXX_TGZ = gcc-g++-$(GCC_VERSION).tar.gz
#
PORTS += $(GCC)
prepare:: $(CONTRIB_DIR)/$(GCC)
prepare:: $(CONTRIB_DIR)/$(GCC)/configure
#
# Port-specific local rules
@ -22,7 +22,32 @@ $(DOWNLOAD_DIR)/$(GCC_CORE_TGZ):
$(DOWNLOAD_DIR)/$(GCC_CXX_TGZ):
$(VERBOSE)wget -P $(DOWNLOAD_DIR) $(GCC_URL)/$(GCC)/$(GCC_CXX_TGZ) && touch $@
#
# Utilities
#
AUTOCONF = autoconf2.64
#
# Check if 'autoconf' is installed
#
ifeq ($(shell which $(AUTOCONF)),)
$(error Need to have '$(AUTOCONF)' installed.)
endif
#
# Check if 'autogen' is installed
#
ifeq ($(shell which autogen)),)
$(error Need to have 'autogen' installed.)
endif
$(CONTRIB_DIR)/$(GCC): $(DOWNLOAD_DIR)/$(GCC_CORE_TGZ) $(DOWNLOAD_DIR)/$(GCC_CXX_TGZ)
$(VERBOSE)for i in $^ ; do tar xfz $$i -C $(CONTRIB_DIR) ;done
$(VERBOSE)patch -N -p0 < src/noux-pkg/gcc/build.patch
include ../tool/tool_chain_gcc_patches.inc
$(CONTRIB_DIR)/$(GCC)/configure:: $(CONTRIB_DIR)/$(GCC)
@#
@# Noux-specific changes
@#
$(VERBOSE)patch -d $(CONTRIB_DIR)/$(GCC) -N -p1 < src/noux-pkg/gcc/build.patch

View File

@ -1,7 +1,20 @@
if {![have_spec x86_32]} {
puts "\nThe Noux tool chain scenario is supported on the x86_32 architecture only\n"
exit 0
}
#
# Uncomment the following line when working on the binutils source code. Otherwise,
# the package may get recompiled, yet it does not get reinstalled into 'bin/'.
#
#exec rm -rf noux-pkg/binutils bin/binutils
#
# Uncomment the following line when working on the GCC source code. Otherwise,
# the package may get recompiled, yet it does not get reinstalled into 'bin/'.
#
#exec rm -rf noux-pkg/gcc bin/gcc
#
# Uncomment the following line when working on the make source code. Otherwise,
# the package may get recompiled, yet it does not get reinstalled into 'bin/'.
#
#exec rm -rf noux-pkg/make bin/make
set build_components {
core init drivers/timer noux/minimal lib/libc_noux
@ -10,10 +23,27 @@ set build_components {
test/libports/ncurses
}
set cc_march ""
if {[have_spec arm]} {
set binutils "binutils_arm"
set gcc "gcc_arm"
set tool_prefix "genode-arm-"
}
if {[have_spec x86]} {
set binutils "binutils_x86"
set gcc "gcc_x86"
set tool_prefix "genode-x86-"
if {[have_spec x86_32]} {
set cc_march "-m32"
}
}
#
# Build Noux packages only once
#
set noux_pkgs {bash coreutils vim findutils binutils gcc make}
set noux_pkgs "bash coreutils vim findutils make $binutils $gcc"
foreach pkg $noux_pkgs {
lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg }
@ -114,15 +144,22 @@ append config {
<content>
<dir name="tmp">
<inline name="a.c">int main(int argc, char **argv) { return 0; }</inline>
<inline name="Makefile">
<inline name="Makefile"> }
append config "
SHELL=/bin/bash
all:
genode-x86-gcc -v -c a.c -o a.o
${tool_prefix}gcc $cc_march -v -c a.c -o a.o
"
append config {
</inline>
</dir>
<dir name="home">
<dir name="user">
<inline name=".bash_profile">cd /tmp; make; genode-x86-readelf -a a.o</inline>
<inline name=".bash_profile">
cd /tmp; make; }
append config "${tool_prefix}readelf -a a.o"
append config {
</inline>
</dir>
</dir>
</content>
@ -177,7 +214,7 @@ set boot_modules {
core init timer ld.lib.so noux terminal ram_fs
libc.lib.so libm.lib.so libc_noux.lib.so ncurses.lib.so }
append boot_modules { gmp.lib.so mpfr.lib.so }
append boot_modules { gmp.lib.so mpfr.lib.so mpc.lib.so }
foreach pkg $noux_pkgs {
lappend boot_modules "$pkg.tar" }
@ -191,7 +228,11 @@ lappend_if [have_spec pl11x] boot_modules pl11x_drv
build_boot_image $boot_modules
append qemu_args " -m 300 "
if {[have_spec x86_64]} {
append qemu_args " -m 500 "
} else {
append qemu_args " -m 320 "
}
run_genode_until forever

View File

@ -1,9 +1,7 @@
PROGRAM_PREFIX = genode-x86-
NOUX_CFLAGS += -std=c99
NOUX_CONFIGURE_ARGS = --disable-werror \
--program-prefix=$(PROGRAM_PREFIX) \
--target=i686-freebsd
--target=$(BINUTILS_TARGET)
#
# Pass CFLAGS and friends to the invokation of 'make' because
@ -12,4 +10,6 @@ NOUX_CONFIGURE_ARGS = --disable-werror \
#
NOUX_MAKE_ENV = $(NOUX_ENV)
NOUX_PKG_DIR = $(wildcard $(REP_DIR)/contrib/binutils-*)
include $(REP_DIR)/mk/noux.mk

View File

@ -0,0 +1,4 @@
PROGRAM_PREFIX = genode-arm-
BINUTILS_TARGET = arm-elf-eabi
include $(PRG_DIR)/../binutils/target.inc

View File

@ -0,0 +1,4 @@
PROGRAM_PREFIX = genode-x86-
BINUTILS_TARGET = x86_64-elf
include $(PRG_DIR)/../binutils/target.inc

View File

@ -1,52 +1,76 @@
diff -ru contrib/gcc-4.4.5/configure contrib/_gcc-4.4.5/configure
--- contrib/gcc-4.4.5/configure 2010-06-07 22:10:41.000000000 +0200
+++ contrib/gcc-4.4.5/configure 2011-02-10 22:23:18.000000000 +0100
@@ -272,7 +272,7 @@
PACKAGE_BUGREPORT=
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
@@ -155,6 +155,8 @@
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
CXX="$(CXX_FOR_BUILD)"; export CXX; \
CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
+ LIBS="$(LIBS_FOR_BUILD)"; export LIBS; \
GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
GOC="$(GOC_FOR_BUILD)"; export GOC; \
@@ -193,6 +195,8 @@
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
CXX="$(CXX)"; export CXX; \
CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
+ CPPFLAGS="$(CPPFLAGS)"; export CPPFLAGS; \
+ LIBS="$(LIBS)"; export LIBS; \
GCJ="$(GCJ)"; export GCJ; \
GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
GOC="$(GOC)"; export GOC; \
@@ -274,6 +278,7 @@
CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
+ LIBS="$(LIBS_FOR_TARGET)"; export LIBS; \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
GCJ="$(GCJ_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GCJ; \
GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
@@ -543,10 +548,11 @@
CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
CPPFLAGS_FOR_TARGET = @CPPFLAGS_FOR_TARGET@
CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
+CPPFLAGS_FOR_TARGET = @CPPFLAGS_FOR_TARGET@
ac_unique_file="move-if-change"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS TOPLEVEL_CONFIGURE_ARGUMENTS build build_cpu build_vendor build_os build_noncanonical host_noncanonical target_noncanonical host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN LN_S build_libsubdir build_subdir host_subdir target_subdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE do_compare gmplibs gmpinc extra_mpfr_configure_flags ppllibs pplinc clooglibs clooginc stage1_languages SYSROOT_CFLAGS_FOR_TARGET DEBUG_PREFIX_CFLAGS_FOR_TARGET CFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET RPATH_ENVVAR GCC_SHLIB_SUBDIR tooldir build_tooldir CONFIGURE_GDB_TK GDB_TK INSTALL_GDB_TK build_configargs build_configdirs host_configargs configdirs target_configargs AR_FOR_BUILD AS_FOR_BUILD CC_FOR_BUILD CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CXX_FOR_BUILD DLLTOOL_FOR_BUILD GCJ_FOR_BUILD GFORTRAN_FOR_BUILD LDFLAGS_FOR_BUILD LD_FOR_BUILD NM_FOR_BUILD RANLIB_FOR_BUILD WINDMC_FOR_BUILD WINDRES_FOR_BUILD config_shell YACC BISON M4 LEX FLEX MAKEINFO EXPECT RUNTEST AR AS DLLTOOL LD LIPO NM RANLIB STRIP WINDRES WINDMC OBJCOPY OBJDUMP CC_FOR_TARGET CXX_FOR_TARGET GCC_FOR_TARGET GCJ_FOR_TARGET GFORTRAN_FOR_TARGET AR_FOR_TARGET AS_FOR_TARGET DLLTOOL_FOR_TARGET LD_FOR_TARGET LIPO_FOR_TARGET NM_FOR_TARGET OBJDUMP_FOR_TARGET RANLIB_FOR_TARGET STRIP_FOR_TARGET WINDRES_FOR_TARGET WINDMC_FOR_TARGET RAW_CXX_FOR_TARGET FLAGS_FOR_TARGET COMPILER_AS_FOR_TARGET COMPILER_LD_FOR_TARGET COMPILER_NM_FOR_TARGET MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT stage1_cflags stage1_checking stage2_werror_flag datarootdir docdir pdfdir htmldir LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS TOPLEVEL_CONFIGURE_ARGUMENTS build build_cpu build_vendor build_os build_noncanonical host_noncanonical target_noncanonical host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN LN_S build_libsubdir build_subdir host_subdir target_subdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE do_compare gmplibs gmpinc extra_mpfr_configure_flags ppllibs pplinc clooglibs clooginc stage1_languages SYSROOT_CFLAGS_FOR_TARGET DEBUG_PREFIX_CFLAGS_FOR_TARGET CFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET LDFLAGS_FOR_TARGET RPATH_ENVVAR GCC_SHLIB_SUBDIR tooldir build_tooldir CONFIGURE_GDB_TK GDB_TK INSTALL_GDB_TK build_configargs build_configdirs host_configargs configdirs target_configargs AR_FOR_BUILD AS_FOR_BUILD CC_FOR_BUILD CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CXX_FOR_BUILD DLLTOOL_FOR_BUILD GCJ_FOR_BUILD GFORTRAN_FOR_BUILD LDFLAGS_FOR_BUILD LD_FOR_BUILD NM_FOR_BUILD RANLIB_FOR_BUILD WINDMC_FOR_BUILD WINDRES_FOR_BUILD config_shell YACC BISON M4 LEX FLEX MAKEINFO EXPECT RUNTEST AR AS DLLTOOL LD LIPO NM RANLIB STRIP WINDRES WINDMC OBJCOPY OBJDUMP CC_FOR_TARGET CXX_FOR_TARGET GCC_FOR_TARGET GCJ_FOR_TARGET GFORTRAN_FOR_TARGET AR_FOR_TARGET AS_FOR_TARGET DLLTOOL_FOR_TARGET LD_FOR_TARGET LIPO_FOR_TARGET NM_FOR_TARGET OBJDUMP_FOR_TARGET RANLIB_FOR_TARGET STRIP_FOR_TARGET WINDRES_FOR_TARGET WINDMC_FOR_TARGET RAW_CXX_FOR_TARGET FLAGS_FOR_TARGET COMPILER_AS_FOR_TARGET COMPILER_LD_FOR_TARGET COMPILER_NM_FOR_TARGET MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT stage1_cflags stage1_checking stage2_werror_flag datarootdir docdir pdfdir htmldir LIBOBJS LTLIBOBJS'
ac_subst_files='serialization_dependencies host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag'
ac_pwd=`pwd`
LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
-LDFLAGS_FOR_TARGET =
+LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
GOCFLAGS_FOR_TARGET = -O2 -g
@@ -13262,7 +13262,9 @@
s,@SYSROOT_CFLAGS_FOR_TARGET@,$SYSROOT_CFLAGS_FOR_TARGET,;t t
s,@DEBUG_PREFIX_CFLAGS_FOR_TARGET@,$DEBUG_PREFIX_CFLAGS_FOR_TARGET,;t t
s,@CFLAGS_FOR_TARGET@,$CFLAGS_FOR_TARGET,;t t
+s,@LDFLAGS_FOR_TARGET@,$LDFLAGS_FOR_TARGET,;t t
s,@CXXFLAGS_FOR_TARGET@,$CXXFLAGS_FOR_TARGET,;t t
+s,@CPPFLAGS_FOR_TARGET@,$CPPFLAGS_FOR_TARGET,;t t
s,@RPATH_ENVVAR@,$RPATH_ENVVAR,;t t
s,@GCC_SHLIB_SUBDIR@,$GCC_SHLIB_SUBDIR,;t t
s,@tooldir@,$tooldir,;t t
diff -ru contrib/gcc-4.4.5/gcc/config.gcc contrib/_gcc-4.4.5/gcc/config.gcc
--- contrib/gcc-4.4.5/gcc/config.gcc 2010-06-14 00:16:50.000000000 +0200
+++ contrib/gcc-4.4.5/gcc/config.gcc 2011-02-06 22:45:54.000000000 +0100
@@ -456,7 +456,7 @@
# pleases around the provided core setting.
gas=yes
gnu_ld=yes
- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
+ extra_parts=
fbsd_major=`echo ${target} | sed -e 's/.*freebsd//g' | sed -e 's/\..*//g'`
tm_defines="${tm_defines} FBSD_MAJOR=${fbsd_major}"
tmake_file="t-slibgcc-elf-ver t-freebsd"
diff -ru contrib/gcc-4.4.5/gcc/configure contrib/_gcc-4.4.5/gcc/configure
--- contrib/gcc-4.4.5/gcc/configure 2010-06-20 17:43:53.000000000 +0200
+++ contrib/gcc-4.4.5/gcc/configure 2011-02-06 00:01:27.000000000 +0100
@@ -13531,6 +13531,7 @@
saved_CFLAGS="${CFLAGS}"
CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+ LIBS="${LIBS_FOR_BUILD}" CPPFLAGS="${CPPFLAGS_FOR_BUILD}" \
${realsrcdir}/configure \
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias
diff -ru contrib/gcc-4.4.5/gcc/Makefile.in contrib/_gcc-4.4.5/gcc/Makefile.in
--- contrib/gcc-4.4.5/gcc/Makefile.in 2010-09-07 13:07:31.000000000 +0200
+++ contrib/gcc-4.4.5/gcc/Makefile.in 2011-02-06 00:59:25.000000000 +0100
@@ -695,7 +695,7 @@
FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
@@ -741,6 +747,7 @@
"LD_FOR_TARGET=$(LD_FOR_TARGET)" \
"LIPO_FOR_TARGET=$(LIPO_FOR_TARGET)" \
"LDFLAGS_FOR_TARGET=$(LDFLAGS_FOR_TARGET)" \
+ "LIBS_FOR_TARGET=$(LIBS_FOR_TARGET)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"LIBCXXFLAGS_FOR_TARGET=$(LIBCXXFLAGS_FOR_TARGET)" \
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
@@ -835,6 +842,7 @@
'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
+ 'CPPFLAGS=$$(CPPFLAGS_FOR_TARGET)' \
'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -639,6 +639,7 @@
CXXFLAGS_FOR_TARGET
CFLAGS_FOR_TARGET
CPPFLAGS_FOR_TARGET
+LDFLAGS_FOR_TARGET
DEBUG_PREFIX_CFLAGS_FOR_TARGET
SYSROOT_CFLAGS_FOR_TARGET
stage1_languages
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -770,7 +770,7 @@
# Native linker and preprocessor flags. For x-fragment overrides.
BUILD_LDFLAGS=@BUILD_LDFLAGS@
@ -55,75 +79,25 @@ diff -ru contrib/gcc-4.4.5/gcc/Makefile.in contrib/_gcc-4.4.5/gcc/Makefile.in
# Actual name to use when installing a native compiler.
GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
diff -ru contrib/gcc-4.4.5/libstdc++-v3/Makefile.in contrib/_gcc-4.4.5/libstdc++-v3/Makefile.in
--- contrib/gcc-4.4.5/libstdc++-v3/Makefile.in 2010-04-29 17:03:38.000000000 +0200
+++ contrib/gcc-4.4.5/libstdc++-v3/Makefile.in 2011-02-10 22:44:08.000000000 +0100
@@ -309,7 +309,7 @@
@@ -1035,8 +1035,8 @@
# -I/-D flags to pass when compiling.
AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
-@GLIBCXX_HOSTED_TRUE@hosted_source = doc src po testsuite
+@GLIBCXX_HOSTED_TRUE@hosted_source = doc po testsuite
SUBDIRS = include libsupc++ $(hosted_source)
ACLOCAL_AMFLAGS = -I . -I .. -I ../config
diff -ru contrib/gcc-4.4.5/Makefile.in contrib/_gcc-4.4.5/Makefile.in
--- contrib/gcc-4.4.5/Makefile.in 2009-04-25 06:10:29.000000000 +0200
+++ contrib/gcc-4.4.5/Makefile.in 2011-02-10 22:13:17.000000000 +0100
@@ -140,6 +140,8 @@
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
CXX="$(CXX_FOR_BUILD)"; export CXX; \
CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
+ LIBS="$(LIBS_FOR_BUILD)"; export LIBS; \
GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
@@ -175,6 +177,8 @@
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
CXX="$(CXX)"; export CXX; \
CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
+ CPPFLAGS="$(CPPFLAGS)"; export CPPFLAGS; \
+ LIBS="$(LIBS)"; export LIBS; \
AR="$(AR)"; export AR; \
AS="$(AS)"; export AS; \
CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
@@ -232,6 +236,7 @@
CFLAGS="$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
+ LIBS="$(LIBS_FOR_TARGET)"; export LIBS; \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; \
GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
@@ -413,12 +418,13 @@
CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
+CPPFLAGS_FOR_TARGET = @CPPFLAGS_FOR_TARGET@
SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
-LDFLAGS_FOR_TARGET =
+LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
# ------------------------------------
# Miscellaneous targets and flag lists
@@ -575,6 +581,7 @@
"LD_FOR_TARGET=$(LD_FOR_TARGET)" \
"LIPO_FOR_TARGET=$(LIPO_FOR_TARGET)" \
"LDFLAGS_FOR_TARGET=$(LDFLAGS_FOR_TARGET)" \
+ "LIBS_FOR_TARGET=$(LIBS_FOR_TARGET)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"LIBCXXFLAGS_FOR_TARGET=$(LIBCXXFLAGS_FOR_TARGET)" \
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
@@ -642,6 +649,7 @@
'CFLAGS=$$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
'CXX=$$(CXX_FOR_TARGET)' \
'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
+ 'CPPFLAGS=$$(CPPFLAGS_FOR_TARGET)' \
'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
'LD=$(COMPILER_LD_FOR_TARGET)' \
'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
# How to link with both our special library facilities
# and the system's installed libraries.
-LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) \
- $(HOST_LIBS)
+LIBS = $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) \
+ $(HOST_LIBS) @LIBS@
BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
$(ZLIB)
# Any system libraries needed just for GNAT.
diff --git a/gcc/configure b/gcc/configure
--- a/gcc/configure
+++ b/gcc/configure
@@ -10898,6 +10898,7 @@
saved_CFLAGS="${CFLAGS}"
CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+ LIBS="${LIBS_FOR_BUILD}" CPPFLAGS="${CPPFLAGS_FOR_BUILD}" \
${realsrcdir}/configure \
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias

View File

@ -0,0 +1,70 @@
PWD = $(shell pwd)
NOUX_CONFIGURE_ARGS = --program-prefix=$(PROGRAM_PREFIX) \
--target=$(GCC_TARGET) \
--with-gnu-as --with-gnu-ld --disable-tls --disable-threads --disable-lto \
--disable-multilib --disable-shared
#
# Configure options passed to gcc
#
# The 't-linux' tmake file is needed to let the tool chain use 'unwind-dw2-fde-glibc',
# needed for the exception handling on Genode in the presence of shared libraries.
#
HOST_CONFIG_ARGS = host_xm_include_list=$(LINK_SPEC_H_$(PLATFORM)) \
tmake_file='t-slibgcc-elf-ver t-slibgcc-nolc-override t-linux'
# passed to target components such as libgcc, libstdc++
TARGET_CONFIG_ARGS = extra_parts='crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o'
# compile libsupc++ as position-independent code
TARGET_CONFIG_ARGS += LIBSUPCXX_PICFLAGS='-prefer-pic'
NOUX_ENV += host_configargs="$(HOST_CONFIG_ARGS)" \
target_configargs="$(TARGET_CONFIG_ARGS)"
NOUX_ENV += CC_FOR_TARGET=$(CC) CXX_FOR_TARGET=$(CXX) GCC_FOR_TARGET=$(CC) CPP_FOR_TARGET="$(CC) -E" \
LD_FOR_TARGET=$(LD) AS_FOR_TARGET=$(AS) AR_FOR_TARGET=$(AR)
#
# Need to specify LDFLAGS_FOR_TARGET as configure argument, not just as
# environment variable. Otherwise, the generated Makefile will set 'LDFLAGS_FOR_TARGET'
# to empty, target libraries will fail to build.
#
NOUX_ENV += LDFLAGS_FOR_TARGET='$(NOUX_LDFLAGS)'
NOUX_ENV += CPPFLAGS_FOR_TARGET='$(NOUX_CPPFLAGS)'
NOUX_ENV += CXXFLAGS_FOR_TARGET='$(NOUX_CXXFLAGS)'
#
# We link libraries to the final binaries using the 'LIBS' variable. But
# unfortunately, the gcc build system has hardcoded some libs such as '-lc'.
# To satisfy the linker, we provide dummy archives.
#
LIBS = gmp mpfr mpc
NOUX_LDFLAGS += -L$(PWD)
.SECONDARY: dummy_libs
dummy_libs: libgmp.a libmpfr.a libmpc.a libc.a
libgmp.a libmpfr.a libmpc.a libc.a:
$(VERBOSE)$(AR) -rc $@
Makefile: dummy_libs
LIBS += cxx env libc libm libc_noux
NOUX_PKG_DIR = $(wildcard $(REP_DIR)/contrib/gcc-*)
include $(REP_DIR)/mk/noux.mk
NOUX_CXXFLAGS += -ffunction-sections $(CC_OLEVEL) -nostdlib $(NOUX_CPPFLAGS)
#
# We have to specify 'LINK_ITEMS' twice to resolve inter-library dependencies.
# Unfortunately, the use of '--start-group' and '--end-group' does not suffice
# in all cases because 'libtool' strips those arguments from the 'LIBS' variable.
#
NOUX_LIBS += -Wl,--start-group $(sort $(LINK_ITEMS)) $(sort $(LINK_ITEMS)) $(LIBGCC) -Wl,--end-group

View File

@ -1,207 +0,0 @@
PROGRAM_PREFIX = genode-x86-
REQUIRES = x86_32
PWD = $(shell pwd)
NOUX_CFLAGS += -std=c99 -fgnu89-inline
NOUX_CONFIGURE_ARGS = --program-prefix=$(PROGRAM_PREFIX) \
--target=i686-freebsd \
--with-gnu-as --with-gnu-ld --disable-tls --disable-threads \
--disable-multilib --disable-shared
# prevent building libgomp (OpenMP) and libmudflap (pointer debugging facility)
NOUX_CONFIGURE_ARGS += enable_libmudflap=no enable_libgomp=no
# needed by gcc/config/freebsd-spec.h
NOUX_CFLAGS_FOR_BUILD += -DFBSD_MAJOR=6
NOUX_CFLAGS += -DFBSD_MAJOR=6
# work-around for the following error while building libgcc
#
# libgcc2.h:172: error: unknown machine mode libgcc_cmp_return
# libgcc2.h:173: error: unknown machine mode libgcc_shift_count
NOUX_CFLAGS += -D__libgcc_cmp_return__=word -D__libgcc_shift_count__=word -D__unwind_word__=word
NOUX_CXXFLAGS += -D__libgcc_cmp_return__=word -D__libgcc_shift_count__=word -D__unwind_word__=word
# define __SIZEOF_* macros as required by unwind-dw2.c:
#
# unwind.h:242:4: error: #error "__SIZEOF_LONG__ macro not defined"
NOUX_CFLAGS += -D__SIZEOF_LONG__=4 -D__SIZEOF_POINTER__=4
NOUX_CXXFLAGS += -D__SIZEOF_LONG__=4 -D__SIZEOF_POINTER__=4
NOUX_ENV += CC_FOR_TARGET=$(CC) CXX_FOR_TARGET=$(CXX) GCC_FOR_TARGET=$(CC) \
LD_FOR_TARGET=$(LD) AS_FOR_TARGET=$(AS) AR_FOR_TARGET=$(AR)
NOUX_ENV += CC_FOR_BUILD=gcc LD_FOR_BUILD=ld \
CFLAGS_FOR_BUILD='$(NOUX_CFLAGS_FOR_BUILD)' \
CPPFLAGS_FOR_BUILD='' LDFLAGS_FOR_BUILD=''
#
# Need to specify LDFLAGS_FOR_TARGET as configure argument, not just as
# environment variable. Otherwise, the generated Makefile will set 'LDFLAGS_FOR_TARGET'
# to empty, target libraries will fail to build.
#
NOUX_ENV += LDFLAGS_FOR_TARGET='$(NOUX_LDFLAGS)'
NOUX_ENV += CPPFLAGS_FOR_TARGET='$(NOUX_CPPFLAGS)'
NOUX_ENV += CXXFLAGS_FOR_TARGET='$(NOUX_CXXFLAGS)'
#
# We link libraries to the final binaries using the 'LIBS' variable. But
# unfortunately, the gcc build system has hardcoded some libs such as '-lc'.
# To satisfy the linker, we provide dummy archives.
#
LIBS = gmp mpfr
NOUX_LDFLAGS += -L$(PWD)
dummy_libs: libgmp.a libmpfr.a libc.a
libgmp.a libmpfr.a libc.a:
$(VERBOSE)$(AR) -rc $@
Makefile: dummy_libs
#
# XXX Merge the following with noux.mk
#
TARGET ?= $(lastword $(subst /, ,$(PRG_DIR)))
NOUX_PKG ?= $(TARGET)
LIBS += cxx env libc libm libc_noux
NOUX_PKG_DIR = $(wildcard $(REP_DIR)/contrib/$(NOUX_PKG)-*)
#
# Detect missing preparation of noux package
#
ifeq ($(NOUX_PKG_DIR),)
REQUIRES += prepare_$(NOUX_PKG)
endif
#
# Verbose build
#
ifeq ($(VERBOSE),)
NOUX_MAKE_VERBOSE = V=1
NOUX_CONFIGURE_VERBOSE =
#
# Non-verbose build
#
else
NOUX_MAKE_VERBOSE = -s
NOUX_CONFIGURE_VERBOSE = --quiet
# filter for configure output of noux package
NOUX_CONFIGURE_OUTPUT_FILTER = > stdout.log 2> stderr.log ||\
(echo "Error: configure script of $(NOUX_PKG) failed" && \
cat stderr.log && false)
# filter for make output of noux package
NOUX_BUILD_OUTPUT_FILTER = 2>&1 | sed "s/^/ [$(NOUX_PKG)] /"
endif
NOUX_CONFIGURE_ARGS += --host x86-freebsd --build $(shell $(NOUX_PKG_DIR)/config.guess)
NOUX_CONFIGURE_ARGS += --prefix $(PWD)/install
NOUX_CONFIGURE_ARGS += $(NOUX_CONFIGURE_VERBOSE)
NOUX_CONFIGURE_ARGS += --srcdir=$(NOUX_PKG_DIR)
NOUX_LDFLAGS += -nostdlib $(CXX_LINK_OPT) $(CC_MARCH) -Wl,-T$(LD_SCRIPT_DYN) \
-Wl,--dynamic-linker=$(DYNAMIC_LINKER).lib.so \
-Wl,--eh-frame-hdr
LIBGCC = $(shell $(CC) $(CC_MARCH) -print-libgcc-file-name)
NOUX_CPPFLAGS += -nostdinc $(INCLUDES)
NOUX_CPPFLAGS += -D_GNU_SOURCE=1
NOUX_CPPFLAGS += $(CC_MARCH)
NOUX_CFLAGS += -ffunction-sections $(CC_OLEVEL) -nostdlib $(NOUX_CPPFLAGS)
NOUX_CXXFLAGS += -ffunction-sections $(CC_OLEVEL) -nostdlib $(NOUX_CPPFLAGS)
#
# We have to specify 'LINK_ITEMS' twice to resolve inter-library dependencies.
# Unfortunately, the use of '--start-group' and '--end-group' does not suffice
# in all cases because 'libtool' strips those arguments from the 'LIBS' variable.
#
NOUX_LIBS += -Wl,--start-group $(sort $(LINK_ITEMS)) $(sort $(LINK_ITEMS)) $(LIBGCC) -Wl,--end-group
NOUX_ENV += CC='$(CC)' LD='$(LD)' AR='$(AR)' LIBS='$(NOUX_LIBS)' \
LDFLAGS='$(NOUX_LDFLAGS)' CFLAGS='$(NOUX_CFLAGS)' \
CPPFLAGS='$(NOUX_CPPFLAGS)' CXXFLAGS='$(NOUX_CXXFLAGS)'
#
# Re-configure the Makefile if the Genode build environment changes
#
Makefile reconfigure: $(MAKEFILE_LIST)
#
# Invoke configure script with the Genode environment
#
Makefile reconfigure: noux_env.sh
@$(MSG_CONFIG)$(TARGET)
$(VERBOSE)source noux_env.sh && $(NOUX_PKG_DIR)/configure $(NOUX_ENV) $(NOUX_CONFIGURE_ARGS) $(NOUX_CONFIGURE_OUTPUT_FILTER)
noux_env.sh:
$(VERBOSE)rm -f $@
$(VERBOSE)echo "export CC='$(CC)'" >> $@
$(VERBOSE)echo "export AR='$(AR)'" >> $@
$(VERBOSE)echo "export LD='$(LD)'" >> $@
$(VERBOSE)echo "export CPPFLAGS='$(NOUX_CPPFLAGS)'" >> $@
$(VERBOSE)echo "export CFLAGS='$(NOUX_CFLAGS)'" >> $@
$(VERBOSE)echo "export CXXFLAGS='$(NOUX_CXXFLAGS)'" >> $@
$(VERBOSE)echo "export LDFLAGS='$(NOUX_LDFLAGS)'" >> $@
$(VERBOSE)echo "export LIBS='$(NOUX_LIBS)'" >> $@
$(VERBOSE)echo "export CC_FOR_TARGET='$(CC)'" >> $@
$(VERBOSE)echo "export CXX_FOR_TARGET='$(CXX)'" >> $@
$(VERBOSE)echo "export GCC_FOR_TARGET='$(CC)'" >> $@
$(VERBOSE)echo "export LD_FOR_TARGET='$(LD)'" >> $@
$(VERBOSE)echo "export AS_FOR_TARGET='$(AS)'" >> $@
$(VERBOSE)echo "export AR_FOR_TARGET='$(AR)'" >> $@
$(VERBOSE)echo "export LDFLAGS_FOR_TARGET='$(NOUX_LDFLAGS)'" >> $@
$(VERBOSE)echo "export LIBS_FOR_TARGET='$(NOUX_LIBS)'" >> $@
$(VERBOSE)echo "export CFLAGS_FOR_BUILD='$(NOUX_CFLAGS_FOR_BUILD)'" >> $@
$(VERBOSE)echo "export CPPFLAGS_FOR_BUILD=''" >> $@
$(VERBOSE)echo "export LDFLAGS_FOR_BUILD=''" >> $@
$(VERBOSE)echo "export LIBS_FOR_BUILD=''" >> $@
$(VERBOSE)echo "export PS1='<noux>'" >> $@
#
# Invoke the 'Makefile' generated by the configure script
#
# The 'MAN=' argument prevent manual pages from being created. This would
# produce an error when the package uses the 'help2man' tool. This tool
# tries to extract the man page of a program by executing it with the
# '--help' argument on the host. However, we cannot run Genode binaries
# this way.
#
noux_built.tag: noux_env.sh Makefile
@$(MSG_BUILD)$(TARGET)
$(VERBOSE)source noux_env.sh && $(MAKE) $(NOUX_MAKE_ENV) $(NOUX_MAKE_VERBOSE) MAN= $(NOUX_BUILD_OUTPUT_FILTER)
@touch $@
noux_installed.tag: noux_built.tag
@$(MSG_INST)$(TARGET)
$(VERBOSE)$(MAKE) $(NOUX_MAKE_VERBOSE) install MAN= >> stdout.log 2>> stderr.log
$(VERBOSE)rm -f $(INSTALL_DIR)/$(TARGET)
$(VERBOSE)ln -sf $(PWD)/install $(INSTALL_DIR)/$(TARGET)
@touch $@
$(TARGET): noux_installed.tag
#
# The clean rule is expected to be executed within the 3rd-party build
# directory. The check should prevent serious damage if this condition
# is violated (e.g., while working on the build system).
#
ifeq ($(notdir $(PWD)),$(notdir $(PRG_DIR)))
clean_noux_build_dir:
$(VERBOSE)rm -rf $(PWD)
clean_prg_objects: clean_noux_build_dir
endif

View File

@ -0,0 +1,7 @@
PROGRAM_PREFIX = genode-arm-
GCC_TARGET = arm-elf-eabi
# cross-compiling does not work yet
REQUIRES = arm
include $(PRG_DIR)/../gcc/target.inc

View File

@ -0,0 +1,7 @@
PROGRAM_PREFIX = genode-x86-
GCC_TARGET = x86_64-elf
# cross-compiling does not work yet
REQUIRES = x86
include $(PRG_DIR)/../gcc/target.inc

View File

@ -41,7 +41,7 @@ MAKE_OPT ?= -j4
# 'create_builddir' tool within the Genode source tree
#
GENODE_DIR ?= $(realpath $(dir $(MAKEFILE_LIST))/..)
GENODE_DIR ?= $(realpath $(dir $(firstword $(MAKEFILE_LIST)))/..)
#
# Download locations
@ -337,115 +337,13 @@ $(CONTRIB_DIR)/mpc-$(MPC_VERSION)/configure: $(DOWNLOAD_DIR)/mpc-$(MPC_VERSION).
$(ECHO) "$(BRIGHT_COL)unpacking mpc...$(DEFAULT_COL)"
$(VERBOSE)tar xfz $< -C $(CONTRIB_DIR)
$(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure: $(addprefix $(DOWNLOAD_DIR)/,gcc-core-$(GCC_VERSION).tar.bz2 gcc-g++-$(GCC_VERSION).tar.bz2)
$(CONTRIB_DIR)/gcc-$(GCC_VERSION): $(addprefix $(DOWNLOAD_DIR)/,gcc-core-$(GCC_VERSION).tar.bz2 gcc-g++-$(GCC_VERSION).tar.bz2)
$(ECHO) "$(BRIGHT_COL)unpacking gcc and g++...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(CONTRIB_DIR)
$(VERBOSE)for i in $^ ; do tar xfj $$i -C $(CONTRIB_DIR) ;done
$(VERBOSE)touch $@
$(ECHO) "$(BRIGHT_COL)patching gcc build system...$(DEFAULT_COL)"
@#
@# Enable support for passing custom 'tmake_file' and 'extra_parts' to the
@# GCC configure process uncommenting the default initialization of the
@# respective variables. The 'extra_parts' variable is used to carry the
@# the information about which crtN files are to be created.
@#
@# The 't-386elf' file must the treated to prevent it from defining the
@# 'EXTRA_PARTS' variable. If defined, the 'libgcc' Makefile would prepare
@# it against our custom list of 'extra_parts' and consequently fail.
@#
$(VERBOSE)sed -i "/^tmake_file=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config.gcc
$(VERBOSE)sed -i "/^extra_parts=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config.gcc
$(VERBOSE)sed -i "/^extra_parts=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libgcc/config.host
$(VERBOSE)sed -i "/^EXTRA_PARTS=/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config/i386/t-i386elf
$(VERBOSE)sed -i "/^EXTRA_MULTILIB_PARTS *=/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config/arm/t-arm-elf
@#
@# Let 'config.gcc' expand our already populated 'tmake_file' variable rather
@# than making a hard assignment. This is needed for the ARM platform because
@# the target 'arm-elf-eabi' actually matches the pattern 'arm-*-*-eabi' in
@# the 'config.gcc' file.
@#
$(VERBOSE)sed -i "/tmake_file=\"arm/s/=\"/=\"\$${tmake_file} /" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config.gcc
@#
@# Enable LINK_SPEC customization via configure arguments
@#
@# We add a hook for sneaking our custom LINK_SPEC definition into the GCC
@# configure process by uncommentig the 'host_xm_include_list'. This enables us
@# to supply a custom header file to be included into 'gcc/config.h' defining
@# the 'LINK_SPEC' macro. This macro expresses the policy of how the GCC
@# frontend invokes 'ld' on multiarch platforms. I.e., on x86, we need to pass
@# '-melf_i386' to 'ld' when building in '-m32' mode.
@#
$(VERBOSE)sed -i "/^host_xm_include_list=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/configure.ac
@#
@# Make sure to disable the 'inhibit_libc' flag, which is evaluated when
@# compiling libgcc. When libc is inhibited, the 'unwind-dw2-fde-glibc.c'
@# is not using the "new" glibc exception handling mechanism. However,
@# Genode's dynamic linker relies on this mechanism.
@#
$(VERBOSE)sed -i "/inhibit_libc=true/s/true/false # was true/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/configure.ac
@#
@# Accept prepopulation of 'host_configargs' and 'target_configargs' as
@# configure argument (only needed for gcc-4.4.5, fixed with later versions)
@#
$(VERBOSE)sed -i "/host_configargs=.--cache-file/s/=./=\"\$$host_configargs /" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac
$(VERBOSE)sed -i "/target_configargs=..baseargs/s/=.*/=\"\$$target_configargs \$${baseargs}\"/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac
@#
@# Allow customization of CPPFLAGS_FOR_TARGET, not supported by the original
@# GCC config and build system.
@#
$(VERBOSE)sed -i "/^CXXFLAGS_FOR_TARGET =/s/^/CPPFLAGS_FOR_TARGET = @CPPFLAGS_FOR_TARGET@\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl
$(VERBOSE)sed -i "/AC_SUBST(CFLAGS_FOR_TARGET)/s/^/AC_SUBST(CPPFLAGS_FOR_TARGET)\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac
@#
@# Fix the handling of CPP_FOR_TARGET. Without the fix, the configure script
@# of libgcc tries to use the normal 'cpp' for executing preprocessor tests,
@# which produces bogus results.
@#
$(VERBOSE)sed -i "/CC=.*XGCC.*export CC/s/^/ CPP=\"\$$(CPP_FOR_TARGET) \$$(XGCC_FLAGS_FOR_TARGET) \$$\$$TFLAGS\"; export CPP; \\\\\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl
$(VERBOSE)sed -i "/^CC_FOR_TARGET=/s/^/CPP_FOR_TARGET=\$$(STAGE_CC_WRAPPER) @CPP_FOR_TARGET@\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl
$(VERBOSE)sed -i "/CC=.*XGCC.*TFLAGS....$$/s/^/ 'CPP=\$$\$$(CPP_FOR_TARGET) \$$\$$(XGCC_FLAGS_FOR_TARGET) \$$\$$(TFLAGS)' \\\\\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl
$(VERBOSE)sed -i "/flag= CC_FOR_TARGET/s/^/flags_to_pass = { flag= CPP_FOR_TARGET ; };\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.def
$(VERBOSE)sed -i "/^GCC_TARGET_TOOL.cc,/s/^/GCC_TARGET_TOOL(cpp, CPP_FOR_TARGET, CPP, \[gcc\/cpp -B\$$\$$r\/\$$(HOST_SUBDIR)\/gcc\/\])\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac
@#
@# Ensure -fno-short-enums as default.
@#
$(VERBOSE)sed -i "s/return TARGET_AAPCS_BASED && arm_abi != ARM_ABI_AAPCS_LINUX/return false/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config/arm/arm.c
@#
@# Remove sanity check for host/target combination in configure script of
@# libstdc++. An alternative fix would be the addition of a new host or
@# the use of an existing one. However, adding a new host would require
@# us to maintain a larger patch to the GCC build system, and using an
@# existing host comes with all the (possibly unwanted) policies associated
@# with the respective host platform. We want to stick with the bare-bone
@# compiler as much as possible.
@#
$(VERBOSE)sed -i "/No support for this host.target combination/d" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3/crossconfig.m4
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3; $(AUTOCONF)
@#
@# Allow passing of PICFLAGS to the configure script of libstdc++.
@# Without this change, libsupc++ would be compiled w/o PICFLAGS, resulting
@# in text relocations. Because for base tool chains, no 'dynamic_linker'
@# is defined (see 'libtool.m4'), 'dynamic_linker' is set to 'no', which
@# results in 'can_build_shared = no', which, in turn , results
@# in 'enable_shared = no', which, in turn, sets 'LIBSUPCXX_PICFLAGS' to
@# nothing rather then '-prefer-pic'.
@#
$(VERBOSE)sed -i "/LIBSUPCXX_PICFLAGS=$$/s/LIB/__LIB/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3/configure.ac
@#
@# Re-generate configure scripts
@#
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION); autogen Makefile.def
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libgcc; $(AUTOCONF)
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3; $(AUTOCONF)
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc; $(AUTOCONF)
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION); $(AUTOCONF)
@#
@# Fix a bug in gcc 4.6.1 that causes compile errors when building Qt4 for ARM
@# More detailed description at and solution from http://gcc.gnu.org/ml/gcc-patches/2010-11/msg02245.html
@#
ifeq ($(GCC_VERSION),4.6.1)
$(ECHO) "$(BRIGHT_COL)patching gcc...$(DEFAULT_COL)"
$(VERBOSE)sed -i "/|| (volatilep && flag_strict_volatile_bitfields > 0/s/)/ \&\& (bitpos % GET_MODE_ALIGNMENT (mode) != 0))/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/expr.c
endif
include $(GENODE_DIR)/tool/tool_chain_gcc_patches.inc
$(CONTRIB_DIR)/binutils-$(BINUTILS_VERSION)/configure: $(DOWNLOAD_DIR)/$(BINUTILS_DOWNLOAD_TBZ2)
$(ECHO) "$(BRIGHT_COL)unpacking binutils...$(DEFAULT_COL)"

105
tool/tool_chain_gcc_patches.inc Executable file
View File

@ -0,0 +1,105 @@
$(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure:: $(CONTRIB_DIR)/gcc-$(GCC_VERSION)
$(ECHO) "$(BRIGHT_COL)patching gcc build system...$(DEFAULT_COL)"
@#
@# Enable support for passing custom 'tmake_file' and 'extra_parts' to the
@# GCC configure process uncommenting the default initialization of the
@# respective variables. The 'extra_parts' variable is used to carry the
@# the information about which crtN files are to be created.
@#
@# The 't-386elf' file must the treated to prevent it from defining the
@# 'EXTRA_PARTS' variable. If defined, the 'libgcc' Makefile would prepare
@# it against our custom list of 'extra_parts' and consequently fail.
@#
$(VERBOSE)sed -i "/^tmake_file=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config.gcc
$(VERBOSE)sed -i "/^extra_parts=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config.gcc
$(VERBOSE)sed -i "/^extra_parts=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libgcc/config.host
$(VERBOSE)sed -i "/^EXTRA_PARTS=/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config/i386/t-i386elf
$(VERBOSE)sed -i "/^EXTRA_MULTILIB_PARTS *=/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config/arm/t-arm-elf
@#
@# Let 'config.gcc' expand our already populated 'tmake_file' variable rather
@# than making a hard assignment. This is needed for the ARM platform because
@# the target 'arm-elf-eabi' actually matches the pattern 'arm-*-*-eabi' in
@# the 'config.gcc' file.
@#
$(VERBOSE)sed -i "/tmake_file=\"arm/s/=\"/=\"\$${tmake_file} /" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config.gcc
@#
@# Enable LINK_SPEC customization via configure arguments
@#
@# We add a hook for sneaking our custom LINK_SPEC definition into the GCC
@# configure process by uncommentig the 'host_xm_include_list'. This enables us
@# to supply a custom header file to be included into 'gcc/config.h' defining
@# the 'LINK_SPEC' macro. This macro expresses the policy of how the GCC
@# frontend invokes 'ld' on multiarch platforms. I.e., on x86, we need to pass
@# '-melf_i386' to 'ld' when building in '-m32' mode.
@#
$(VERBOSE)sed -i "/^host_xm_include_list=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/configure.ac
@#
@# Make sure to disable the 'inhibit_libc' flag, which is evaluated when
@# compiling libgcc. When libc is inhibited, the 'unwind-dw2-fde-glibc.c'
@# is not using the "new" glibc exception handling mechanism. However,
@# Genode's dynamic linker relies on this mechanism.
@#
$(VERBOSE)sed -i "/inhibit_libc=true/s/true/false # was true/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/configure.ac
@#
@# Accept prepopulation of 'host_configargs' and 'target_configargs' as
@# configure argument (only needed for gcc-4.4.5, fixed with later versions)
@#
$(VERBOSE)sed -i "/host_configargs=.--cache-file/s/=./=\"\$$host_configargs /" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac
$(VERBOSE)sed -i "/target_configargs=..baseargs/s/=.*/=\"\$$target_configargs \$${baseargs}\"/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac
@#
@# Allow customization of CPPFLAGS_FOR_TARGET, not supported by the original
@# GCC config and build system.
@#
$(VERBOSE)sed -i "/^CXXFLAGS_FOR_TARGET =/s/^/CPPFLAGS_FOR_TARGET = @CPPFLAGS_FOR_TARGET@\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl
$(VERBOSE)sed -i "/AC_SUBST(CFLAGS_FOR_TARGET)/s/^/AC_SUBST(CPPFLAGS_FOR_TARGET)\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac
@#
@# Fix the handling of CPP_FOR_TARGET. Without the fix, the configure script
@# of libgcc tries to use the normal 'cpp' for executing preprocessor tests,
@# which produces bogus results.
@#
$(VERBOSE)sed -i "/CC=.*XGCC.*export CC/s/^/ CPP=\"\$$(CPP_FOR_TARGET) \$$(XGCC_FLAGS_FOR_TARGET) \$$\$$TFLAGS\"; export CPP; \\\\\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl
$(VERBOSE)sed -i "/^CC_FOR_TARGET=/s/^/CPP_FOR_TARGET=\$$(STAGE_CC_WRAPPER) @CPP_FOR_TARGET@\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl
$(VERBOSE)sed -i "/CC=.*XGCC.*TFLAGS....$$/s/^/ 'CPP=\$$\$$(CPP_FOR_TARGET) \$$\$$(XGCC_FLAGS_FOR_TARGET) \$$\$$(TFLAGS)' \\\\\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl
$(VERBOSE)sed -i "/flag= CC_FOR_TARGET/s/^/flags_to_pass = { flag= CPP_FOR_TARGET ; };\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.def
$(VERBOSE)sed -i "/^GCC_TARGET_TOOL.cc,/s/^/GCC_TARGET_TOOL(cpp, CPP_FOR_TARGET, CPP, \[gcc\/cpp -B\$$\$$r\/\$$(HOST_SUBDIR)\/gcc\/\])\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac
@#
@# Ensure -fno-short-enums as default.
@#
$(VERBOSE)sed -i "s/return TARGET_AAPCS_BASED && arm_abi != ARM_ABI_AAPCS_LINUX/return false/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config/arm/arm.c
@#
@# Remove sanity check for host/target combination in configure script of
@# libstdc++. An alternative fix would be the addition of a new host or
@# the use of an existing one. However, adding a new host would require
@# us to maintain a larger patch to the GCC build system, and using an
@# existing host comes with all the (possibly unwanted) policies associated
@# with the respective host platform. We want to stick with the bare-bone
@# compiler as much as possible.
@#
$(VERBOSE)sed -i "/No support for this host.target combination/d" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3/crossconfig.m4
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3; $(AUTOCONF)
@#
@# Allow passing of PICFLAGS to the configure script of libstdc++.
@# Without this change, libsupc++ would be compiled w/o PICFLAGS, resulting
@# in text relocations. Because for base tool chains, no 'dynamic_linker'
@# is defined (see 'libtool.m4'), 'dynamic_linker' is set to 'no', which
@# results in 'can_build_shared = no', which, in turn , results
@# in 'enable_shared = no', which, in turn, sets 'LIBSUPCXX_PICFLAGS' to
@# nothing rather then '-prefer-pic'.
@#
$(VERBOSE)sed -i "/LIBSUPCXX_PICFLAGS=$$/s/LIB/__LIB/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3/configure.ac
@#
@# Re-generate configure scripts
@#
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION); autogen Makefile.def
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libgcc; $(AUTOCONF)
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3; $(AUTOCONF)
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc; $(AUTOCONF)
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION); $(AUTOCONF)
@#
@# Fix a bug in gcc 4.6.1 that causes compile errors when building Qt4 for ARM
@# More detailed description at and solution from http://gcc.gnu.org/ml/gcc-patches/2010-11/msg02245.html
@#
ifeq ($(GCC_VERSION),4.6.1)
$(ECHO) "$(BRIGHT_COL)patching gcc...$(DEFAULT_COL)"
$(VERBOSE)sed -i "/|| (volatilep && flag_strict_volatile_bitfields > 0/s/)/ \&\& (bitpos % GET_MODE_ALIGNMENT (mode) != 0))/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/expr.c
endif