This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See crosstool-NG for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2 of 2] Rework binutils in order to provide soon binutils alternative


# 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 <diorcet.yann@gmail.com>

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         \

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]