How to build hotspot jtreg test JNI with specific CFLAGS?

Severin Gehwolf sgehwolf at redhat.com
Mon Aug 6 07:52:36 UTC 2018


Hi David,

On Mon, 2018-08-06 at 10:05 +1000, David Holmes wrote:
> Can never remember if "make run-test" is the current or old way to run 
> tests. What do you see if you run "make test-image"?

"make help" seems to talk about run-test only. Similarly
doc/testing.{md,html}. I'd think it's the "new" way for some definition
of new. Also, "run-test" seems to depend on "test-image" target:

$ grep -rn run-test make/ | grep test-image
make/Main.gmk:836:  run-test: jdk-image test-image
make/Main.gmk:837:  exploded-run-test: exploded-image test-image

Thanks,
Severin

> David
> 
> On 4/08/2018 12:19 AM, Severin Gehwolf wrote:
> > Hi,
> > 
> > I'm trying to get a JNI library used for testing to be compiled with
> > certain CFLAGS. In particular, I'm trying to get it compiled on a GCC
> > platform with '-fomit-frame-pointer' and/or '-fomit-frame-pointer -O3'.
> > The patch currently looks like this:
> > 
> > diff --git a/make/test/JtregNativeHotspot.gmk b/make/test/JtregNativeHotspot.gmk
> > --- a/make/test/JtregNativeHotspot.gmk
> > +++ b/make/test/JtregNativeHotspot.gmk
> > @@ -139,6 +139,13 @@
> >       -I$(VM_TESTBASE_DIR)/nsk/share/native \
> >       -I$(VM_TESTBASE_DIR)/nsk/share/jni
> >   
> > +NO_FRAMEPOINTER_CFLAGS :=
> > +ifeq ($(OPENJDK_TARGET_OS),linux)
> > +   NO_FRAMEPOINTER_CFLAGS := -O3 -fomit-frame-pointer
> > +endif
> > +
> > +BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libNoFramePointer := $(NO_FRAMEPOINTER_CFLAGS)
> > +
> >   BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libProcessUtils := $(VM_SHARE_INCLUDES)
> >   
> >   BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libThreadController := $(NSK_MONITORING_INCLUDES)
> > 
> > When I look at the compile command line this produces with 'make run-test', I see this:
> > 
> > $ cat ./build/linux-x86_64-normal-server-release/support/test/hotspot/jtreg/native/support/libNoFramePointer/libNoFramePointer.o.cmdline
> > /usr/bin/gcc -I/disk/openjdk/upstream-sources/openjdk-head/build/linux-x86_64-normal-server-release/support/modules_include/java.base -I/disk/openjdk/upstream-sources/openjdk-head/build/linux-x86_64-normal-server-release/support/modules_include/java.base/linux -I/disk/openjdk/upstream-sources/openjdk-head/src/java.base/share/native/libjava -I/disk/openjdk/upstream-sources/openjdk-head/src/java.base/unix/native/libjava -I/disk/openjdk/upstream-sources/openjdk-head/src/hotspot/share/include -I/disk/openjdk/upstream-sources/openjdk-head/src/hotspot/os/posix/include -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DLINUX -DNDEBUG -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 -fno-strict-aliasing -m64 -D_LITTLE_ENDIAN -DARCH='"amd64"' -Damd64 -D_LP64=1 -fno-omit-frame-pointer -fno-delete-null-pointer-checks -fno-lifetime-dse -fPIC -O3 -fomit-frame-pointer -g -O2 -DTHIS_FILE='""' -c -MMD -MF /disk/openjdk/upstream-sources/openjdk-head/build/linux-x86_64-normal-server-release/support/test/hotspot/jtreg/native/support/libNoFramePointer/libNoFramePointer.d -o /disk/openjdk/upstream-sources/openjdk-head/build/linux-x86_64-normal-server-release/support/test/hotspot/jtreg/native/support/libNoFramePointer/libNoFramePointer.o /disk/openjdk/upstream-sources/openjdk-head/test/hotspot/jtreg/serviceability/sa/libNoFramePointer.c
> > 
> > The command line has '-O3 -fomit-frame-pointer -g -O2' in that order.
> > This screws things up since -O2 seems to override -fomit-frame-pointer.
> > My guess is that -O2 is from OPTIMIZATION == LOW, but not sure. How can
> > I get this -O2 flag removed which apparently gets added later?
> > 
> > Thanks,
> > Severin
> > 




More information about the build-dev mailing list