On Tue, 11 Oct 2022 10:09:02 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:
> I think checking it like this would be more robust? > > ``` > if test "x$conf_openjdk_target" != "x"; then > binutils_target="--host=$conf_openjdk_target" > else > binutils_target="" > fi > ``` Also need to pass `AR` to binutils build and configure with `AR=riscv64-linux-gnu-ar` to get the RISC-V cross-build back: diff --git a/make/autoconf/lib-hsdis.m4 b/make/autoconf/lib-hsdis.m4 index d72bbf6df32..7be49fbf778 100644 --- a/make/autoconf/lib-hsdis.m4 +++ b/make/autoconf/lib-hsdis.m4 @@ -175,12 +175,16 @@ AC_DEFUN([LIB_BUILD_BINUTILS], fi else binutils_cc="$CC $SYSROOT_CFLAGS" - binutils_target="" + if test "x$conf_openjdk_target" != "x"; then + binutils_target="--host=$conf_openjdk_target" + else + binutils_target="" + fi fi binutils_cflags="$binutils_cflags $MACHINE_FLAG $JVM_PICFLAG $C_O_FLAG_NORM" AC_MSG_NOTICE([Running binutils configure]) - AC_MSG_NOTICE([configure command line: ./configure --disable-nls CFLAGS="$binutils_cflags" CC="$binutils_cc" $binutils_target]) + AC_MSG_NOTICE([configure command line: ./configure --disable-nls CFLAGS="$binutils_cflags" CC="$binutils_cc" AR="$AR" $binutils_target]) saved_dir=`pwd` cd "$BINUTILS_SRC" ./configure --disable-nls CFLAGS="$binutils_cflags" CC="$binutils_cc" $binutils_target This allows building hsdis on following arches with server ports: i686-linux-gnu x86_64-linux-gnu aarch64-linux-gnu powerpc64le-linux-gnu s390x-linux-gnu arm-linux-gnueabihf riscv64-linux-gnu ------------- PR: https://git.openjdk.org/jdk/pull/10628