From 186c1bd82b6a6a1b0fcd64456088ca50e37784d5 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Mon, 17 Mar 2014 08:21:53 +0100 Subject: fixups for x86_64 x32 toolchain, x86_64 32 still problematic - add a musl patch to recognize x86_64-foo-muslx32 - rework multilib configuration - remove explicit sjlj gcc configure, as suggested by the gcc docs - fix strace for x32 --- toolchain/Config.in | 8 ++----- toolchain/binutils/Makefile | 7 +++++- toolchain/gcc/Makefile | 41 ++++++++++++++++++++--------------- toolchain/glibc/Makefile | 6 ++--- toolchain/glibc/Makefile.inc | 20 ++++++++++------- toolchain/musl/patches/musl-x32.patch | 12 ++++++++++ 6 files changed, 59 insertions(+), 35 deletions(-) create mode 100644 toolchain/musl/patches/musl-x32.patch (limited to 'toolchain') diff --git a/toolchain/Config.in b/toolchain/Config.in index d6a578233..54016212a 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -1,7 +1,3 @@ -config ADK_TOOLCHAIN_GCC_SJLJ - boolean - default n - menu "Toolchain settings" config ADK_TOOLCHAIN_GDB @@ -17,7 +13,7 @@ config ADK_TOOLCHAIN_GCC_CXX config ADK_TOOLCHAIN_GCC_SSP prompt "Enable Stack Smashing Protection in GCC" boolean - default n + default y config ADK_TOOLCHAIN_GCC_USE_SSP prompt "Use SSP for all packages" @@ -28,7 +24,7 @@ config ADK_TOOLCHAIN_GCC_USE_SSP config ADK_TOOLCHAIN_GCC_LTO prompt "Enable Link Time Optimization in GCC" boolean - default n + default y config ADK_TOOLCHAIN_GCC_USE_LTO prompt "Use Link Time Optimization for all packages" diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index 8ebbea53c..fc256c578 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -20,6 +20,12 @@ ifneq ($(strip $(ADK_LINUX_64)$(ADK_TARGET_KERNEL64)),) CONFOPTS+= --enable-64-bit-bfd endif +ifeq ($(ADK_LINUX_SH)$(ADK_LINUX_X86_64),) +CONFOPTS+= --disable-multilib +else +CONFOPTS+= --enable-multilib +endif + ifeq (${ADK_MAKE_PARALLEL},y) BINUTILS_MAKEOPTS+= -j${ADK_MAKE_JOBS} endif @@ -31,7 +37,6 @@ $(WRKBUILD)/.configured: --prefix=$(STAGING_HOST_DIR) \ --target=$(GNU_TARGET_NAME) \ --with-sysroot=$(STAGING_TARGET_DIR) \ - --disable-multilib \ --disable-dependency-tracking \ --disable-libtool-lock \ --disable-nls \ diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile index f93f9d7cf..475c90662 100644 --- a/toolchain/gcc/Makefile +++ b/toolchain/gcc/Makefile @@ -4,11 +4,11 @@ include $(TOPDIR)/rules.mk include ../rules.mk -TARGET_CFLAGS:= $(filter-out -fstack-protector,$(TARGET_CFLAGS)) +TARGET_CFLAGS:= $(filter-out -fstack-protector,$(TARGET_CFLAGS)) include Makefile.inc -GCC_CONFOPTS= --prefix=$(STAGING_HOST_DIR) \ +GCC_CONFOPTS:= --prefix=$(STAGING_HOST_DIR) \ --with-bugurl="http://www.openadk.org/" \ --build=$(GNU_HOST_NAME) \ --host=$(GNU_HOST_NAME) \ @@ -28,41 +28,43 @@ GCC_CONFOPTS= --prefix=$(STAGING_HOST_DIR) \ --disable-libstdcxx-pch \ --disable-ppl-version-check \ --disable-cloog-version-check \ + --without-system-zlib \ --without-ppl \ --without-cloog \ --without-isl \ --disable-nls -ifeq ($(ADK_TOOLCHAIN_GCC_SJLJ),y) -GCC_CONFOPTS+= --enable-sjlj-exceptions -else -GCC_CONFOPTS+= --disable-sjlj-exceptions -endif - +GCC_FINAL_CONFOPTS:= ifeq ($(ADK_LINUX_SH)$(ADK_LINUX_X86_64),) -GCC_CONFOPTS+= --disable-biarch --disable-multilib +GCC_FINAL_CONFOPTS+= --disable-biarch --disable-multilib endif + ifeq ($(ADK_LINUX_SH),y) -GCC_CONFOPTS+= --with-multilib-list=m4,m4-nofpu +GCC_FINAL_CONFOPTS+= --enable-multilib --with-multilib-list=m4,m4-nofpu endif + ifeq ($(ADK_LINUX_X86_64),y) ifeq ($(ADK_x32),y) -GCC_CONFOPTS+= --with-multilib-list=mx32 -else -GCC_CONFOPTS+= --disable-biarch --disable-multilib +GCC_FINAL_CONFOPTS+= --enable-multilib --with-multilib-list=mx32 +endif +ifeq ($(ADK_32),y) +GCC_FINAL_CONFOPTS+= --enable-multilib --with-multilib-list=m32 +endif +ifeq ($(ADK_64),y) +GCC_FINAL_CONFOPTS+= --disable-biarch --disable-multilib endif endif ifeq ($(ADK_TOOLCHAIN_GCC_SSP),y) -GCC_CONFOPTS+= --enable-libssp +GCC_FINAL_CONFOPTS+= --enable-libssp else -GCC_CONFOPTS+= --disable-libssp +GCC_FINAL_CONFOPTS+= --disable-libssp endif ifeq ($(ADK_TOOLCHAIN_GCC_LTO),y) -GCC_CONFOPTS+= --enable-lto +GCC_FINAL_CONFOPTS+= --enable-lto else -GCC_CONFOPTS+= --disable-lto +GCC_FINAL_CONFOPTS+= --disable-lto endif ifeq ($(ADK_LINUX_PPC),y) @@ -132,6 +134,9 @@ endif $(WRKBUILD)/configure \ ${GCC_CONFOPTS} \ --enable-languages=c \ + --disable-multilib \ + --disable-lto \ + --disable-libssp \ --disable-shared \ --without-headers touch $@ @@ -151,6 +156,7 @@ $(GCC_BUILD_DIR_INITIAL)/.configured: CXXFLAGS="-O0 -g0" \ $(WRKBUILD)/configure \ ${GCC_CONFOPTS} \ + ${GCC_FINAL_CONFOPTS} \ --enable-languages=c \ --disable-shared \ --disable-threads \ @@ -171,6 +177,7 @@ $(GCC_BUILD_DIR_FINAL)/.configured: cd $(GCC_BUILD_DIR_FINAL); PATH='$(TARGET_PATH)' \ $(WRKBUILD)/configure \ ${GCC_CONFOPTS} \ + ${GCC_FINAL_CONFOPTS} \ --enable-languages=$(LANGUAGES) \ --with-build-sysroot='$${prefix}/${STAGING_HOST2TARGET}' \ --with-sysroot='$${prefix}/${STAGING_HOST2TARGET}' \ diff --git a/toolchain/glibc/Makefile b/toolchain/glibc/Makefile index 41987bada..4af17c3d7 100644 --- a/toolchain/glibc/Makefile +++ b/toolchain/glibc/Makefile @@ -5,13 +5,13 @@ include $(TOPDIR)/rules.mk include ../rules.mk # glibc does not compile with Os -TARGET_CFLAGS_LIBC:= $(subst Os,O2,$(TARGET_CFLAGS_LIBC)) +TARGET_CFLAGS:= $(subst Os,O2,$(TARGET_CFLAGS)) ifneq ($(ADK_DEBUG),) -TARGET_CFLAGS_LIBC+= -O2 +TARGET_CFLAGS+= -O2 endif # ssp partially supported -TARGET_CFLAGS_LIBC:= $(filter-out -fstack-protector,$(TARGET_CFLAGS_LIBC)) +TARGET_CFLAGS:= $(filter-out -fstack-protector,$(TARGET_CFLAGS)) include Makefile.inc include ${TOPDIR}/mk/buildhlp.mk diff --git a/toolchain/glibc/Makefile.inc b/toolchain/glibc/Makefile.inc index 3c1a3167d..6671f1e2d 100644 --- a/toolchain/glibc/Makefile.inc +++ b/toolchain/glibc/Makefile.inc @@ -6,8 +6,13 @@ PKG_VERSION:= 2.19 PKG_RELEASE:= 1 PKG_MD5SUM:= 5374d29864b583622b62bfc6b8429418 PKG_SITES:= ${MASTER_SITE_GNU:=glibc/} +ifeq ($(ADK_TARGET_ABI_32),y) +GLIBC_TARGET_NAME:= i686-openadk-linux-gnu +else +GLIBC_TARGET_NAME:= $(GNU_TARGET_NAME) +endif GLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \ - --host=$(GNU_TARGET_NAME) \ + --host=$(GLIBC_TARGET_NAME) \ --with-headers=$(STAGING_TARGET_DIR)/usr/include \ --disable-sanity-checks \ --disable-nls \ @@ -21,16 +26,15 @@ GLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \ --enable-kernel="2.6.32" \ --enable-add-ons GLIBC_ENV:= PATH='${TARGET_PATH}' \ + SHELL='${SHELL}' \ BUILD_CC=${CC_FOR_BUILD} \ - CFLAGS="$(TARGET_CFLAGS_LIBC)" \ - CC=${GNU_TARGET_NAME}-gcc \ - CXX=${GNU_TARGET_NAME}-g++ \ - AR=${GNU_TARGET_NAME}-ar \ - RANLIB=${GNU_TARGET_NAME}-ranlib \ + CFLAGS="$(TARGET_CFLAGS)" \ + CC="${TARGET_CC}" \ + CXX="${TARGET_CXX}" \ + AR="${TARGET_AR}" \ + RANLIB="${TARGET_RANLIB}" \ libc_cv_forced_unwind=yes \ libc_cv_cc_with_libunwind=yes \ libc_cv_c_cleanup=yes \ libc_cv_gnu99_inline=yes \ - libc_cv_sparc64_tls=yes \ - libc_cv_slibdir="/lib" \ libc_cv_initfini_array=yes \ diff --git a/toolchain/musl/patches/musl-x32.patch b/toolchain/musl/patches/musl-x32.patch new file mode 100644 index 000000000..c391e4c85 --- /dev/null +++ b/toolchain/musl/patches/musl-x32.patch @@ -0,0 +1,12 @@ +diff -Nur musl-0.9.15.orig/configure musl-0.9.15/configure +--- musl-0.9.15.orig/configure 2014-03-16 21:17:29.000000000 +0100 ++++ musl-0.9.15/configure 2014-03-16 22:46:46.000000000 +0100 +@@ -226,7 +226,7 @@ + mips64*|powerpc64*) fail "$0: unsupported target \"$target\"" ;; + arm*) ARCH=arm ;; + i?86*) ARCH=i386 ;; +-x86_64-x32*|x32*) ARCH=x32 ;; ++x86_64*x32) ARCH=x32 ;; + x86_64*) ARCH=x86_64 ;; + mips*) ARCH=mips ;; + microblaze*) ARCH=microblaze ;; -- cgit v1.2.3