diff options
Diffstat (limited to 'toolchain')
23 files changed, 1210 insertions, 46 deletions
diff --git a/toolchain/Config.in b/toolchain/Config.in new file mode 100644 index 000000000..e86e9656f --- /dev/null +++ b/toolchain/Config.in @@ -0,0 +1,45 @@ +menu "Toolchain settings" + +config ADK_TOOLCHAIN_GDB + prompt "Enable building of the GNU debugger" + boolean + default y + +config ADK_TOOLCHAIN_GCC_CXX + prompt "Enable building of G++ (C++ language support in GCC)" + boolean + default y + +config ADK_TOOLCHAIN_GCC_JAVA + prompt "Enable building of GCJ (Java language support in GCC)" + boolean + default n + +config ADK_TOOLCHAIN_GCC_OBJC + prompt "Enable building of Objective C compiler" + boolean + default n + +config ADK_TOOLCHAIN_GCC_SSP + prompt "Enable Stack Smashing Protection in GCC" + boolean + default n + +config ADK_TOOLCHAIN_GCC_USE_SSP + prompt "Use SSP for all packages" + boolean + depends on ADK_TOOLCHAIN_GCC_SSP + default n + +config ADK_TOOLCHAIN_GCC_LTO + prompt "Enable Link Time Optimization in GCC" + boolean + default n + +config ADK_TOOLCHAIN_GCC_USE_LTO + prompt "Use Link Time Optimization for all packages" + boolean + depends on ADK_TOOLCHAIN_GCC_LTO + default n + +endmenu diff --git a/toolchain/Makefile b/toolchain/Makefile index 1e36c6b5f..e3c04a85a 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -3,7 +3,7 @@ # # Steps to build toolchains # 1) build and install binutils -# 2) build and install mpfr, mpc and gmp +# 2) build and install mpfr, mpc, libelf and gmp # 3) build and install gcc c compiler # 4) install kernel-headers # 5) install libc headers @@ -13,7 +13,7 @@ include $(TOPDIR)/rules.mk -TARGETS:=binutils gmp mpfr mpc gcc +TARGETS:=binutils gmp mpfr mpc libelf gcc ifeq ($(ADK_TARGET_LIB_GLIBC),y) TARGETS+=glibc-ports glibc LIBC:=glibc @@ -26,7 +26,9 @@ ifeq ($(ADK_TARGET_LIB_UCLIBC),y) TARGETS+=uClibc LIBC:=uClibc endif +ifeq ($(ADK_TOOLCHAIN_GDB),y) TARGETS+=gdb +endif DOWNLOAD:=kernel-headers-download $(patsubst %,%-download,$(TARGETS)) TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS)) @@ -36,7 +38,7 @@ install: $(TARGETS_INSTALL) clean: $(TARGETS_CLEAN) download: $(DOWNLOAD) -gcc-prepare: binutils-install gmp-install mpfr-install mpc-install +gcc-prepare: binutils-install gmp-install mpfr-install mpc-install libelf-install ifeq ($(ADK_TARGET_LIB_GLIBC),y) $(LIBC)-prepare: gcc-prepare kernel-headers-prepare glibc-ports-prepare else @@ -52,14 +54,11 @@ $(STAGING_HOST_DIR): @mkdir -p $(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME) @ln -sf ../lib $(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME)/lib -$(TOOLCHAIN_BUILD_DIR): - @mkdir -p $(TOOLCHAIN_BUILD_DIR) - %-download: $(TRACE) toolchain/$(patsubst %-download,%,$@)/download $(MAKE) -C $(patsubst %-download,%,$@) fetch -%-prepare: $(STAGING_HOST_DIR) $(TOOLCHAIN_BUILD_DIR) +%-prepare: $(STAGING_HOST_DIR) $(TRACE) toolchain/$(patsubst %-prepare,%,$@)/prepare @if test x"$(patsubst %-prepare,%,$@)" = x"$(LIBC)"; then \ $(MAKE) -C $(patsubst %-prepare,%,$@) prepare \ diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index 33f03c7fb..cc8c1b26a 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -6,6 +6,12 @@ include Makefile.inc include ../rules.mk include ${TOPDIR}/mk/buildhlp.mk +ifeq ($(ADK_TOOLCHAIN_GCC_SSP),y) +CONFOPTS+= --enable-libssp +else +CONFOPTS+= --disable-libssp +endif + ifeq ($(ADK_LINUX_64),y) CONFOPTS+= --enable-64-bit-bfd endif @@ -22,14 +28,12 @@ $(WRKBUILD)/.configured: --build=$(GNU_HOST_NAME) \ --host=$(GNU_HOST_NAME) \ --target=$(REAL_GNU_TARGET_NAME) \ - --disable-nls \ - --with-sysroot=$(TOOLCHAIN_SYSROOT) \ --with-sysroot=$(STAGING_TARGET_DIR) \ --disable-multilib \ --disable-dependency-tracking \ --disable-libtool-lock \ + --disable-nls \ --disable-werror \ - --disable-libssp \ ${CONFOPTS} \ ); touch $@ diff --git a/toolchain/eglibc/Makefile b/toolchain/eglibc/Makefile index a4d54bb69..c5f2a5653 100644 --- a/toolchain/eglibc/Makefile +++ b/toolchain/eglibc/Makefile @@ -4,7 +4,6 @@ include $(TOPDIR)/rules.mk include ../rules.mk include Makefile.inc - include ${TOPDIR}/mk/buildhlp.mk ifneq ($(ADK_DEBUG),) @@ -51,8 +50,8 @@ $(WRKBUILD)/.headers_configure: (cd $(EGLIBC_BUILD_DIR_INITIAL); \ ${EGLIBC_ENV} \ $(WRKBUILD)/libc/configure \ - --prefix=$(TOOLCHAIN_SYSROOT)/usr \ - --with-headers=$(TOOLCHAIN_SYSROOT)/usr/include \ + --prefix=$(STAGING_TARGET_DIR)/usr \ + --with-headers=$(STAGING_TARGET_DIR)/usr/include \ ${EGLIBC_CONFOPTS} \ ); touch $@ @@ -62,9 +61,15 @@ $(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure PATH='${TARGET_PATH}' \ $(MAKE) install-headers install-bootstrap-headers=yes \ ); - touch $(TOOLCHAIN_SYSROOT)/usr/include/gnu/stubs.h + touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h touch $@ +ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +EGLIBC_ENV+= libc_cv_ssp=yes +else +EGLIBC_ENV+= libc_cv_ssp=no +endif + $(WRKBUILD)/.configured: mkdir -p $(EGLIBC_BUILD_DIR_FINAL) $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \ @@ -79,12 +84,16 @@ $(WRKBUILD)/.configured: ); touch $@ -$(WRKBUILD)/.compiled: +$(EGLIBC_BUILD_DIR_FINAL)/libc.so: +$(WRKBUILD)/.compiled: $(WRKBUILD)/.configured ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) all touch $@ -$(WRKBUILD)/.installed: +$(WRKBUILD)/.installed: $(EGLIBC_BUILD_DIR_FINAL)/libc.so ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install + ${INSTALL_DATA} ${WRKBUILD}/libc/posix/gai.conf ${STAGING_TARGET_DIR}/etc/ + ${INSTALL_DATA} ${WRKBUILD}/libc/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc/ + ${INSTALL_DATA} ${WRKBUILD}/libc/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/ touch $@ include ${TOPDIR}/mk/toolchain.mk diff --git a/toolchain/eglibc/Makefile.inc b/toolchain/eglibc/Makefile.inc index 51fefa6d5..42e80e858 100644 --- a/toolchain/eglibc/Makefile.inc +++ b/toolchain/eglibc/Makefile.inc @@ -3,6 +3,6 @@ PKG_NAME:= eglibc PKG_VERSION:= 2.12.1 -PKG_RELEASE:= 1 +PKG_RELEASE:= 2 PKG_MD5SUM:= 3668505801160785c2961df0a7ec192e PKG_SITES:= http://openadk.org/distfiles/ diff --git a/toolchain/eglibc/patches/eglibc-cross.patch b/toolchain/eglibc/patches/eglibc-cross.patch index 384a5c16b..6a7fb9e51 100644 --- a/toolchain/eglibc/patches/eglibc-cross.patch +++ b/toolchain/eglibc/patches/eglibc-cross.patch @@ -1,3 +1,5 @@ +* NOTE: This will still use a hardcoded “gcc” instead of HOSTCC + diff -Nur eglibc-2.12.orig/libc/sunrpc/proto.h eglibc-2.12/libc/sunrpc/proto.h --- eglibc-2.12.orig/libc/sunrpc/proto.h 2010-09-28 19:14:26.000000000 +0200 +++ eglibc-2.12/libc/sunrpc/proto.h 2010-09-29 14:05:15.000000000 +0200 diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile index 7e806c68c..b1ce84f98 100644 --- a/toolchain/gcc/Makefile +++ b/toolchain/gcc/Makefile @@ -11,6 +11,7 @@ GCC_CONFOPTS= --prefix=$(STAGING_HOST_DIR) \ --target=$(REAL_GNU_TARGET_NAME) \ --with-gmp=$(STAGING_HOST_DIR) \ --with-mpfr=$(STAGING_HOST_DIR) \ + --with-libelf=$(STAGING_HOST_DIR) \ --disable-__cxa_atexit \ --with-gnu-ld \ --disable-libmudflap \ @@ -19,7 +20,6 @@ GCC_CONFOPTS= --prefix=$(STAGING_HOST_DIR) \ --disable-decimal-float \ --disable-multilib \ --disable-sjlj-exceptions \ - --disable-libssp \ --disable-libstdcxx-pch \ --disable-ppl-version-check \ --disable-cloog-version-check \ @@ -27,6 +27,18 @@ GCC_CONFOPTS= --prefix=$(STAGING_HOST_DIR) \ --without-cloog \ --disable-nls +ifeq ($(ADK_TOOLCHAIN_GCC_SSP),y) +GCC_CONFOPTS+= --enable-libssp +else +GCC_CONFOPTS+= --disable-libssp +endif + +ifeq ($(ADK_TOOLCHAIN_GCC_LTO),y) +GCC_CONFOPTS+= --enable-lto +else +GCC_CONFOPTS+= --disable-lto +endif + ifeq ($(ARCH),cris) GCC_CONFOPTS+= --disable-tls else @@ -55,6 +67,17 @@ ifeq (${ADK_MAKE_PARALLEL},y) GCC_MAKEOPTS+= -j${ADK_MAKE_JOBS} endif +LANGUAGES:=c +ifeq ($(ADK_TOOLCHAIN_GCC_CXX),y) +LANGUAGES:=${LANGUAGES},c++ +endif +ifeq ($(ADK_TOOLCHAIN_GCC_JAVA),y) +LANGUAGES:=${LANGUAGES},java +endif +ifeq ($(ADK_TOOLCHAIN_GCC_ADA),y) +LANGUAGES:=${LANGUAGES},ada +endif + include ${TOPDIR}/mk/buildhlp.mk GCC_BUILD_DIR_MINIMAL:= $(WRKBUILD)-minimal @@ -63,7 +86,12 @@ GCC_BUILD_DIR_FINAL:= $(WRKBUILD)-final $(GCC_BUILD_DIR_MINIMAL)/.configured: mkdir -p $(GCC_BUILD_DIR_MINIMAL) - (cd $(GCC_BUILD_DIR_MINIMAL); rm -f config.cache; \ + # these symlinks are very important, do not remove + rm -rf $(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include + ln -sf ${STAGING_TARGET_DIR}/include $(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include + rm -rf ${STAGING_HOST_DIR}/$(REAL_GNU_TARGET_NAME)/lib + ln -sf ${STAGING_TARGET_DIR}/lib $(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME)/lib + (cd $(GCC_BUILD_DIR_MINIMAL); \ PATH='$(TARGET_PATH)' \ $(WRKBUILD)/configure \ ${GCC_CONFOPTS} \ @@ -85,12 +113,8 @@ $(WRKBUILD)/.headers: $(GCC_BUILD_DIR_MINIMAL)/.compiled touch $@ $(GCC_BUILD_DIR_INITIAL)/.configured: - rm -rf $(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include - ln -sf ${STAGING_TARGET_DIR}/include $(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include - rm -rf ${STAGING_HOST_DIR}/$(REAL_GNU_TARGET_NAME)/lib - ln -sf ${STAGING_TARGET_DIR}/lib $(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME)/lib mkdir -p $(GCC_BUILD_DIR_INITIAL) - (cd $(GCC_BUILD_DIR_INITIAL); rm -f config.cache; \ + (cd $(GCC_BUILD_DIR_INITIAL); \ PATH='$(TARGET_PATH)' \ $(WRKBUILD)/configure \ ${GCC_CONFOPTS} \ @@ -98,7 +122,7 @@ $(GCC_BUILD_DIR_INITIAL)/.configured: --disable-shared \ --disable-threads \ --with-newlib \ - --with-sysroot=$(TOOLCHAIN_SYSROOT) \ + --with-sysroot=$(STAGING_TARGET_DIR) \ ); touch $@ @@ -115,12 +139,12 @@ $(WRKBUILD)/.configured: $(GCC_BUILD_DIR_INITIAL)/.compiled $(GCC_BUILD_DIR_FINAL)/.configured: mkdir -p $(GCC_BUILD_DIR_FINAL) - (cd $(GCC_BUILD_DIR_FINAL); rm -f config.cache; \ + (cd $(GCC_BUILD_DIR_FINAL); \ PATH='$(TARGET_PATH)' \ $(WRKBUILD)/configure \ ${GCC_CONFOPTS} \ - --enable-languages=c,c++ \ - --with-sysroot=$(STAGING_TARGET_DIR) \ + --enable-languages=$(LANGUAGES) \ + --with-sysroot='$${prefix}/${STAGING_HOST2TARGET}' \ --with-slibdir=$(STAGING_TARGET_DIR)/lib \ --enable-shared \ ); @@ -133,9 +157,6 @@ $(WRKBUILD)/.compiled: $(GCC_BUILD_DIR_FINAL)/.configured $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled PATH='$(TARGET_PATH)' $(MAKE) -C $(GCC_BUILD_DIR_FINAL) install - # workaround if you cross-compile binutils - @-rm $(STAGING_TARGET_DIR)/lib/libiberty.a - @-rm $(STAGING_TARGET_DIR)/usr/lib/libiberty.a # Set up the symlinks to enable lying about target name. set -e; \ (cd $(STAGING_HOST_DIR); \ diff --git a/toolchain/gcc/patches/cflags.patch b/toolchain/gcc/patches/cflags.patch new file mode 100644 index 000000000..0d5815a54 --- /dev/null +++ b/toolchain/gcc/patches/cflags.patch @@ -0,0 +1,253 @@ + + This patch brings over a few features from MirBSD: + * -fhonour-copts + If this option is not given, it's warned (depending + on environment variables). This is to catch errors + of misbuilt packages which override CFLAGS themselves. + * -Werror-maybe-reset + Has the effect of -Wno-error if GCC_NO_WERROR is + set and not '0', a no-operation otherwise. This is + to be able to use -Werror in "make" but prevent + GNU autoconf generated configure scripts from + freaking out. + * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks + the default for -O2/-Os, because they trigger gcc bugs + and can delete code with security implications. + + This patch was authored by Thorsten Glaser <tg at mirbsd.de> + with copyright assignment to the FSF in effect. + +--- a/gcc/c-opts.c ++++ b/gcc/c-opts.c +@@ -105,6 +105,9 @@ + /* Number of deferred options scanned for -include. */ + static size_t include_cursor; + ++/* Check if a port honours COPTS. */ ++static int honour_copts = 0; ++ + static void set_Wimplicit (int); + static void handle_OPT_d (const char *); + static void set_std_cxx98 (int); +@@ -454,6 +457,9 @@ + enable_warning_as_error ("implicit-function-declaration", value, CL_C | CL_ObjC); + break; + ++ case OPT_Werror_maybe_reset: ++ break; ++ + case OPT_Wformat: + set_Wformat (value); + break; +@@ -690,6 +701,12 @@ + flag_exceptions = value; + break; + ++ case OPT_fhonour_copts: ++ if (c_language == clk_c) { ++ honour_copts++; ++ } ++ break; ++ + case OPT_fimplement_inlines: + flag_implement_inlines = value; + break; +@@ -1209,6 +1226,47 @@ + return false; + } + ++ if (c_language == clk_c) { ++ char *ev = getenv ("GCC_HONOUR_COPTS"); ++ int evv; ++ if (ev == NULL) ++ evv = -1; ++ else if ((*ev == '0') || (*ev == '\0')) ++ evv = 0; ++ else if (*ev == '1') ++ evv = 1; ++ else if (*ev == '2') ++ evv = 2; ++ else if (*ev == 's') ++ evv = -1; ++ else { ++ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1"); ++ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */ ++ } ++ if (evv == 1) { ++ if (honour_copts == 0) { ++ error ("someone does not honour COPTS at all in lenient mode"); ++ return false; ++ } else if (honour_copts != 1) { ++ warning (0, "someone does not honour COPTS correctly, passed %d times", ++ honour_copts); ++ } ++ } else if (evv == 2) { ++ if (honour_copts == 0) { ++ error ("someone does not honour COPTS at all in strict mode"); ++ return false; ++ } else if (honour_copts != 1) { ++ error ("someone does not honour COPTS correctly, passed %d times", ++ honour_copts); ++ return false; ++ } ++ } else if (evv == 0) { ++ if (honour_copts != 1) ++ inform (0, "someone does not honour COPTS correctly, passed %d times", ++ honour_copts); ++ } ++ } ++ + return true; + } + +--- a/gcc/c.opt ++++ b/gcc/c.opt +@@ -215,6 +215,10 @@ + C ObjC RejectNegative Warning + This switch is deprecated; use -Werror=implicit-function-declaration instead + ++Werror-maybe-reset ++C ObjC C++ ObjC++ ++; Documented in common.opt ++ + Wfloat-equal + C ObjC C++ ObjC++ Var(warn_float_equal) Warning + Warn if testing floating point numbers for equality +@@ -609,6 +613,9 @@ + fhonor-std + C++ ObjC++ + ++fhonour-copts ++C ObjC C++ ObjC++ RejectNegative ++ + fhosted + C ObjC + Assume normal C execution environment +--- a/gcc/common.opt ++++ b/gcc/common.opt +@@ -102,6 +102,10 @@ + Common Joined + Treat specified warning as error + ++Werror-maybe-reset ++Common ++If environment variable GCC_NO_WERROR is set, act as -Wno-error ++ + Wextra + Common Warning + Print extra (possibly unwanted) warnings +@@ -573,6 +577,9 @@ + Common Report Var(flag_guess_branch_prob) Optimization + Enable guessing of branch probabilities + ++fhonour-copts ++Common RejectNegative ++ + ; Nonzero means ignore `#ident' directives. 0 means handle them. + ; Generate position-independent code for executables if possible + ; On SVR4 targets, it also controls whether or not to emit a +--- a/gcc/opts.c ++++ b/gcc/opts.c +@@ -896,8 +896,6 @@ + flag_schedule_insns_after_reload = opt2; + #endif + flag_regmove = opt2; +- flag_strict_aliasing = opt2; +- flag_strict_overflow = opt2; + flag_reorder_blocks = opt2; + flag_reorder_functions = opt2; + flag_tree_vrp = opt2; +@@ -922,6 +919,8 @@ + + /* -O3 optimizations. */ + opt3 = (optimize >= 3); ++ flag_strict_aliasing = opt3; ++ flag_strict_overflow = opt3; + flag_predictive_commoning = opt3; + flag_inline_functions = opt3; + flag_unswitch_loops = opt3; +@@ -1601,6 +1601,17 @@ + enable_warning_as_error (arg, value, lang_mask); + break; + ++ case OPT_Werror_maybe_reset: ++ { ++ char *ev = getenv ("GCC_NO_WERROR"); ++ if ((ev != NULL) && (*ev != '0')) ++ warnings_are_errors = 0; ++ } ++ break; ++ ++ case OPT_fhonour_copts: ++ break; ++ + case OPT_Wlarger_than_: + /* This form corresponds to -Wlarger-than-. + Kept for backward compatibility. +--- a/gcc/doc/cppopts.texi ++++ b/gcc/doc/cppopts.texi +@@ -164,6 +164,11 @@ + Make all warnings into hard errors. Source code which triggers warnings + will be rejected. + ++ at item -Werror-maybe-reset ++ at opindex Werror-maybe-reset ++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment ++variable is set to anything other than 0 or empty. ++ + @item -Wsystem-headers + @opindex Wsystem-headers + Issue warnings for code in system headers. These are normally unhelpful +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -234,7 +234,7 @@ + -Wconversion -Wcoverage-mismatch -Wno-deprecated @gol + -Wno-deprecated-declarations -Wdisabled-optimization @gol + -Wno-div-by-zero -Wempty-body -Wenum-compare -Wno-endif-labels @gol +--Werror -Werror=* @gol ++-Werror -Werror=* -Werror-maybe-reset @gol + -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol + -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol + -Wformat-security -Wformat-y2k @gol +@@ -4161,6 +4161,22 @@ + @option{-Wall} and by @option{-pedantic}, which can be disabled with + @option{-Wno-pointer-sign}. + ++ at item -Werror-maybe-reset ++ at opindex Werror-maybe-reset ++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment ++variable is set to anything other than 0 or empty. ++ ++ at item -fhonour-copts ++ at opindex fhonour-copts ++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not ++given at least once, and warn if it is given more than once. ++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not ++given exactly once. ++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option ++is not given exactly once. ++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}. ++This flag and environment variable only affect the C language. ++ + @item -Wstack-protector + @opindex Wstack-protector + @opindex Wno-stack-protector +@@ -5699,7 +5715,7 @@ + second branch or a point immediately following it, depending on whether + the condition is known to be true or false. + +-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. ++Enabled at levels @option{-O3}. + + @item -fsplit-wide-types + @opindex fsplit-wide-types +--- a/gcc/java/jvspec.c ++++ b/gcc/java/jvspec.c +@@ -670,6 +670,7 @@ + class name. Append dummy `.c' that can be stripped by set_input so %b + is correct. */ + set_input (concat (main_class_name, "main.c", NULL)); ++ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */ + err = do_spec (jvgenmain_spec); + if (err == 0) + { diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile index bf7c7d457..2025746cf 100644 --- a/toolchain/gdb/Makefile +++ b/toolchain/gdb/Makefile @@ -4,7 +4,6 @@ include $(TOPDIR)/rules.mk include ../rules.mk include Makefile.inc - include ${TOPDIR}/mk/buildhlp.mk ifeq (${ADK_MAKE_PARALLEL},y) diff --git a/toolchain/glibc/Makefile b/toolchain/glibc/Makefile index 4d39e2b27..d492b9837 100644 --- a/toolchain/glibc/Makefile +++ b/toolchain/glibc/Makefile @@ -17,6 +17,7 @@ ifeq ($(ADK_TARGET_NO_FPU),y) GLIBC_CONFOPTS+= --without-fp endif +GLIBC_MAKEOPTS+= cross-compiling=yes ifeq (${ADK_MAKE_PARALLEL},y) GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j${ADK_MAKE_JOBS}" endif @@ -31,21 +32,19 @@ $(WRKBUILD)/.headers_configure: (cd $(GLIBC_BUILD_DIR_INITIAL); \ ${GLIBC_ENV} \ $(WRKBUILD)/configure \ - --prefix=$(TOOLCHAIN_SYSROOT)/usr \ - --with-sysroot=$(TOOLCHAIN_SYSROOT) \ + --prefix=$(STAGING_TARGET_DIR)/usr \ + --with-sysroot=$(STAGING_TARGET_DIR) \ ${GLIBC_CONFOPTS} \ ); touch $@ $(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure - mkdir -p $(TOOLCHAIN_SYSROOT)/usr/lib (cd $(GLIBC_BUILD_DIR_INITIAL); \ ${GLIBC_ENV} \ $(MAKE) ${GLIBC_MAKEOPTS} \ - cross-compiling=yes \ install-headers \ ); - touch $(TOOLCHAIN_SYSROOT)/usr/include/gnu/stubs.h + touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h touch $@ $(WRKBUILD)/.configured: @@ -67,6 +66,10 @@ $(WRKBUILD)/.compiled: $(WRKBUILD)/.installed: ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) \ install_root=$(STAGING_TARGET_DIR) install + mkdir -p ${STAGING_TARGET_DIR}/etc + ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc/ + ${INSTALL_DATA} ${WRKBUILD}/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc/ + ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/ touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h touch $(WRKBUILD)/.installed diff --git a/toolchain/glibc/Makefile.inc b/toolchain/glibc/Makefile.inc index ff4753465..79ba89cc2 100644 --- a/toolchain/glibc/Makefile.inc +++ b/toolchain/glibc/Makefile.inc @@ -9,7 +9,7 @@ PKG_SITES:= ${MASTER_SITE_GNU:=glibc/} GLIBC_PORTS_VERSION:= 2.12 GLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \ --host=$(REAL_GNU_TARGET_NAME) \ - --with-headers=$(TOOLCHAIN_SYSROOT)/usr/include \ + --with-headers=$(STAGING_TARGET_DIR)/usr/include \ --disable-nls \ --disable-sanity-checks \ --disable-nls \ @@ -32,3 +32,4 @@ GLIBC_ENV:= PATH='${TARGET_PATH}' \ libc_cv_c_cleanup=yes \ libc_cv_gnu99_inline=yes \ libc_cv_sparc64_tls=yes \ + libc_cv_slibdir="/lib" \ diff --git a/toolchain/glibc/patches/i686_define_bug.patch b/toolchain/glibc/patches/i686_define_bug.patch new file mode 100644 index 000000000..0414fecc9 --- /dev/null +++ b/toolchain/glibc/patches/i686_define_bug.patch @@ -0,0 +1,38 @@ + Fix for compiling glibc with -march=i686 specified. + The patch below found at: http://permalink.gmane.org/gmane.linux.lfs.devel/9758, + a nice discussion (with a comment of the glibc maintainer) can be found here: + http://old.nabble.com/-RFC-PATCH--glibc-doesn%27t-build-with-%22gcc--march%3Di686%22-td17442608.html + + To me, this simply shows once more how fucked up things can be. E.g. the (related) bug report here: + http://bugs.gentoo.org/show_bug.cgi?id=201815. There are lots of duplicates to it, many people are + affected, one can find really elaborate reports. And the responsible gentoo developers are too + elite to even point to the actual patch fixing the issue. +diff -Naur glibc-2.11.1-orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c +--- glibc-2.11.1-orig/nptl/sysdeps/pthread/pt-initfini.c 2009-12-08 20:10:20.000000000 +0000 ++++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c 2010-04-17 02:24:02.000000000 +0100 +@@ -45,6 +45,11 @@ + /* Embed an #include to pull in the alignment and .end directives. */ + asm ("\n#include \"defs.h\""); + ++asm ("\n#if defined __i686 && defined __ASSEMBLER__"); ++asm ("\n#undef __i686"); ++asm ("\n#define __i686 __i686"); ++asm ("\n#endif"); ++ + /* The initial common code ends here. */ + asm ("\n/*@HEADER_ENDS*/"); + +diff -Naur glibc-2.11.1-orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h +--- glibc-2.11.1-orig/sysdeps/unix/sysv/linux/i386/sysdep.h 2009-12-08 20:10:20.000000000 +0000 ++++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h 2010-04-17 02:24:02.000000000 +0100 +@@ -29,6 +29,10 @@ + #include <dl-sysdep.h> + #include <tls.h> + ++#if defined __i686 && defined __ASSEMBLER__ ++#undef __i686 ++#define __i686 __i686 ++#endif + + /* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h diff --git a/toolchain/glibc/patches/tz.patch b/toolchain/glibc/patches/tz.patch new file mode 100644 index 000000000..990458aa4 --- /dev/null +++ b/toolchain/glibc/patches/tz.patch @@ -0,0 +1,135 @@ +--- glibc-2.12.1/timezone/Makefile 2010-07-27 13:34:39.000000000 +0200 ++++ glibc-2.12.1.orig/timezone/Makefile 2011-01-10 15:20:02.576150764 +0100 +@@ -69,13 +69,10 @@ + $(addprefix $(inst_zonedir)/, \ + $(posixrules-file))) + +-ifeq ($(cross-compiling),no) +-# Don't try to install the zoneinfo files since we can't run zic. + install-others = $(addprefix $(inst_zonedir)/,$(zonenames) \ + $(zonenames:%=posix/%) \ + $(zonenames:%=right/%)) \ + $(installed-localtime-file) $(installed-posixrules-file) +-endif + + ifeq ($(have-ksh),yes) + install-others += $(inst_zonedir)/iso3166.tab $(inst_zonedir)/zone.tab +@@ -106,18 +103,35 @@ + echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \' ;\ + echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\ + fi ;\ +- echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/right/,$$($*-zones)): \' ;\ +- echo '$< $$(objpfx)zic leapseconds yearistype' ;\ +- echo ' $$(tzcompile)' ;\ +- echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/posix/,$$($*-zones)): \' ;\ +- echo '$< $$(objpfx)zic /dev/null yearistype' ;\ +- echo ' $$(tzcompile)' ;\ +- echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/,$$($*-zones)): \' ;\ +- echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\ +- echo ' $$(tzcompile)' ;\ ++ echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/right/,$$($*-zones)): \' ;) > $@.new ++ ++ifeq (no,$(cross-compiling)) ++ (echo '$< $$(objpfx)zic leapseconds yearistype' ;) >> $@.new ++else ++ (echo '$< $$(objpfx)cross-zic leapseconds yearistype' ;) >> $@.new ++endif ++ ++ (echo ' $$(tzcompile)' ;\ ++ echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/posix/,$$($*-zones)): \' ;) >> $@.new ++ ++ifeq (no,$(cross-compiling)) ++ (echo '$< $$(objpfx)zic /dev/null yearistype' ;) >> $@.new ++else ++ (echo '$< $$(objpfx)cross-zic /dev/null yearistype' ;) >> $@.new ++endif ++ ++ (echo ' $$(tzcompile)' ;\ ++ echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/,$$($*-zones)): \' ;) >> $@.new ++ ++ifeq (no,$(cross-compiling)) ++ (echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;) >> $@.new ++else ++ (echo '$< $$(objpfx)cross-zic $$(leapseconds) yearistype' ;) >> $@.new ++endif ++ ++ (echo ' $$(tzcompile)' ;\ + echo 'endif' ;\ +- echo 'zonenames := $$(zonenames) $$($*-zones)' ;\ +- ) > $@.new ++ echo 'zonenames := $$(zonenames) $$($*-zones)' ;) >> $@.new + mv $@.new $@ + + .PHONY: echo-zonenames +@@ -128,7 +142,11 @@ + # We have to use `-d $(inst_zonedir)' to explictly tell zic where to + # place the output files although $(zonedir) is compiled in. But the + # user might have set $(install_root) on the command line of `make install'. ++ifeq (no,$(cross-compiling)) + zic-cmd = $(built-program-cmd) -d $(inst_zonedir) ++else ++zic-cmd = $(objpfx)cross-zic -d $(inst_zonedir) ++endif + tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \ + -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $< + +@@ -158,8 +176,17 @@ + $(zic-cmd) -p $(posixrules) + endif + ++zic-objs = zic.o ialloc.o scheck.o ++ ++$(objpfx)zic: $(addprefix $(objpfx), $(zic-objs)) ++ ++$(addprefix $(objpfx)cross-,$(zic-objs)): $(objpfx)cross-%.o: %.c ++ gcc $< -c $(OUTPUT_OPTION) \ ++ $(filter-out -DHAVE_GETTEXT,$(CFLAGS-$*.c)) \ ++ $(CPPFLAGS-$*) -DCROSS_ZIC $(compile-mkdep-flags) + +-$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o ++$(objpfx)cross-zic: $(addprefix $(objpfx)cross-,$(zic-objs)) ++ gcc $(addprefix $(objpfx)cross-,$(zic-objs)) -o $@ + + tz-cflags = -DTZDIR='"$(zonedir)"' \ + -DTZDEFAULT='"$(localtime-file)"' \ +@@ -176,10 +203,17 @@ + # Don't add leapseconds here since test-tz made checks that work only without + # leapseconds. + testdata = $(objpfx)testdata ++ifeq (no,$(cross-compiling)) + define build-testdata + GCONV_PATH=${common-objpfx}iconvdata LANGUAGE=C LC_ALL=C \ + $(built-program-cmd) -d $(testdata) -y ./yearistype $< + endef ++else ++define build-testdata ++LANGUAGE=C LC_ALL=C \ ++ $(objpfx)cross-zic -d $(testdata) -y ./yearistype $< ++endef ++endif + + $(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC) + $(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \ +@@ -192,7 +226,11 @@ + tst-timezone-ENV = TZDIR=$(testdata) + + # Note this must come second in the deps list for $(built-program-cmd) to work. ++ifeq (no,$(cross-compiling)) + zic-deps = $(objpfx)zic $(leapseconds) yearistype ++else ++zic-deps = $(objpfx)cross-zic $(objpfx)zic $(leapseconds) yearistype ++endif + + $(testdata)/America/New_York: northamerica $(zic-deps) + $(build-testdata) +@@ -214,7 +252,9 @@ + + $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make + sed -e 's%@KSH@%$(KSH)%g' \ +- -e 's%@TZDIR@%$(zonedir)%g' < $< > $@.new ++ -e 's%@TZDIR@%$(zonedir)%g' \ |