From patchwork Mon Nov 19 10:22:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Diorcet X-Patchwork-Id: 199971 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 030CE2C009F for ; Mon, 19 Nov 2012 21:22:54 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sourceware.org; s=default; x=1353925375; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Content-Type:MIME-Version:Content-Transfer-Encoding: Subject:Message-Id:In-Reply-To:References:User-Agent:Date:From: To:Cc:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Subscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=MXJC8yB0HMuuApK1I058tjDUEt8=; b=juEyLbnvD/Zi8wD d2gCIT9xX4QrgxMq2qqVur00pZqYY2hi6hmSKdnJ9PjJcDGIbL+PGPt05ZBWUORi Ywr5r3PRQxx+Lipoa/tK8dtKQkrHYL/aw+sB1VM/HdV2YyTBmuCxgo2WNlqJl/s8 bs9y39HlDYIQEeePsFyI2WCSZp44= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=sourceware.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Content-Type:MIME-Version:Content-Transfer-Encoding:Subject:X-Mercurial-Node:Message-Id:In-Reply-To:References:User-Agent:Date:From:To:Cc:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=kftmIuYoSCs1TTTykFisEBTdzKAUTeD5Nb6tMzaZOz3BZ0m3LsFF7j4Yii6Z7e 116U4qfVzYVDqFyg6tyg8QIY5ii781CdrBYrCtPjUxQzk9QmmRTuS3uqVpPIVWYp GTDniBMpWf7FcNtydMbI3R3DToPHruY19wYACSMTSBFrw=; Received: (qmail 14830 invoked by alias); 19 Nov 2012 10:22:50 -0000 Received: (qmail 14820 invoked by uid 22791); 19 Nov 2012 10:22:49 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HK_OBFDOM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f169.google.com (HELO mail-we0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Nov 2012 10:22:37 +0000 Received: by mail-we0-f169.google.com with SMTP id u3so2126946wey.0 for ; Mon, 19 Nov 2012 02:22:35 -0800 (PST) Received: by 10.216.194.27 with SMTP id l27mr4465457wen.207.1353320555883; Mon, 19 Nov 2012 02:22:35 -0800 (PST) Received: from macbook-smorlat.local (vig38-2-81-56-113-2.fbx.proxad.net. [81.56.113.2]) by mx.google.com with ESMTPS id i6sm12670730wix.5.2012.11.19.02.22.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Nov 2012 02:22:35 -0800 (PST) MIME-Version: 1.0 Subject: [PATCH 2 of 2] Rework binutils in order to provide soon binutils alternative X-Mercurial-Node: d3d1d51f399e6d2c1163f2f3ace2e3cbc73b2324 Message-Id: In-Reply-To: <65c8bf534d0647ce52cd.1353320545@macbook-smorlat.local> References: <65c8bf534d0647ce52cd.1353320545@macbook-smorlat.local> User-Agent: Mercurial-patchbomb/2.3.1 Date: Mon, 19 Nov 2012 11:22:26 +0100 From: Yann Diorcet To: "Yann E. MORIN" Cc: crossgcc@sourceware.org X-IsSubscribed: yes Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org Delivered-To: mailing list crossgcc@sourceware.org # HG changeset patch # User Yann Diorcet (diorcet.yann@gmail.com) # Date 1353320491 -3600 # Node ID d3d1d51f399e6d2c1163f2f3ace2e3cbc73b2324 # Parent 65c8bf534d0647ce52cdb319b52dab2f81da5017 Rework binutils in order to provide soon binutils alternative config: now the binutils is choosen by a menu script: elf2flt script is merged in binutils.sh Signed-off-by: Yann Diorcet --- For unsubscribe information see http://sourceware.org/lists.html#faq diff -r 65c8bf534d06 -r d3d1d51f399e config/binutils.in --- a/config/binutils.in Mon Nov 19 11:19:54 2012 +0100 +++ b/config/binutils.in Mon Nov 19 11:21:31 2012 +0100 @@ -21,11 +21,12 @@ config ARCH_BINFMT_FLAT bool + depends on ! ARCH_USE_MMU prompt "Flat" help This will build flat binaries, suitable for MMU-less architectures. - + config ARCH_BINFMT_FDPIC bool prompt "FD_PIC ELF" @@ -33,12 +34,14 @@ This will build FD_PIC ELF binaries, suitable for MMU-less architectures that still require to use shared libraries (FIXME). - endif # ! ARCH_USE_MMU endchoice -source "config/binutils/binutils.in" -source "config/binutils/elf2flt.in" +config BINUTILS + string + +source "config.gen/binutils.in" +source "config.gen/binutils.in.2" endmenu diff -r 65c8bf534d06 -r d3d1d51f399e config/binutils/binutils.in --- a/config/binutils/binutils.in Mon Nov 19 11:19:54 2012 +0100 +++ b/config/binutils/binutils.in Mon Nov 19 11:21:31 2012 +0100 @@ -117,6 +117,8 @@ config BINUTILS_GOLD_SUPPORTS_ARCH bool + default y if ARCH_arm + default y if ARCH_x86 config BINUTILS_HAS_PLUGINS bool @@ -124,13 +126,6 @@ config BINUTILS_HAS_PKGVERSION_BUGURL bool -# Only these architectures have support in gold -config ARCH_arm - select BINUTILS_GOLD_SUPPORTS_ARCH - -config ARCH_x86 - select BINUTILS_GOLD_SUPPORTS_ARCH - # Force using the BFD linker if needed # This is the case for some C libraries (eg. glibc and # eglibc at least) and affected components can select this diff -r 65c8bf534d06 -r d3d1d51f399e config/binutils/binutils.in.2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/binutils/binutils.in.2 Mon Nov 19 11:21:31 2012 +0100 @@ -0,0 +1,51 @@ +# elf2flt options + +if ARCH_BINFMT_FLAT + +comment "elf2flt" + +choice + bool + prompt "elf2flt version" +# Don't remove next line +# CT_INSERT_VERSION_BELOW + +config ELF2FLT_CVSHEAD + bool + prompt "CVS Head" + help + Grab the latest version of elf2flt from the CVS repository + +config ELF2FLT_CVS_SNAPSHOT + bool + prompt "CVS Snapshot" + +endchoice + +config ELF2FLT_CVS_SNAPSHOT_SPEC + string + depends on ELF2FLT_CVS_SNAPSHOT + default "" + prompt "CVS refspec for elf2flt" + help + What you enter here will be passed verbatim to the cvs checkout command + so be careful! + +config ELF2FLT_VERSION + string + default "head" if ELF2FLT_CVSHEAD +# Don't remove next line +# CT_INSERT_VERSION_STRING_BELOW + +config ELF2FLT_EXTRA_CONFIG_ARRAY + string + prompt "elf2flt extra config" + default "" + help + Extra flags passed onto ./configure when configuring + + You can enter multiple arguments here, and arguments can contain spaces + if they are properly quoted (or escaped, but prefer quotes). Eg.: + --with-foo="1st arg with 4 spaces" --with-bar=2nd-arg-without-space + +endif diff -r 65c8bf534d06 -r d3d1d51f399e config/config.mk --- a/config/config.mk Mon Nov 19 11:19:54 2012 +0100 +++ b/config/config.mk Mon Nov 19 11:21:31 2012 +0100 @@ -15,20 +15,23 @@ $(STATIC_CONFIG_FILES): config # Build a list of per-component-type source config files -ARCH_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in)) -ARCH_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in.2)) -KERNEL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in)) -KERNEL_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in.2)) -CC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in)) -CC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in.2)) -LIBC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in)) -LIBC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in.2)) -DEBUG_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in)) +ARCH_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in)) +ARCH_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in.2)) +KERNEL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in)) +KERNEL_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in.2)) +CC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in)) +CC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in.2)) +BINUTILS_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/binutils/*.in)) +BINUTILS_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/binutils/*.in.2)) +LIBC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in)) +LIBC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in.2)) +DEBUG_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in)) # Build the list of generated config files GEN_CONFIG_FILES = config.gen/arch.in \ config.gen/kernel.in \ config.gen/cc.in \ + config.gen/binutils.in \ config.gen/libc.in \ config.gen/debug.in # ... and how to access them: @@ -58,11 +61,12 @@ #----------------------------------------------------------- # Build list of per-component-type items to easily build generated files -ARCHS = $(patsubst config/arch/%.in,%,$(ARCH_CONFIG_FILES)) -KERNELS = $(patsubst config/kernel/%.in,%,$(KERNEL_CONFIG_FILES)) -CCS = $(patsubst config/cc/%.in,%,$(CC_CONFIG_FILES)) -LIBCS = $(patsubst config/libc/%.in,%,$(LIBC_CONFIG_FILES)) -DEBUGS = $(patsubst config/debug/%.in,%,$(DEBUG_CONFIG_FILES)) +ARCHS = $(patsubst config/arch/%.in,%,$(ARCH_CONFIG_FILES)) +KERNELS = $(patsubst config/kernel/%.in,%,$(KERNEL_CONFIG_FILES)) +CCS = $(patsubst config/cc/%.in,%,$(CC_CONFIG_FILES)) +BINUTILSS = $(patsubst config/binutils/%.in,%,$(BINUTILS_CONFIG_FILES)) +LIBCS = $(patsubst config/libc/%.in,%,$(LIBC_CONFIG_FILES)) +DEBUGS = $(patsubst config/debug/%.in,%,$(DEBUG_CONFIG_FILES)) #----------------------------------------------------------- # The rules for the generated config files @@ -81,6 +85,10 @@ @$(ECHO) ' IN $(@)' $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C compiler" "CC" "config/cc" "N" $(CCS) +config.gen/binutils.in: $(CC_BINUTILS_FILES) $(CC_BINUTILS_FILES_2) + @$(ECHO) ' IN $(@)' + $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Binutils" "BINUTILS" "config/binutils" "N" $(BINUTILSS) + config.gen/libc.in: $(LIBC_CONFIG_FILES) $(LIBC_CONFIG_FILES_2) @$(ECHO) ' IN $(@)' $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C library" "LIBC" "config/libc" "Y" $(LIBCS) diff -r 65c8bf534d06 -r d3d1d51f399e scripts/build/binutils/binutils.sh --- a/scripts/build/binutils/binutils.sh Mon Nov 19 11:19:54 2012 +0100 +++ b/scripts/build/binutils/binutils.sh Mon Nov 19 11:21:31 2012 +0100 @@ -12,6 +12,14 @@ {ftp,http}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils \ ftp://gcc.gnu.org/pub/binutils/{releases,snapshots} fi + + if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then + CT_GetCVS "elf2flt-cvs-${CT_ELF2FLT_VERSION}" \ + ":pserver:anonymous@cvs.uclinux.org:/var/cvs" \ + "elf2flt" \ + "" \ + "elf2flt-cvs-${CT_ELF2FLT_VERSION}" + fi } # Extract binutils @@ -24,6 +32,11 @@ CT_Extract "binutils-${CT_BINUTILS_VERSION}" CT_Patch "binutils" "${CT_BINUTILS_VERSION}" + + if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then + CT_Extract "elf2flt-cvs-${CT_ELF2FLT_VERSION}" + CT_Patch "elf2flt-cvs" "${CT_ELF2FLT_VERSION}" + fi } # Build binutils for build -> target @@ -41,10 +54,21 @@ binutils_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) binutils_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" ) binutils_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" ) + binutils_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_HOST}" ) + binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}" ) do_binutils_backend "${binutils_opts[@]}" CT_Popd + + if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then + CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}" + + do_elf2flt_backend "${binutils_opts[@]}" + + CT_Popd + fi + CT_EndStep } @@ -52,7 +76,7 @@ do_binutils_for_host() { local -a binutils_tools local -a binutils_opts - + CT_DoStep INFO "Installing binutils for host" CT_mkdir_pushd "${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" @@ -62,9 +86,20 @@ binutils_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) binutils_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) binutils_opts+=( "build_manuals=${CT_BUILD_MANUALS}" ) + binutils_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" ) do_binutils_backend "${binutils_opts[@]}" + CT_Popd + + if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then + CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-host-${CT_HOST}" + + do_elf2flt_backend "${binutils_opts[@]}" + + CT_Popd + fi + # Make those new tools available to the core C compilers to come. # Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as # well. Create that. @@ -73,6 +108,9 @@ case "${CT_TOOLCHAIN_TYPE}" in cross|native) binutils_tools=( ar as ld strip ) + if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then + binutils_tools+=( elf2flt flthdr ) + fi case "${CT_BINUTILS_LINKERS_LIST}" in ld) binutils_tools+=( ld.bfd ) ;; gold) binutils_tools+=( ld.gold ) ;; @@ -93,7 +131,6 @@ *) ;; esac - CT_Popd CT_EndStep } @@ -218,6 +255,50 @@ fi } +# Build elf2flt for X -> target +# Parameter : description : type : default +# host : machine to run on : tuple : (none) +# prefix : prefix to install into : dir : (none) +# static_build : build statcially : bool : no +# cflags : cflags to use : string : (empty) +# ldflags : ldflags to use : string : (empty) +do_elf2flt_backend() { + local host + local prefix + local static_build + local cflags + local ldflags + local binutils_bld + local binutils_src + local arg + + for arg in "$@"; do + eval "${arg// /\\ }" + done + + CT_DoLog EXTRA "Configuring elf2flt" + CT_DoExecLog CFG \ + CFLAGS="${cflags}" \ + LDFLAGS="${ldflags}" \ + "${CT_SRC_DIR}/elf2flt-cvs-${CT_ELF2FLT_VERSION}/configure" \ + --build=${CT_BUILD} \ + --host=${host} \ + --target=${CT_TARGET} \ + --prefix=${prefix} \ + --with-bfd-include-dir=${binutils_bld}/bfd \ + --with-binutils-include-dir=${binutils_src}/include \ + --with-libbfd=${binutils_bld}/bfd/libbfd.a \ + --with-libiberty=${binutils_bld}/libiberty/libiberty.a \ + ${elf2flt_opts} \ + "${CT_ELF2FLT_EXTRA_CONFIG_ARRAY[@]}" + + CT_DoLog EXTRA "Building elf2flt" + CT_DoExecLog ALL make ${JOBSFLAGS} + + CT_DoLog EXTRA "Installing elf2flt" + CT_DoExecLog ALL make install +} + # Now on for the target libraries do_binutils_for_target() { local -a extra_config diff -r 65c8bf534d06 -r d3d1d51f399e scripts/crosstool-NG.sh.in --- a/scripts/crosstool-NG.sh.in Mon Nov 19 11:19:54 2012 +0100 +++ b/scripts/crosstool-NG.sh.in Mon Nov 19 11:21:31 2012 +0100 @@ -127,8 +127,7 @@ . "${CT_LIB_DIR}/scripts/build/companion_tools.sh" . "${CT_LIB_DIR}/scripts/build/kernel/${CT_KERNEL}.sh" . "${CT_LIB_DIR}/scripts/build/companion_libs.sh" -. "${CT_LIB_DIR}/scripts/build/binutils/binutils.sh" -. "${CT_LIB_DIR}/scripts/build/binutils/elf2flt.sh" +. "${CT_LIB_DIR}/scripts/build/binutils/${CT_BINUTILS}.sh" . "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh" . "${CT_LIB_DIR}/scripts/build/cc/${CT_CC}.sh" . "${CT_LIB_DIR}/scripts/build/debug.sh" @@ -545,7 +544,6 @@ do_kernel_get do_companion_libs_get do_binutils_get - do_elf2flt_get do_cc_get do_libc_get do_debug_get @@ -569,7 +567,6 @@ do_kernel_extract do_companion_libs_extract do_binutils_extract - do_elf2flt_extract do_cc_extract do_libc_extract do_debug_extract diff -r 65c8bf534d06 -r d3d1d51f399e steps.mk --- a/steps.mk Mon Nov 19 11:19:54 2012 +0100 +++ b/steps.mk Mon Nov 19 11:21:31 2012 +0100 @@ -21,10 +21,8 @@ CT_STEPS := libc_check_config \ companion_libs_for_build \ binutils_for_build \ - elf2flt_for_build \ companion_libs_for_host \ binutils_for_host \ - elf2flt_for_host \ cc_core_pass_1 \ kernel_headers \ libc_start_files \