RFR: 8366777: Build fails unknown pseudo-op with old AS on linux-aarch64 [v6]

Erik Joelsson erikj at openjdk.org
Fri Sep 5 13:04:14 UTC 2025


On Fri, 5 Sep 2025 06:16:01 GMT, SendaoYan <syan at openjdk.org> wrote:

>> Hi all,
>> 
>> Build jdk on linux-aarch64 with older assembler version(as 2.30) will report compilation failre, shows as [JDK-8366777](https://bugs.openjdk.org/browse/JDK-8366777).
>> 
>> This PR add the expression `svfloat64_t a() {}` to makefile which will trigger the compilation during configure stage. After this PR, at configure stage will check the gcc and assember support `-march=armv8-a+sve` or not more comprehensive.
>> 
>> Testing:
>> - [x] On linux-aarch64 gcc12.3.1 as2.37, configure set SVE_CFLAGS as '-march=armv8-a+sve'
>> - [x] On linux-aarch64 gcc10.3.0 as2.30, configure set SVE_CFLAGS as empty
>> 
>> 
>> The compilation fails demo as below:
>> 
>> 
>> # cat sve.c 
>> #include <arm_sve.h>
>> svfloat64_t a() {}
>> # gcc -march=armv8-a+sve sve.c 
>> /tmp/ccVOzMzb.s: Assembler messages:
>> /tmp/ccVOzMzb.s:6: Error: unknown pseudo-op: `.variant_pcs'
>
> SendaoYan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use UTIL_ARG_ENABLE instead of AC_ARG_ENABLE

make/autoconf/flags-cflags.m4 line 950:

> 948:       # check the compiler and binutils support sve or not
> 949:       AC_MSG_CHECKING([if Arm SVE ACLE is supported])
> 950:       AC_COMPILE_IFELSE([AC_LANG_PROGRAM(

Now that I started looking closer at this, I realize that we are inside a macro that gets called for both the BUILD and TARGET compiler (note the $2 prefix on several variables). For a call to `AC_COMPILER_IFELSE` to work correctly in that context, you need to temporarily change `CC` and `CFLAGS` to the correct compiler and flags setup. See the definition of `FLAGS_C_COMPILER_CHECK_ARGUMENTS` in flags.m4 to see how that is done.

make/autoconf/flags-cflags.m4 line 981:

> 979:       if test "x$$2SVE_CFLAGS" != "x" && test "x$DEBUG_LEVEL" != xrelease && test "x$TOOLCHAIN_TYPE" = xgcc ; then
> 980:         INIT_ZERO_FLAG="-ftrivial-auto-var-init=zero"
> 981:         FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$INIT_ZERO_FLAG],

When calling `FLAGS_COMPILER_CHECK_ARGUMENTS` you from this context, you need to include the `PREFIX` argument. See examples further up in this file.

make/autoconf/flags-cflags.m4 line 996:

> 994: AC_DEFUN([BPERF_SETUP_SVE],
> 995: [
> 996:   UTIL_ARG_ENABLE(NAME: aarch64-sve, DEFAULT: auto,

The idea with this macro is that you put the supported check and actions on enabled/disabled in the call and let it handle the logic. It shouldn't be moved to a separate macro. Also, macros defined in this file should have the `FLAGS` prefix, not `BPERF`.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27073#discussion_r2325028873
PR Review Comment: https://git.openjdk.org/jdk/pull/27073#discussion_r2325031564
PR Review Comment: https://git.openjdk.org/jdk/pull/27073#discussion_r2325022758


More information about the build-dev mailing list