summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/companion_libs.in22
-rw-r--r--config/companion_libs/libelf.in (renamed from config/tools/libelf.in)5
-rw-r--r--config/debug/ltrace.in2
-rw-r--r--scripts/build/companion_libs/libelf.sh91
-rw-r--r--scripts/build/tools/100-libelf.sh43
-rw-r--r--scripts/crosstool-NG.sh.in3
-rw-r--r--steps.mk2
7 files changed, 119 insertions, 49 deletions
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/tools/libelf.in b/config/companion_libs/libelf.in
index f195868..9cc76b8 100644
--- a/config/tools/libelf.in
+++ b/config/companion_libs/libelf.in
@@ -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"
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/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 \