diff options
-rw-r--r-- | mk/vars.mk | 34 | ||||
-rw-r--r-- | package/binutils/Makefile | 6 | ||||
-rw-r--r-- | package/glibc/Makefile | 6 | ||||
-rw-r--r-- | package/strace/patches/patch-desc_c | 14 | ||||
-rw-r--r-- | target/config/Config.in | 11 | ||||
-rw-r--r-- | target/microblaze/sys-available/qemu-microblaze | 1 | ||||
-rw-r--r-- | target/microblaze/sys-available/qemu-microblazeel | 1 | ||||
-rw-r--r-- | toolchain/Config.in | 8 | ||||
-rw-r--r-- | toolchain/binutils/Makefile | 7 | ||||
-rw-r--r-- | toolchain/gcc/Makefile | 41 | ||||
-rw-r--r-- | toolchain/glibc/Makefile | 6 | ||||
-rw-r--r-- | toolchain/glibc/Makefile.inc | 20 | ||||
-rw-r--r-- | toolchain/musl/patches/musl-x32.patch | 12 |
13 files changed, 99 insertions, 68 deletions
diff --git a/mk/vars.mk b/mk/vars.mk index 5fd4a51aa..cebfe7677 100644 --- a/mk/vars.mk +++ b/mk/vars.mk @@ -21,7 +21,7 @@ TOOLS_BUILD_DIR= $(BASE_DIR)/tools_build SCRIPT_DIR:= $(BASE_DIR)/scripts STAGING_HOST_DIR:= ${BASE_DIR}/host_${GNU_HOST_NAME} -# PFX dirs for cleandir +# dirs for cleandir FW_DIR_PFX:= $(BASE_DIR)/firmware BUILD_DIR_PFX:= $(BASE_DIR)/build_* STAGING_PKG_DIR_PFX:= ${BASE_DIR}/pkg_* @@ -56,18 +56,13 @@ TARGET_PATH= ${SCRIPT_DIR}:${STAGING_TARGET_DIR}/scripts:${STAGING_HOST_DIR}/bi HOST_PATH= ${SCRIPT_DIR}:${STAGING_HOST_DIR}/bin:${STAGING_HOST_DIR}/usr/bin:${_PATH} AUTOTOOL_PATH= ${STAGING_HOST_DIR}/bin:${STAGING_HOST_DIR}/usr/bin:${STAGING_TARGET_DIR}/scripts:${_PATH} -ifeq ($(ADK_TARGET_ABI_X32),y) -GNU_TARGET_NAME= $(CPU_ARCH)-x32-linux-$(ADK_TARGET_SUFFIX) -else -GNU_TARGET_NAME= $(CPU_ARCH)-$(ADK_VENDOR)-linux-$(ADK_TARGET_SUFFIX) -endif - ifeq ($(ADK_DISABLE_HONOUR_CFLAGS),) GCC_CHECK:= GCC_HONOUR_COPTS=2 else GCC_CHECK:= endif +GNU_TARGET_NAME:= $(CPU_ARCH)-$(ADK_VENDOR)-linux-$(ADK_TARGET_SUFFIX) TARGET_CROSS:= $(STAGING_HOST_DIR)/bin/$(GNU_TARGET_NAME)- TARGET_COMPILER_PREFIX?=${TARGET_CROSS} CONFIGURE_TRIPLE:= --build=${GNU_HOST_NAME} --host=${GNU_TARGET_NAME} --target=${GNU_TARGET_NAME} @@ -76,10 +71,17 @@ ifneq ($(strip ${ADK_USE_CCACHE}),) TARGET_COMPILER_PREFIX=ccache ${TARGET_CROSS} endif -# target compiler flags +# target tools TARGET_CC:= ${TARGET_COMPILER_PREFIX}gcc TARGET_CXX:= ${TARGET_COMPILER_PREFIX}g++ TARGET_LD:= ${TARGET_COMPILER_PREFIX}ld +TARGET_AR:= ${TARGET_COMPILER_PREFIX}ar +TARGET_RANLIB:= ${TARGET_COMPILER_PREFIX}ranlib + +ifneq ($(ADK_TARGET_ABI_CFLAGS),) +TARGET_CC+= $(ADK_TARGET_ABI_CFLAGS) +TARGET_CXX+= $(ADK_TARGET_ABI_CFLAGS) +endif MODE_FLAGS:= ifeq ($(ADK_LINUX_ARM),y) @@ -91,13 +93,13 @@ endif endif TARGET_CPPFLAGS:= -TARGET_CFLAGS:= $(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident -fhonour-copts $(ADK_TARGET_ABI_CFLAGS) $(MODE_FLAGS) -TARGET_CFLAGS_LIBC:= $(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident -fhonour-copts $(TARGET_OPTIMIZATION) $(MODE_FLAGS) -TARGET_CXXFLAGS:= $(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident $(MODE_FLAGS) +TARGET_CFLAGS:= $(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident -fhonour-copts +TARGET_CXXFLAGS:= $(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident TARGET_LDFLAGS:= -L$(STAGING_TARGET_DIR)/lib -L$(STAGING_TARGET_DIR)/usr/lib \ -Wl,-O1 -Wl,-rpath -Wl,/usr/lib \ -Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib \ $(ADK_TARGET_ABI_LDFLAGS) + # security optimization, see http://www.akkadia.org/drepper/dsohowto.pdf TARGET_LDFLAGS+= -Wl,-z,relro,-z,now # needed for musl ppc @@ -130,6 +132,10 @@ TARGET_CFLAGS+= -fno-unwind-tables -fno-asynchronous-unwind-tables TARGET_CFLAGS+= -g3 endif +ifneq ($(MODE_FLAGS),) +TARGET_CFLAGS+= $(MODE_CFLAGS) +TARGET_CXXFLAGS+= $(MODE_CFLAGS) +endif # A nifty macro to make testing gcc features easier (from uClibc project) check_gcc=$(shell \ @@ -150,9 +156,11 @@ PATCH= ${BASH} $(SCRIPT_DIR)/patch.sh SED:= PATH=${HOST_PATH} sed -i -e LINUX_DIR:= $(BUILD_DIR)/linux KERNEL_MODULE_FLAGS:= ARCH=${ARCH} \ - KERNEL_PATH=${LINUX_DIR} KERNELDIR=${LINUX_DIR} KERNEL_DIR=${LINUX_DIR} \ + KERNEL_PATH=${LINUX_DIR} \ + KERNELDIR=${LINUX_DIR} \ + KERNEL_DIR=${LINUX_DIR} \ PREFIX=/usr CROSS_COMPILE="${TARGET_CROSS}" \ - LDFLAGS="$(ADK_TARGET_KERNEL_LDFLAGS)" CFLAGS_MODULE="-fhonour-copts" V=1 + CFLAGS_MODULE="-fhonour-copts" V=1 TARGET_CONFIGURE_OPTS= PATH='${TARGET_PATH}' \ AR='$(TARGET_CROSS)ar' \ diff --git a/package/binutils/Makefile b/package/binutils/Makefile index c23bac585..5734e198d 100644 --- a/package/binutils/Makefile +++ b/package/binutils/Makefile @@ -25,10 +25,10 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,BINUTILS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBBFD,libbfd,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBBFD},${PKGSC_LIBBFD},${PKG_OPTS})) -ifeq ($(ADK_TARGET_WITH_MULTILIB),y) -CONFIGURE_ARGS+= --enable-multilib -else +ifeq ($(ADK_LINUX_SH)$(ADK_LINUX_X86_64),) CONFIGURE_ARGS+= --disable-multilib +else +CONFIGURE_ARGS+= --enable-multilib endif TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) diff --git a/package/glibc/Makefile b/package/glibc/Makefile index 17c49f3af..92ccf8cd4 100644 --- a/package/glibc/Makefile +++ b/package/glibc/Makefile @@ -31,10 +31,10 @@ INSTALL_STYLE:= manual # compile nothing, glibc is already build in toolchain directory do-install: ${INSTALL_DIR} ${IDIR_GLIBC}/$(ADK_TARGET_LIBC_PATH) - $(CP) $(STAGING_TARGET_DIR)/lib/ld*.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH) + $(CP) $(STAGING_TARGET_DIR)/$(ADK_TARGET_LIBC_PATH)/ld*.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH) for file in libc libcrypt libdl libm libnsl libresolv libutil libnss_compat libnss_dns libnss_files; do \ - $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \ - $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \ + $(CP) $(STAGING_TARGET_DIR)/$(ADK_TARGET_LIBC_PATH)/$$file.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \ + $(CP) $(STAGING_TARGET_DIR)/$(ADK_TARGET_LIBC_PATH)/$$file-$(PKG_VERSION).so $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \ done ${INSTALL_DIR} $(IDIR_GLIBC)/usr/bin $(CP) $(STAGING_TARGET_DIR)/usr/bin/getconf $(IDIR_GLIBC)/usr/bin diff --git a/package/strace/patches/patch-desc_c b/package/strace/patches/patch-desc_c index 9cfb5f505..63a01023e 100644 --- a/package/strace/patches/patch-desc_c +++ b/package/strace/patches/patch-desc_c @@ -1,5 +1,5 @@ --- strace-4.8.orig/desc.c 2013-05-02 00:39:10.000000000 +0200 -+++ strace-4.8/desc.c 2014-02-25 15:16:36.000000000 +0100 ++++ strace-4.8/desc.c 2014-03-01 19:44:21.000000000 +0100 @@ -223,7 +223,7 @@ static const struct xlat perf_event_open { 0, NULL }, }; @@ -9,3 +9,15 @@ /* fcntl/lockf */ static void printflock64(struct tcb *tcp, long addr, int getlk) +@@ -255,7 +255,11 @@ printflock(struct tcb *tcp, long addr, i + #if SUPPORTED_PERSONALITIES > 1 + # ifdef X32 + if (current_personality == 0) { ++#if defined(__GLIBC__) + printflock64(tcp, addr, getlk); ++#else ++ printflock(tcp, addr, getlk); ++#endif + return; + } + # endif diff --git a/target/config/Config.in b/target/config/Config.in index d2d5b6671..c3512a71f 100644 --- a/target/config/Config.in +++ b/target/config/Config.in @@ -578,17 +578,6 @@ config ADK_TARGET_ABI_CFLAGS default "-mx32" if ADK_x32 default "-m64" if ADK_64 -config ADK_TARGET_ABI_LDFLAGS - string - default "-Wl,-m -Wl,elf_i386" if ADK_32 - -config ADK_TARGET_KERNEL_LDFLAGS - string - default "-mabi=64" if ADK_n32 && ADK_TARGET_KERNEL64 - default "-mabi=64" if ADK_o32 && ADK_TARGET_KERNEL64 - default "-mabi=64" if ADK_n64 && ADK_TARGET_KERNEL64 - default "" - config ADK_TARGET_CFLAGS string default "-march=geode" if ADK_CPU_GEODE diff --git a/target/microblaze/sys-available/qemu-microblaze b/target/microblaze/sys-available/qemu-microblaze index a964cf924..63214e39b 100644 --- a/target/microblaze/sys-available/qemu-microblaze +++ b/target/microblaze/sys-available/qemu-microblaze @@ -5,7 +5,6 @@ config ADK_TARGET_SYSTEM_QEMU_MICROBLAZE select ADK_qemu_microblaze select ADK_HARDWARE_QEMU select ADK_TARGET_KERNEL_LINUXBIN - select ADK_TOOLCHAIN_GCC_SJLJ help Qemu support for microblaze big endian architecture. diff --git a/target/microblaze/sys-available/qemu-microblazeel b/target/microblaze/sys-available/qemu-microblazeel index 4ee4229d2..a58083770 100644 --- a/target/microblaze/sys-available/qemu-microblazeel +++ b/target/microblaze/sys-available/qemu-microblazeel @@ -5,7 +5,6 @@ config ADK_TARGET_SYSTEM_QEMU_MICROBLAZEEL select ADK_little select ADK_HARDWARE_QEMU select ADK_TARGET_KERNEL_LINUXBIN - select ADK_TOOLCHAIN_GCC_SJLJ help Qemu support for microblaze little endian architecture. 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 ;; |