Why does a fastdebug build compile with -O3 *and* -O0?

Mikael Gerdin mikael.gerdin at oracle.com
Tue Apr 28 08:55:56 UTC 2015


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 DEBUG_CFLAGS in gcc.make.
The first line of fastdebug.make uses an interesting hack to set 
FASTDEBUG_CFLAGS to DEBUG_CFLAGS unless FASTDEBUG_CFLAGS is already set.
FASTDEBUG_CFLAGS is only set in gcc.make if ENABLE_FULL_DEBUG_SYMBOLS is 0.
So I tried with:
hs-rt-open/hotspot$ make -C make/ 
ALT_BOOTDIR=/usr/lib/jvm/jdk-8-oracle-x64 HOTSPOT_BUILD_JOBS=24 
ARCH_DATA_MODEL=64 ENABLE_FULL_DEBUG_SYMBOLS=0 fastdebug

And that reproduces your problem. This is most certainly a bug in the 
build system.

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 -D_GNU_SOURCE -DAMD64 -DASSERT -DCHECK_UNHANDLED_OOPS -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/os_cpu/linux_x86/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 -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 -DTARGE!
 T_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  -O0 -fstack-protector-all --param ssp-buffer-size=1 -DVM_LITTLE_ENDIAN -D_LP64=1 -Werror -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual -Wtype-limits   -DDTRACE_ENABLED -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