# HG changeset patch # User "Yann E. MORIN" # Date 1266446477 -3600 # Node ID 35cf5e2f110a0416cf10351c13dfb871197ef2bf # Parent e44f67656c5f577bb52ea7566ac9c45838eb33f5 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 -r e44f67656c5f -r 35cf5e2f110a config/companion_libs.in --- a/config/companion_libs.in Wed Feb 17 23:50:49 2010 +0100 +++ b/config/companion_libs.in Wed Feb 17 23:41:17 2010 +0100 @@ -100,6 +100,20 @@ 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 @@ 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 @@ 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 -r e44f67656c5f -r 35cf5e2f110a config/companion_libs/libelf.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/companion_libs/libelf.in Wed Feb 17 23:41:17 2010 +0100 @@ -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 -r e44f67656c5f -r 35cf5e2f110a config/debug/ltrace.in --- a/config/debug/ltrace.in Wed Feb 17 23:50:49 2010 +0100 +++ b/config/debug/ltrace.in Wed Feb 17 23:41:17 2010 +0100 @@ -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 -r e44f67656c5f -r 35cf5e2f110a config/tools/libelf.in --- a/config/tools/libelf.in Wed Feb 17 23:50:49 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -r e44f67656c5f -r 35cf5e2f110a scripts/build/companion_libs/libelf.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/build/companion_libs/libelf.sh Wed Feb 17 23:41:17 2010 +0100 @@ -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 -r e44f67656c5f -r 35cf5e2f110a scripts/build/tools/100-libelf.sh --- a/scripts/build/tools/100-libelf.sh Wed Feb 17 23:50:49 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -r e44f67656c5f -r 35cf5e2f110a scripts/crosstool-NG.sh.in --- a/scripts/crosstool-NG.sh.in Wed Feb 17 23:50:49 2010 +0100 +++ b/scripts/crosstool-NG.sh.in Wed Feb 17 23:41:17 2010 +0100 @@ -118,6 +118,7 @@ . "${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 @@ 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 @@ do_ppl_extract do_cloog_extract do_mpc_extract + do_libelf_extract do_binutils_extract do_elf2flt_extract do_cc_extract diff -r e44f67656c5f -r 35cf5e2f110a steps.mk --- a/steps.mk Wed Feb 17 23:50:49 2010 +0100 +++ b/steps.mk Wed Feb 17 23:41:17 2010 +0100 @@ -23,6 +23,7 @@ ppl \ cloog \ mpc \ + libelf \ binutils \ elf2flt \ cc_core_pass_1 \ @@ -34,6 +35,7 @@ libc_finish \ gmp_target \ mpfr_target \ + libelf_target \ binutils_target \ tools \ debug \