Skip to content

Commit

Permalink
8139303: aarch32: add support for ARM aarch32
Browse files Browse the repository at this point in the history
Initial port of template interpreter to aarch32

Reviewed-by: duke
  • Loading branch information
Nikolay Gorshkov authored and Ed Nevill committed Dec 30, 2015
1 parent a24ad21 commit db1c6d4
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 27 deletions.
31 changes: 19 additions & 12 deletions common/autoconf/build-aux/config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,43 @@

DIR=`dirname $0`

# First, filter out everything that doesn't begin with "aarch64-"
if ! echo $* | grep '^aarch64-' >/dev/null ; then
# First, filter out everything that doesn't begin with "aarch32-" or "aarch64-"
if ! echo $* | grep -E '^(aarch32-|aarch64-)' >/dev/null; then
. $DIR/autoconf-config.sub "$@"
# autoconf-config.sub exits, so we never reach here, but just in
# case we do:
exit
fi

while test $# -gt 0 ; do
case $1 in
-- ) # Stop option processing
original="arm-"

while test $# -gt 0; do
case $1 in
--) # Stop option processing
shift; break ;;
aarch64-* )
aarch32-*)
config=`echo $1 | sed 's/^aarch32-/arm-/'`
sub_args="$sub_args $config"
original="aarch32-"
shift ;;
aarch64-*)
config=`echo $1 | sed 's/^aarch64-/arm-/'`
sub_args="$sub_args $config"
shift; ;;
- ) # Use stdin as input.
original="aarch64-"
shift ;;
-) # Use stdin as input
sub_args="$sub_args $1"
shift; break ;;
* )
*)
sub_args="$sub_args $1"
shift; ;;
shift ;;
esac
done

result=`. $DIR/autoconf-config.sub $sub_args "$@"`
exitcode=$?

result=`echo $result | sed "s/^arm-/aarch64-/"`
result=`echo $result | sed "s/^arm-/$original/"`

echo $result
exit $exitcode

33 changes: 24 additions & 9 deletions common/autoconf/generated-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3880,7 +3880,7 @@ fi
#CUSTOM_AUTOCONF_INCLUDE

# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1445418840
DATE_WHEN_GENERATED=1451436803

###############################################################################
#
Expand Down Expand Up @@ -6825,8 +6825,14 @@ test -n "$target_alias" &&
VAR_CPU_ENDIAN=little
;;
arm*)
VAR_CPU=arm
VAR_CPU_ARCH=arm
VAR_CPU=aarch32
VAR_CPU_ARCH=aarch32
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
aarch32)
VAR_CPU=aarch32
VAR_CPU_ARCH=aarch32
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
Expand Down Expand Up @@ -6962,8 +6968,14 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; }
VAR_CPU_ENDIAN=little
;;
arm*)
VAR_CPU=arm
VAR_CPU_ARCH=arm
VAR_CPU=aarch32
VAR_CPU_ARCH=aarch32
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
aarch32)
VAR_CPU=aarch32
VAR_CPU_ARCH=aarch32
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
Expand Down Expand Up @@ -7978,13 +7990,16 @@ $as_echo "$with_jvm_variants" >&6; }


