am cb9c2eaa: Merge change 2524 into donut

Merge commit 'cb9c2eaac7f52defc2fcc70fc016876f4bbc0b9f'

* commit 'cb9c2eaac7f52defc2fcc70fc016876f4bbc0b9f':
  Force the use of 32-bit toolchain binaries on 64-bit systems.
This commit is contained in:
Android (Google) Code Review
2009-05-28 12:31:32 -07:00
committed by The Android Open Source Project
7 changed files with 33 additions and 30 deletions

View File

@@ -0,0 +1 @@
lib*.so

View File

@@ -0,0 +1 @@
lib*.so

View File

@@ -54,6 +54,7 @@ add_config ()
echo "Detecting host toolchain." echo "Detecting host toolchain."
echo "" echo ""
force_32bit_binaries
setup_toolchain setup_toolchain
create_config_mk create_config_mk

View File

@@ -34,6 +34,7 @@ OPTION_HELP=no
OPTION_PLATFORM= OPTION_PLATFORM=
OPTION_FORCE_32=no OPTION_FORCE_32=no
OPTION_REBUILD=no OPTION_REBUILD=no
VERBOSE=no VERBOSE=no
for opt do for opt do
optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
@@ -73,9 +74,7 @@ for opt do
done done
if [ $OPTION_HELP = "yes" ] ; then if [ $OPTION_HELP = "yes" ] ; then
echo "Collect files from an Android build tree and assembles a sysroot" echo "Rebuild the prebuilt binaries for the Android NDK toolchain."
echo "suitable for building a standalone toolchain or be used by the"
echo "Android NDK."
echo "" echo ""
echo "options:" echo "options:"
echo "" echo ""
@@ -90,27 +89,14 @@ if [ $OPTION_HELP = "yes" ] ; then
exit 0 exit 0
fi fi
# some Linux platforms report 64-bit while they have a 32-bit userland # Force generation of 32-bit binaries on 64-bit systems
# so check that the compiler generates 32-bit binaries case $HOST_TAG in
# if it does, call force_32bit_binaries to change the value of $HOST_TAG *-x86_64)
# HOST_CFLAGS="$HOST_CFLAGS -m32"
# note that this also changes HOST_CFLAGS and HOST_LDFLAGS, however, there HOST_LDFLAGS="$HOST_LDFLAGS -m32"
# is no way for the configure script in the toolchain to get these properly. force_32bit_binaries # to modify HOST_TAG and others
# ;;
if [ $HOST_TAG = linux-x86_64 ] ; then esac
setup_toolchain
cat >$TMPC <<EOF
int main(void)
{
return 0;
}
EOF
compile_exec_run
readelf -h $TMPE | grep -q -e "ELF32"
if [ $? = 0 ] ; then
force_32bit_binaries
fi
fi
TMPLOG=/tmp/android-toolchain-build-$$.log TMPLOG=/tmp/android-toolchain-build-$$.log
rm -rf $TMPLOG rm -rf $TMPLOG
@@ -305,6 +291,7 @@ download_package ()
echo "ERROR: Invalid MD5 Sum for $PACKAGE_TARBALL" echo "ERROR: Invalid MD5 Sum for $PACKAGE_TARBALL"
echo " Expected $PKGSUM" echo " Expected $PKGSUM"
echo " Computed $SUM" echo " Computed $SUM"
echo "You might want to use the --force-download option."
exit 2 exit 2
fi fi
@@ -378,7 +365,8 @@ if ! timestamp_check toolchain configure; then
echo "Configure: toolchain build" echo "Configure: toolchain build"
mkdir -p $TOOLCHAIN_BUILD && mkdir -p $TOOLCHAIN_BUILD &&
cd $TOOLCHAIN_BUILD && cd $TOOLCHAIN_BUILD &&
CFLAGS="$HOST_CFLAGS" LDFLAGS="$HOST_LDFLAGS" run \ export CFLAGS="$HOST_CFLAGS" &&
export LDFLAGS="$HOST_LDFLAGS" && run \
$TOOLCHAIN_SRC/configure --target=arm-eabi \ $TOOLCHAIN_SRC/configure --target=arm-eabi \
--disable-nls \ --disable-nls \
--prefix=$TOOLCHAIN_PREFIX \ --prefix=$TOOLCHAIN_PREFIX \
@@ -394,9 +382,11 @@ fi
# build the toolchain # build the toolchain
if ! timestamp_check toolchain build ; then if ! timestamp_check toolchain build ; then
echo "Building : toolchain (this can take a long time)." echo "Building : toolchain [this can take a long time]."
cd $TOOLCHAIN_BUILD && cd $TOOLCHAIN_BUILD &&
CFLAGS="$HOST_CFLAGS" LDFLAGS="$HOST_LDFLAGS" run make -j$JOBS export CFLAGS="$HOST_CFLAGS" &&
export LDFLAGS="$HOST_LDFLAGS" &&
run make -j$JOBS
if [ $? != 0 ] ; then if [ $? != 0 ] ; then
echo "Error while building toolchain. See $TMPLOG" echo "Error while building toolchain. See $TMPLOG"
exit 1 exit 1
@@ -414,8 +404,12 @@ if ! timestamp_check toolchain install ; then
echo "Error while installing toolchain. See $TMPLOG" echo "Error while installing toolchain. See $TMPLOG"
exit 1 exit 1
fi fi
# don't forget to copy the GPL and LGPL license files
cp -f $TOOLCHAIN_SRC/COPYING $TOOLCHAIN_SRC/COPYING.LIB $TOOLCHAIN_PREFIX
# remove some unneeded files
rm -f $TOOLCHAIN_PREFIX/bin/*-gccbug rm -f $TOOLCHAIN_PREFIX/bin/*-gccbug
rm -rf $TOOLCHAIN_PREFIX/man $TOOLCHAIN_PREFIX/info rm -rf $TOOLCHAIN_PREFIX/man $TOOLCHAIN_PREFIX/info
# strip binaries to reduce final package size
strip $TOOLCHAIN_PREFIX/bin/* strip $TOOLCHAIN_PREFIX/bin/*
strip $TOOLCHAIN_PREFIX/arm-eabi/bin/* strip $TOOLCHAIN_PREFIX/arm-eabi/bin/*
strip $TOOLCHAIN_PREFIX/libexec/gcc/*/*/cc1 strip $TOOLCHAIN_PREFIX/libexec/gcc/*/*/cc1
@@ -431,6 +425,7 @@ if ! timestamp_check gdbserver configure; then
mkdir -p $GDBSERVER_BUILD mkdir -p $GDBSERVER_BUILD
cd $GDBSERVER_BUILD && cd $GDBSERVER_BUILD &&
CFLAGS="-g -O2 -static -mandroid -I$ANDROID_SYSROOT/usr/include" \ CFLAGS="-g -O2 -static -mandroid -I$ANDROID_SYSROOT/usr/include" \
LDFLAGS= \
CC="$TOOLCHAIN_PREFIX/bin/arm-eabi-gcc" \ CC="$TOOLCHAIN_PREFIX/bin/arm-eabi-gcc" \
run $TOOLCHAIN_SRC/gdb-6.6/gdb/gdbserver/configure \ run $TOOLCHAIN_SRC/gdb-6.6/gdb/gdbserver/configure \
--host=arm-eabi-linux \ --host=arm-eabi-linux \

View File

@@ -21,7 +21,7 @@ PREBUILT_DIR=
PREBUILT_PREFIX=android-ndk-prebuilt-20090323 PREBUILT_PREFIX=android-ndk-prebuilt-20090323
# the list of supported host development systems # the list of supported host development systems
PREBUILT_SYSTEMS="linux-x86 linux-x86_64 darwin-x86 windows" PREBUILT_SYSTEMS="linux-x86 darwin-x86 windows"
OPTION_HELP=no OPTION_HELP=no

View File

@@ -1,7 +1,10 @@
A simple change log for the Android NDK Android NDK ChangeLog:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Current version: Current version (2009-05-27):
- Force the use of 32-bit toolchain binaries on 64-bit hosts. This reduces
the number of prebuilt packages needed to be distributed.
- Expose the zlib headers <zlib.h> and <zconf.h> as part of the stable - Expose the zlib headers <zlib.h> and <zconf.h> as part of the stable
ABIs. ABIs.

2
ndk/out/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# Ignore all generated files here
*