[PATCH] Append assembler flags on ARM targets

Jakub Vaněk linuxtardis at gmail.com
Sun Nov 25 15:49:34 UTC 2018


Hi,

This patch is a redo of the ARM926EJ-S patch. It adds a mechanism of
passing ARM CPU-specific flags to the assembler. This is achieved
through sharing variables between  ABI setup and ASFLAGS setup. Then
this patch adds pre-existing -march flags in CFLAGS to ASFLAGS as well.

An alternative way of doing this would be to set this directly in
flags-other.m4, but this would lead to setting ARM CPU-specific flags
on multiple places.

It is not possible to simply copy CFLAGS to ASFLAGS, because not all
flags that the C compiler accepts are accepted by the assembler (e.g.
-marm doesn't work).

The reason for this change is that on ARMv5, the non-E variants aren't
supported anymore. This patch doesn't address this issue yet, but it
adds the necessary infrastructure. I believe we need to set -march to
ARMv5TE both in CFLAGS and in ASFLAGS, because the problem is in file
linux_arm_32.s.

This patch in combination with a switch from ARMv5T to ARMv5TE was built successfully for the arm-sflt target: 
https://ci.adoptopenjdk.net/view/ev3dev/job/openjdk12_build_ev3_linux/21/

I have been successful in building arm-vfp-hflt configuration locally.

Thanks,

Jakub Vanek

# HG changeset patch
# User Jakub Vaněk <linuxtardis at gmail.com>
# Date 1543065692 -3600
#      Sat Nov 24 14:21:32 2018 +0100
# Node ID c5ff4e346842d9025e8abdde0cf8c7d33dfd8d82
# Parent  30a02b4e6c06e874ec8735dedb7e894844b1d627
Append assembler flags on ARM targets

diff --git a/make/autoconf/flags-other.m4 b/make/autoconf/flags-
other.m4
--- a/make/autoconf/flags-other.m4
+++ b/make/autoconf/flags-other.m4
@@ -119,6 +119,12 @@
   # Misuse EXTRA_CFLAGS to mimic old behavior
   $2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS ${$2EXTRA_CFLAGS}"
 
+  if test "x$1" = "xTARGET" && \
+      test "x$TOOLCHAIN_TYPE" = xgcc && \
+      test "x$OPENJDK_TARGET_CPU" = xarm; then
+    $2JVM_ASFLAGS="${$2JVM_ASFLAGS} $ARM_ARCH_TYPE_ASFLAGS
$ARM_FLOAT_TYPE_ASFLAGS"
+  fi
+
   AC_SUBST($2JVM_ASFLAGS)
 ])
 
diff --git a/make/autoconf/flags.m4 b/make/autoconf/flags.m4
--- a/make/autoconf/flags.m4
+++ b/make/autoconf/flags.m4
@@ -49,38 +49,52 @@
     if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
       ARM_FLOAT_TYPE=vfp-sflt
       ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
+      ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-hflt; then
       ARM_FLOAT_TYPE=vfp-hflt
       ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
+      ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
       ARM_FLOAT_TYPE=sflt
       ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
+      ARM_ARCH_TYPE_ASFLAGS='-march=armv5t'
     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
       ARM_FLOAT_TYPE=vfp-sflt
       ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
+      ARM_ARCH_TYPE_ASFLAGS='-march=armv5t'
     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv6-vfp-hflt; then
       ARM_FLOAT_TYPE=vfp-hflt
       ARM_ARCH_TYPE_FLAGS='-march=armv6 -marm'
+      ARM_ARCH_TYPE_ASFLAGS='-march=armv6'
     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xaarch64; then
       # No special flags, just need to trigger setting
JDK_ARCH_ABI_PROP_NAME
       ARM_FLOAT_TYPE=
       ARM_ARCH_TYPE_FLAGS=
+      ARM_ARCH_TYPE_ASFLAGS=
     else
       AC_MSG_ERROR([Invalid ABI profile:
"$OPENJDK_TARGET_ABI_PROFILE"])
     fi
 
     if test "x$ARM_FLOAT_TYPE" = xvfp-sflt; then
       ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=softfp -mfpu=vfp
-DFLOAT_ARCH=-vfp-sflt'
+      ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=softfp -mfpu=vfp"
     elif test "x$ARM_FLOAT_TYPE" = xvfp-hflt; then
       ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=hard -mfpu=vfp -DFLOAT_ARCH=-
vfp-hflt'
+      ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=hard -mfpu=vfp"
     elif test "x$ARM_FLOAT_TYPE" = xsflt; then
       ARM_FLOAT_TYPE_FLAGS='-msoft-float -mfpu=vfp'
+      ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=soft -mfpu=vfp"
     fi
+
     AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags])
     AC_MSG_RESULT([$ARM_FLOAT_TYPE_FLAGS])
+    AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags for
assembler])
+    AC_MSG_RESULT([$ARM_FLOAT_TYPE_ASFLAGS])
 
     AC_MSG_CHECKING([for arch type flags])
     AC_MSG_RESULT([$ARM_ARCH_TYPE_FLAGS])
+    AC_MSG_CHECKING([for arch type flags for assembler])
+    AC_MSG_RESULT([$ARM_ARCH_TYPE_ASFLAGS])
 
     # Now set JDK_ARCH_ABI_PROP_NAME. This is equivalent to the last
part of the
     # autoconf target triplet.






More information about the build-dev mailing list