strange error when running jtreg tests

Gustavo Romero gromero at linux.vnet.ibm.com
Wed Aug 17 14:56:14 UTC 2016


Hi Erik,

I applied your change:

diff -r 397565766eb4 make/test/JtregNative.gmk
--- a/make/test/JtregNative.gmk Thu Aug 11 16:22:08 2016 -0700
+++ b/make/test/JtregNative.gmk Wed Aug 17 09:54:20 2016 -0500
@@ -79,7 +79,7 @@
 ifeq ($(OPENJDK_TARGET_OS), linux)
     BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rw := -z noexecstack
     BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z execstack
-    BUILD_HOTSPOT_JTREG_EXECUTABLES_LDFLAGS_exeinvoke := -ljvm -lpthread
+    BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeinvoke := -ljvm -lpthread
     BUILD_TEST_invoke_exeinvoke.c_OPTIMIZATION := NONE
 endif


but it seems the new param is not passed to the linker now. So it failed.

No "pthread" nor "ljvm" in the link command:

/usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/ccAdCwgA.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr
-m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o
/home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/test/hotspot/jtreg/native/bin/invoke /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o
-L/home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/modules_libs/java.base/amd64
-L/home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/modules_libs/java.base/amd64/server -L/usr/lib/gcc/x86_64-linux-gnu/5
-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. --hash-style=both -z defs -O1 --allow-shlib-undefined
/home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/test/hotspot/jtreg/native/support/exeinvoke/exeinvoke.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed
-lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o

Regards,
Gustavo





On 17-08-2016 11:32, Erik Joelsson wrote:
> I finally took a look at this and yes, there is a bug in the makefile. This line in hotspot/make/test/JtregNative.gmk:
> 
> BUILD_HOTSPOT_JTREG_EXECUTABLES_LDFLAGS_exeinvoke := -ljvm -lpthread
> 
> should be:
> 
> BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeinvoke := -ljvm -lpthread
> 
> Could someone who is able to repro try this?
> 
> /Erik
> 
> On 2016-08-17 16:15, Gustavo Romero wrote:
>> Hi David,
>>
>> On 17-08-2016 00:38, David Holmes wrote:
>>> On 16/08/2016 8:41 AM, Gustavo Romero wrote:
>>>> On Ubuntu 16.04 PPC64 LE replacing -lpthread by -pthread in
>>>> ./hotspot/make/test/JtregNative.gmk:82 solves the issue on pthread_* symbols and
>>>> placing -ljvm (for instance) in front of ".../exeinvoke.o" solves the issue on
>>>> JNI_CreateJavaVM reference, however I'm really not sure what's the root cause.
>>> I checked the link command being used (it is generated into a file when the test-image is built) and the -ljvm is already in front of the exeinvoke.o
>>>
>>> /var/tmp/jib-daholme/install/jpg/infra/builddeps/devkit-linux_x64/gcc4.9.2-OEL6.4+1.0/devkit-linux_x64-gcc4.9.2-OEL6.4+1.0.tar.gz/bin/gcc -Wl,-z,defs -Wl,-O1 -Wl,--allow-shlib-undefined
>>> -L/scratch/dh198349/jdk9-hs/build/linux-x64/support/modules_libs/java.base/amd64 -L/scratch/dh198349/jdk9-hs/build/linux-x64/support/modules_libs/java.base/amd64/server -ljvm -lpthread
>>> --sysroot=/var/tmp/jib-daholme/install/jpg/infra/builddeps/devkit-linux_x64/gcc4.9.2-OEL6.4+1.0/devkit-linux_x64-gcc4.9.2-OEL6.4+1.0.tar.gz/x86_64-unknown-linux-gnu/sysroot -o
>>> /scratch/dh198349/jdk9-hs/build/linux-x64/support/test/hotspot/jtreg/native/bin/invoke /scratch/dh198349/jdk9-hs/build/linux-x64/support/test/hotspot/jtreg/native/support/exeinvoke/exeinvoke.o
>> Sorry, "in front of" was a misleading expression. I meant placed *after*
>> exeinvoke.o (reading from right to left the link command).
>>
>> So on Ubuntu 16.04 x64 this fails (taken from the original build, the order is like in your link command):
>>
>> /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cccQFwXy.res
>> -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr
>> -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o
>> /home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/test/hotspot/jtreg/native/bin/invoke /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o
>> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o
>> -L/home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/modules_libs/java.base/amd64
>> -L/home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/modules_libs/java.base/amd64/server -L/usr/lib/gcc/x86_64-linux-gnu/5
>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib
>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. --hash-style=both -z defs -O1 --allow-shlib-undefined -ljvm -lpthread
>> /home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/test/hotspot/jtreg/native/support/exeinvoke/exeinvoke.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed
>> -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
>>
>> but this succeeds (where -ljvm is after exeinvoke.o):
>>
>> /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/ccIRdp31.res
>> -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
>> --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o
>> /home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/test/hotspot/jtreg/native/bin/invoke /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o
>> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o
>> -L/home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/modules_libs/java.base/amd64
>> -L/home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/modules_libs/java.base/amd64/server -L/usr/lib/gcc/x86_64-linux-gnu/5
>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib
>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. --hash-style=both -z defs -O1
>> /home/gromero/hg/jdk9/hs-comp/build/linux-x86_64-normal-server-release/support/test/hotspot/jtreg/native/support/exeinvoke/exeinvoke.o -ljvm -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc
>> -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
>>
>> Full log: https://paste.fedoraproject.org/409607/raw/
>>
>>
>> Regards,
>> Gustavo
>>
> 




More information about the build-dev mailing list