From 991b90f2425a6f14115efee2456919063d4e1a2b Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Wed, 17 Feb 2010 23:41:17 +0100 Subject: comp-libs: make libelf a companion library When gcc-4.5 is out, it will require libelf. So better make it a companion library now rather than postponing the ineluctable. diff --git a/config/companion_libs.in b/config/companion_libs.in index e230cf9..86c9706 100644 --- a/config/companion_libs.in +++ b/config/companion_libs.in @@ -100,6 +100,20 @@ config MPC can say 'Y' here, although it is unknown yet if any other component can use it. +config LIBELF + bool +# prompt "libelf" + select COMPLIBS + select WRAPPER_NEEDED + help + gcc-4.5.0 and above can also use libelf to enable some optimisation + (LTO, Link-Time Optimisation, to be precise). Although libelf is + optional, crosstool-NG requires it and uses it to build gcc >= 4.5.0. + + This will be automatically selected if you choose gcc>=4.5.0, but you + can say 'Y' here, although it is unknown yet if any other component + can use it. + config GMP_TARGET bool @@ -125,6 +139,9 @@ config MPC_TARGET select PPL_TARGET select CLOOG_TARGET +config LIBELF_TARGET + bool + if GMP || GMP_TARGET comment "GMP version needed to build for target" depends on !GMP @@ -150,6 +167,11 @@ comment "MPC version needed to build for target" depends on !MPC source config/companion_libs/mpc.in endif +if LIBELF || LIBELF_TARGET +comment "libelf version needed to build for target" + depends on !LIBELF +source config/companion_libs/libelf.in +endif config FOO bool diff --git a/config/companion_libs/libelf.in b/config/companion_libs/libelf.in new file mode 100644 index 0000000..9cc76b8 --- /dev/null +++ b/config/companion_libs/libelf.in @@ -0,0 +1,30 @@ +# libelf config file + +choice + bool + prompt "libelf version" +# Don't remove next line +# CT_INSERT_VERSION_BELOW + +config LIBELF_V_0_8_12 + bool + prompt "0.8.12" + +config LIBELF_V_0_8_11 + bool + prompt "0.8.11" + +config LIBELF_V_0_8_10 + bool + prompt "0.8.10 (OBSOLETE)" + depends on OBSOLETE + +endchoice + +config LIBELF_VERSION + string +# Don't remove next line +# CT_INSERT_VERSION_STRING_BELOW + default "0.8.12" if LIBELF_V_0_8_12 + default "0.8.11" if LIBELF_V_0_8_11 + default "0.8.10" if LIBELF_V_0_8_10 diff --git a/config/debug/ltrace.in b/config/debug/ltrace.in index 850ee74..bddc568 100644 --- a/config/debug/ltrace.in +++ b/config/debug/ltrace.in @@ -1,7 +1,7 @@ # ltrace config DEBUG_ltrace - select TOOL_libelf + select LIBELF_TARGET help ltrace is a program that simply runs the specified command until it exits. It intercepts and records the dynamic library calls which are called by diff --git a/config/tools/libelf.in b/config/tools/libelf.in deleted file mode 100644 index f195868..0000000 --- a/config/tools/libelf.in +++ /dev/null @@ -1,35 +0,0 @@ -# libelf config file - -config TOOL_libelf - help - libelf lets you read, modify or create ELF files in an - architecture-independent way. - -choice - bool - prompt "libelf version" -# Don't remove next line -# CT_INSERT_VERSION_BELOW - -config LIBELF_V_0_8_12 - bool - prompt "0.8.12" - -config LIBELF_V_0_8_11 - bool - prompt "0.8.11" - -config LIBELF_V_0_8_10 - bool - prompt "0.8.10 (OBSOLETE)" - depends on OBSOLETE - -endchoice - -config LIBELF_VERSION - string -# Don't remove next line -# CT_INSERT_VERSION_STRING_BELOW - default "0.8.12" if LIBELF_V_0_8_12 - default "0.8.11" if LIBELF_V_0_8_11 - default "0.8.10" if LIBELF_V_0_8_10 diff --git a/scripts/build/companion_libs/libelf.sh b/scripts/build/companion_libs/libelf.sh new file mode 100644 index 0000000..ecda8ff --- /dev/null +++ b/scripts/build/companion_libs/libelf.sh @@ -0,0 +1,91 @@ +# Build script for libelf + +do_libelf_get() { :; } +do_libelf_extract() { :; } +do_libelf() { :; } +do_libelf_target() { :; } + +if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then + +do_libelf_get() { + # The server hosting libelf will return an "HTTP 300 : Multiple Choices" + # error code if we try to download a file that does not exists there. + # So we have to request the file with an explicit extension. + CT_GetFile "libelf-${CT_LIBELF_VERSION}" .tar.gz http://www.mr511.de/software/ +} + +do_libelf_extract() { + CT_Extract "libelf-${CT_LIBELF_VERSION}" + CT_Patch "libelf-${CT_LIBELF_VERSION}" +} + +if [ "${CT_LIBELF}" = "y" ]; then + +# Uncomment when we need it for gcc-4.5 +# WARNING! This function is absolutely UNTESTED yet! +do_libelf() { + : # Remove this line! +# CT_DoStep INFO "Installing libelf" +# mkdir -p "${CT_BUILD_DIR}/build-libelf" +# CT_Pushd "${CT_BUILD_DIR}/build-libelf" +# +# CT_DoLog EXTRA "Configuring libelf" +# CC="${CT_TARGET}-gcc" \ +# CT_DoExecLog ALL \ +# "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \ +# --build=${CT_BUILD} \ +# --host=${CT_HOST} \ +# --target=${CT_TARGET} \ +# --prefix="${CT_PREFIX_DIR}" \ +# --enable-compat \ +# --enable-elf64 \ +# --enable-static \ +# --enable-shared \ +# --enable-extended-format +# +# CT_DoLog EXTRA "Building libelf" +# CT_DoExecLog ALL make +# +# CT_DoLog EXTRA "Installing libelf" +# CT_DoExecLog ALL make instroot="${CT_SYSROOT_DIR}" install +# +# CT_Popd +# CT_EndStep +} + +fi # CT_LIBELF + +if [ "${CT_LIBELF_TARGET}" = "y" ]; then + +do_libelf_target() { + CT_DoStep INFO "Installing libelf for the target" + mkdir -p "${CT_BUILD_DIR}/build-libelf" + CT_Pushd "${CT_BUILD_DIR}/build-libelf" + + CT_DoLog EXTRA "Configuring libelf" + CC="${CT_TARGET}-gcc" \ + CT_DoExecLog ALL \ + "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \ + --build=${CT_BUILD} \ + --host=${CT_TARGET} \ + --target=${CT_TARGET} \ + --prefix=/usr \ + --enable-compat \ + --enable-elf64 \ + --enable-shared \ + --enable-extended-format \ + --enable-static + + CT_DoLog EXTRA "Building libelf" + CT_DoExecLog ALL make + + CT_DoLog EXTRA "Installing libelf" + CT_DoExecLog ALL make instroot="${CT_SYSROOT_DIR}" install + + CT_Popd + CT_EndStep +} + +fi # CT_LIBELF_TARGET + +fi # CT_LIBELF || CT_LIBELF_TARGET diff --git a/scripts/build/tools/100-libelf.sh b/scripts/build/tools/100-libelf.sh deleted file mode 100644 index 2ee9292..0000000 --- a/scripts/build/tools/100-libelf.sh +++ /dev/null @@ -1,43 +0,0 @@ -# Build script for libelf - -do_tools_libelf_get() { - # The server hosting libelf will return an "HTTP 300 : Multiple Choices" - # error code if we try to download a file that does not exists there. - # So we have to request the file with an explicit extension. - CT_GetFile "libelf-${CT_LIBELF_VERSION}" .tar.gz http://www.mr511.de/software/ -} - -do_tools_libelf_extract() { - CT_Extract "libelf-${CT_LIBELF_VERSION}" - CT_Patch "libelf-${CT_LIBELF_VERSION}" -} - -do_tools_libelf_build() { - CT_DoStep INFO "Installing libelf" - mkdir -p "${CT_BUILD_DIR}/build-libelf" - CT_Pushd "${CT_BUILD_DIR}/build-libelf" - - CT_DoLog EXTRA "Configuring libelf" - CC="${CT_TARGET}-gcc" \ - CT_DoExecLog ALL \ - "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \ - --build=${CT_BUILD} \ - --host=${CT_TARGET} \ - --target=${CT_TARGET} \ - --prefix=/usr \ - --enable-compat \ - --enable-elf64 \ - --enable-shared \ - --enable-extended-format \ - --enable-static - - CT_DoLog EXTRA "Building libelf" - CT_DoExecLog ALL make - - CT_DoLog EXTRA "Installing libelf" - CT_DoExecLog ALL make instroot="${CT_SYSROOT_DIR}" install - - CT_Popd - CT_EndStep -} - diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index 34d1f69..69b1072 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -118,6 +118,7 @@ CT_DoLog INFO "Building environment variables" . "${CT_LIB_DIR}/scripts/build/companion_libs/ppl.sh" . "${CT_LIB_DIR}/scripts/build/companion_libs/cloog.sh" . "${CT_LIB_DIR}/scripts/build/companion_libs/mpc.sh" +. "${CT_LIB_DIR}/scripts/build/companion_libs/libelf.sh" . "${CT_LIB_DIR}/scripts/build/binutils/binutils.sh" . "${CT_LIB_DIR}/scripts/build/binutils/elf2flt.sh" . "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh" @@ -500,6 +501,7 @@ if [ -z "${CT_RESTART}" ]; then do_ppl_get do_cloog_get do_mpc_get + do_libelf_get do_binutils_get do_elf2flt_get do_cc_get @@ -529,6 +531,7 @@ if [ -z "${CT_RESTART}" ]; then do_ppl_extract do_cloog_extract do_mpc_extract + do_libelf_extract do_binutils_extract do_elf2flt_extract do_cc_extract diff --git a/steps.mk b/steps.mk index ba90f79..018927e 100644 --- a/steps.mk +++ b/steps.mk @@ -23,6 +23,7 @@ CT_STEPS := libc_check_config \ ppl \ cloog \ mpc \ + libelf \ binutils \ elf2flt \ cc_core_pass_1 \ @@ -34,6 +35,7 @@ CT_STEPS := libc_check_config \ libc_finish \ gmp_target \ mpfr_target \ + libelf_target \ binutils_target \ tools \ debug \ -- cgit v0.10.2-6-g49f6