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.
This commit is contained in:
Yann E. MORIN" 2010-02-17 23:41:17 +01:00
parent 2949150cbe
commit 991b90f242
7 changed files with 119 additions and 49 deletions

View File

@ -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

View File

@ -1,10 +1,5 @@
# 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"

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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 \