Why does a fastdebug build compile with -O3 and -O0? (original) (raw)

Severin Gehwolf sgehwolf at redhat.com
Tue Apr 28 09:41:32 UTC 2015


Hi Mikael,

Adding in build-dev for input.

On Tue, 2015-04-28 at 10:55 +0200, Mikael Gerdin wrote:

Severin,

On 2015-04-27 16:33, Severin Gehwolf wrote: > Hi, > > I've noticed that a fastdebug build of recent hs-rt compiles objects > with -O3 and -O0. Is this a bug or a feature? If it's a feature, > what's the rationale? This does not appear to be the case when I build on my machine. I also don't get "-fstack-protector-all --param ssp-buffer-size=1" Those appear to be set in DEBUGCFLAGS in gcc.make. The first line of fastdebug.make uses an interesting hack to set FASTDEBUGCFLAGS to DEBUGCFLAGS unless FASTDEBUGCFLAGS is already set. FASTDEBUGCFLAGS is only set in gcc.make if ENABLEFULLDEBUGSYMBOLS is 0. So I tried with: hs-rt-open/hotspot$ make -C make/ ALTBOOTDIR=/usr/lib/jvm/jdk-8-oracle-x64 HOTSPOTBUILDJOBS=24 ARCHDATAMODEL=64 ENABLEFULLDEBUGSYMBOLS=0 fastdebug And that reproduces your problem. This is most certainly a bug in the build system.

OK, thanks. Any suggestions as to how to fix this? FWIW, I don't see this problem for JDK 8 fastdebug builds. Example: /usr/bin/g++ -DLINUX -D_GNU_SOURCE -DAMD64 -DASSERT -DCHECK_UNHANDLED_OOPS -I. -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk8u-dev/hotspot/src/share/vm/prims -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk8u-dev/hotspot/src/share/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk8u-dev/hotspot/src/share/vm/precompiled -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk8u-dev/hotspot/src/cpu/x86/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk8u-dev/hotspot/src/os_cpu/linux_x86/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk8u-dev/hotspot/src/os/linux/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk8u-dev/hotspot/src/os/posix/vm -I../generated -DHOTSPOT_RELEASE_VERSION=""25.60-b12"" -DHOTSPOT_BUILD_TARGET=""fastdebug"" -DHOTSPOT_BUILD_USER=""sgehwolf"" -DHOTSPOT_LIB_ARCH="amd64" -DHOTSPOT_VM_DISTRO=""OpenJDK"" -DTARGET_OS_FAMILY_linux -DTARGET_ARCH_x86 -DTARGET_ARCH_MODEL_x86_64 -DTARGET_OS_ARCH_linux_x86 -DTARGET_OS_ARCH_MODEL_linux_x86_64 -DTARGET_COMPILER_gcc -DCOMPILER2 -DCOMPILER1 -fPIC -fno-rtti -fno-exceptions -D_REENTRANT -fcheck-new -fvisibility=hidden -m64 -pipe -fno-strict-aliasing -g -fno-omit-frame-pointer -O3 -DVM_LITTLE_ENDIAN -D_LP64=1 -Werror -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -DDTRACE_ENABLED -c -MMD -MP -MF ../generated/dependencies/asParNewGeneration.o.d -fpch-deps -o asParNewGeneration.o /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk8u-dev/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp

My make invocation does indeed have ENABLE_FULL_DEBUG_SYMBOLS=0. The full make command line is (the comment says it all, but may be outdated since it's a recurring issue for us distro people):

In order to get correct debug symbols in libjvm.so we need

DEBUG_BINARIES=true ENABLE_FULL_DEBUG_SYMBOLS=0 POST_STRIP_CMD=""

make
SCTP_WERROR=
DEBUG_BINARIES=true
ENABLE_FULL_DEBUG_SYMBOLS=0
POST_STRIP_CMD=""
DISABLE_INTREE_EC=true
LOG=debug images

The rationale for DEBUG_BINARIES=true ENABLE_FULL_DEBUG_SYMBOLS=0 POST_STRIP_CMD="" is here (short version: we want full debug symbols in object files and leave the stripping to rpm): http://mail.openjdk.java.net/pipermail/build-dev/2014-March/012039.html

Thread started here: http://mail.openjdk.java.net/pipermail/build-dev/2014-February/012019.html

A somewhat related bug I've filed about this a while ago: https://bugs.openjdk.java.net/browse/JDK-8073461

If we could fix this proper, then we wouldn't have to use those non-standard make variables...

Cheers, Severin

The hotspot makefiles are horrible.

/Mikael

> > I'm not sure what GCC does with that, but it appears it just uses -O0 > (last seen option?). > > Example: > /usr/bin/g++ -DLINUX -DGNUSOURCE -DAMD64 -DASSERT -DCHECKUNHANDLEDOOPS -I. -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-hs-rt/hotspot/src/share/vm/prims -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-hs-rt/hotspot/src/share/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-hs-rt/hotspot/src/share/vm/precompiled -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-hs-rt/hotspot/src/cpu/x86/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-hs-rt/hotspot/src/oscpu/linuxx86/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-hs-rt/hotspot/src/os/linux/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-hs-rt/hotspot/src/os/posix/vm -I../generated -DHOTSPOTBUILDUSER=""sgehwolf"" -DHOTSPOTLIBARCH="amd64" -DHOTSPOTVMDISTRO=""OpenJDK"" -DTARGETOSFAMILYlinux -DTARGETARCHx86 -DTARGETARCHMODELx8664 -DTARGETOSARCHlinuxx86 -DTARGETOSARCHMODELlinuxx8664 -DTARGE! TCOMPILER gcc -DCOMPILER2 -DCOMPILER1 -fPIC -fno-rtti -fno-exceptions -DREENTRANT -fcheck-new -fvisibility=hidden -m64 -pipe -fno-strict-aliasing -g -fno-omit-frame-pointer -O3 -O0 -fstack-protector-all --param ssp-buffer-size=1 -DVMLITTLEENDIAN -DLP64=1 -Werror -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual -Wtype-limits -DDTRACEENABLED -c -MMD -MP -MF ../generated/dependencies/virtualMemoryTracker.o.d -fpch-deps -o virtualMemoryTracker.o /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-hs-rt/hotspot/src/share/vm/services/virtualMemoryTracker.cpp > Compiling /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-hs-rt/hotspot/src/share/vm/runtime/virtualspace.cpp > > Cheers, > Severin >



More information about the hotspot-dev mailing list