INCLUDE_SA=true
if test "x$JVM_VARIANT_ZERO" = xtrue ; then
if test "x$JVM_VARIANT_ZERO" = xtrue; then
INCLUDE_SA=false
fi
if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
INCLUDE_SA=false
fi
if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
if test "x$OPENJDK_TARGET_CPU" = xppc64; then
INCLUDE_SA=false
fi
if test "x$VAR_CPU" = xppc64 ; then
if test "x$OPENJDK_TARGET_CPU" = xaarch32; then
INCLUDE_SA=false
fi
if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
Expand Down Expand Up @@ -29667,7 +29682,7 @@ fi
#
case $COMPILER_NAME in
gcc )
CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-unused-parameter -Wno-parentheses \
-pipe \
-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
case $OPENJDK_TARGET_CPU_ARCH in
Expand Down
9 changes: 6 additions & 3 deletions common/autoconf/jdk-options.m4
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,16 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
AC_SUBST(JVM_VARIANT_CORE)
INCLUDE_SA=true
if test "x$JVM_VARIANT_ZERO" = xtrue ; then
if test "x$JVM_VARIANT_ZERO" = xtrue; then
INCLUDE_SA=false
fi
if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
INCLUDE_SA=false
fi
if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
if test "x$OPENJDK_TARGET_CPU" = xppc64; then
INCLUDE_SA=false
fi
if test "x$VAR_CPU" = xppc64 ; then
if test "x$OPENJDK_TARGET_CPU" = xaarch32; then
INCLUDE_SA=false
fi
if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
Expand Down
10 changes: 8 additions & 2 deletions common/autoconf/platform.m4
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_ENDIAN=little
;;
arm*)
VAR_CPU=arm
VAR_CPU_ARCH=arm
VAR_CPU=aarch32
VAR_CPU_ARCH=aarch32
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
aarch32)
VAR_CPU=aarch32
VAR_CPU_ARCH=aarch32
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
Expand Down
2 changes: 1 addition & 1 deletion common/autoconf/toolchain.m4
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK],
#
case $COMPILER_NAME in
gcc )
CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-unused-parameter -Wno-parentheses \
-pipe \
-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
case $OPENJDK_TARGET_CPU_ARCH in
Expand Down
31 changes: 31 additions & 0 deletions cross-pkg-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
#
# Wrapper script that calls the real pkg-config with the relocated
# sysroot location
#
# Wrapper derived from raspberry crosstool and modified to take SYSROOT
# env variable from outside instead of computing via gcc -print-sysroot,
# which produces wrong output if called without CFLAGS which contain --sysroot
# Computing with CFLAGS not used, as pkg-config, in general, should not rely
# on CC, CFLAGS, ...
# However, we need to CC env defined to compute pkg-config-real executable.
# CC could be not used, if this script placed in raspberry crosstool's bin/.

set -e

if [ ! $SYSROOT ] || [ ! $CC ]; then
echo "No SYSROOT or CC env defined, exiting"
exit 1
fi

GCC="$CC"
MACHINE=`"$GCC" -dumpmachine`

#GCC could contain version like xxx-gcc-4.8.3, assuming xxx is equal to machine name
PKG_CONFIG_REAL=${GCC%$MACHINE-*}$MACHINE-pkg-config-real

export PKG_CONFIG_DIR=
export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/lib/${MACHINE}/pkgconfig":"${SYSROOT}/usr/lib/pkgconfig":"${SYSROOT}/usr/share/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="${SYSROOT}"

exec $PKG_CONFIG_REAL "$@"
27 changes: 27 additions & 0 deletions cross_configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

set -v

LDFLAGS="--sysroot=$RASPI_ROOT" \
CFLAGS="--sysroot=$RASPI_ROOT" \
CXXFLAGS="--sysroot=$RASPI_ROOT" \
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"$RASPI_ROOT/usr/lib/arm-linux-gnueabihf/pkgconfig" \
PKG_CONFIG=$PWD/cross-pkg-config \
SYSROOT=$RASPI_ROOT \
bash configure \
CC=arm-linux-gnueabihf-gcc \
CXX=arm-linux-gnueabihf-g++ \
BUILD_CC=gcc \
BUILD_LD=gcc \
--with-sys-root=$RASPI_ROOT \
--with-freetype-include=$RASPI_ROOT/usr/include/freetype2/ \
--with-freetype-lib=$RASPI_ROOT/usr/lib/arm-linux-gnueabihf \
--x-includes=$RASPI_ROOT/usr/include/ \
--x-libraries=$RASPI_ROOT/usr/lib \
--disable-precompiled-headers \
--with-extra-cflags=--sysroot=$RASPI_ROOT \
--with-extra-cxxflags=--sysroot=$RASPI_ROOT \
--with-extra-ldflags=--sysroot=$RASPI_ROOT \
--openjdk-target=aarch32-linux-gnueabihf \
"$@"

14 changes: 14 additions & 0 deletions cross_make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

set -v

CFLAGS="--sysroot=$RASPI_ROOT" \
CXXFLAGS="--sysroot=$RASPI_ROOT" \
LDFLAGS="--sysroot=$RASPI_ROOT" \
BUILD_LD=gcc \
make \
OBJCOPY=/opt/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-objcopy \
STRIP=/opt/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-strip \
POST_STRIP_CMD="/opt/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-strip -g" \
BUILD_LD=gcc \
"$@"

0 comments on commit db1c6d4

Please sign in to comment.