[8u] RFR (XS) 8265832: runtime/StackGap/testme.sh fails to compile in 8u

Aleksey Shipilev shade at redhat.com
Fri Apr 23 07:44:12 UTC 2021


This is 8u-specific bug, because in original 11u fix (JDK-8197429) the build is handled by the build 
system itself.

In 8u, however, it fails with:

Compilation flag:
STDERR:
openjdk version "1.8.0-internal-fastdebug"
OpenJDK Runtime Environment (build 1.8.0-internal-fastdebug-shade_2021_04_22_19_10-b00)
OpenJDK 64-Bit Server VM (build 25.71-b00-fastdebug, mixed mode)
/usr/bin/ld: /tmp/ccj5AhI1.o: in function `create_vm':
exestack-gap.c:(.text+0x103): undefined reference to `JNI_CreateJavaVM'
collect2: error: ld returned 1 exit status
/home/shade/trunks/jdk8u-dev/hotspot/test/runtime/StackGap/testme.sh: 72: ./stack-gap: not found

Ultimately, that is because the link options order matters for this test, as linker would try to 
search for external functions from left to right, so the library containing the definition should 
appear after the source file that uses it. This was apparently lax in older gcc-s, but newer gcc-s 
are breaking with the error above.

This fixes 8u:

diff -r d05490a39074 test/runtime/StackGap/testme.sh
--- a/test/runtime/StackGap/testme.sh   Thu Apr 22 20:27:11 2021 +0200
+++ b/test/runtime/StackGap/testme.sh   Fri Apr 23 09:37:01 2021 +0200
@@ -65,9 +65,10 @@
  # for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.

  $gcc_cmd -DLINUX ${CFLAGS} -o stack-gap \
      -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
      -L${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \
-    -ljvm -lpthread exestack-gap.c
+    exestack-gap.c \
+    -ljvm -lpthread

  ./stack-gap || exit $?
  ./stack-gap -XX:+DisablePrimordialThreadGuardPages || exit $?


Testing: affected test, now passes

-- 
Thanks,
-Aleksey



More information about the jdk8u-dev mailing list