Have the glibc build use the cross-objdump, rather than the host one.

On some distros (eg. Fedora), the native objdump can not interpret objects not for the native system, and thus fail.
This commit adds a new patch against glibc-2.7 that introduces OBJDUMP_FOR_HOST, wich, if set, overides the detected objdump.

Note: bizarely enough, glibc already has code to detect the cross-objdump, but that does not work for an unknown reason... :-(

 /trunk/patches/glibc/2.7/220-objdump_for_host.patch |   13    13     0     0 +++++++++
 /trunk/scripts/build/libc_glibc.sh                  |   37    21    16     0 +++++++++++++++------------
 2 files changed, 34 insertions(+), 16 deletions(-)
This commit is contained in:
Yann E. MORIN" 2008-07-31 09:08:33 +00:00
parent c49e216c5c
commit fe5feb1154
2 changed files with 34 additions and 16 deletions

View File

@ -0,0 +1,13 @@
diff -durN glibc-2.7.orig/Makerules glibc-2.7/Makerules
--- glibc-2.7.orig/Makerules 2007-08-26 04:18:03.000000000 +0200
+++ glibc-2.7/Makerules 2008-07-28 15:17:27.000000000 +0200
@@ -1203,6 +1203,9 @@
# The include magic above causes those files to use this variable for flags.
CPPFLAGS-nonlib = -DNOT_IN_libc=1
+ifneq ($(OBJDUMP_FOR_HOST),)
+OBJDUMP = $(OBJDUMP_FOR_HOST)
+endif
ifeq ($(versioning),yes)
# Generate normalized lists of symbols, versions, and data sizes.

View File

@ -122,9 +122,10 @@ do_libc_headers() {
# Note: BOOTSTRAP_GCC is used by:
# patches/glibc-2.3.5/glibc-mips-bootstrap-gcc-header-install.patch
libc_cv_ppc_machine=yes \
CT_DoExecLog ALL \
make CFLAGS="-O -DBOOTSTRAP_GCC" \
libc_cv_ppc_machine=yes \
CT_DoExecLog ALL \
make CFLAGS="-O -DBOOTSTRAP_GCC" \
OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
sysdeps/gnu/errlist.c
mkdir -p stdio-common
@ -135,12 +136,13 @@ do_libc_headers() {
CT_DoExecLog ALL touch stdio-common/errlist-compat.c
fi
# Note: BOOTSTRAP_GCC (see above)
libc_cv_ppc_machine=yes \
CT_DoExecLog ALL \
make cross-compiling=yes \
install_root=${CT_SYSROOT_DIR} \
CFLAGS="-O -DBOOTSTRAP_GCC" \
${LIBC_SYSROOT_ARG} \
libc_cv_ppc_machine=yes \
CT_DoExecLog ALL \
make cross-compiling=yes \
install_root=${CT_SYSROOT_DIR} \
CFLAGS="-O -DBOOTSTRAP_GCC" \
${LIBC_SYSROOT_ARG} \
OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
install-headers
# Two headers -- stubs.h and features.h -- aren't installed by install-headers,
@ -287,7 +289,7 @@ do_libc_start_files() {
#TODO: should check whether slibdir has been set in configparms to */lib64
# and copy the startfiles into the appropriate libdir.
CT_DoLog EXTRA "Building C library start files"
CT_DoExecLog ALL make csu/subdir_lib
CT_DoExecLog ALL make OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" csu/subdir_lib
CT_DoLog EXTRA "Installing C library start files"
if [ "${CT_USE_SYSROOT}" = "y" ]; then
@ -441,13 +443,15 @@ do_libc() {
# Note: LD and RANLIB needed by glibc-2.1.3's c_stub directory, at least on macosx
# No need for PARALLELMFLAGS here, Makefile already reads this environment variable
CT_DoLog EXTRA "Building C library"
CT_DoExecLog ALL make LD=${CT_TARGET}-ld \
RANLIB=${CT_TARGET}-ranlib \
CT_DoExecLog ALL make LD=${CT_TARGET}-ld \
RANLIB=${CT_TARGET}-ranlib \
OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
${GLIBC_INITIAL_BUILD_RULE}
CT_DoLog EXTRA "Installing C library"
CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}" \
${LIBC_SYSROOT_ARG} \
CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}" \
${LIBC_SYSROOT_ARG} \
OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
${GLIBC_INITIAL_INSTALL_RULE}
# This doesn't seem to work when building a crosscompiler,
@ -503,8 +507,9 @@ do_libc_finish() {
CT_DoLog EXTRA "Installing missing C library components"
# note: should do full install and then fix linker scripts, but this is faster
for t in bin rootsbin sbin data others; do
CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}" \
${LIBC_SYSROOT_ARG} \
CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}" \
${LIBC_SYSROOT_ARG} \
OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
install-${t}
done