RFR: 8046765: (s) disable FORTIFY_SOURCE for files with optimization disabled.

Severin Gehwolf sgehwolf at redhat.com
Mon Aug 4 16:11:18 UTC 2014


Hi,

On Wed, 2014-07-16 at 10:13 -0700, Mike Duigou wrote:
> Hello all;
> 
> In some GCC distributions the FORTIFY_SOURCE option is incompatible
> with the -O0. This change disables FORTIFY sources for the files we
> know have optimizations disabled.
> 
> jbsbug: https://bugs.openjdk.java.net/browse/JDK-8047952
> webrev: http://cr.openjdk.java.net/~mduigou/JDK-8047952/0/webrev/
> 
> Unfortunately I don't have a Fedora 19 setup to test the change on the
> reported platform but I did verify that the compiler command line is
> correct, that fortify is disabled and the resulting build still works
> on a number of platforms. Additional verifications on other platforms
> is encouraged.

As for additional verification: I'm seeing the build failure on Fedora
20. With the webrev patch applied the build still fails for me.

/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/make/linux/makefiles/vm.make:289: Building precompiled.hpp.gch 
/usr/bin/g++ -DLINUX -D_GNU_SOURCE -DAMD64 -DASSERT -I.
-I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/prims -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/precompiled -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/cpu/x86/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/os_cpu/linux_x86/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/os/linux/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/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 -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 -O0 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all --param ssp-buffer-size=1 -D_NMT_NOINLINE_ -DVM_LITTLE_ENDIAN -D_LP64=1 -Werror -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2   -DDTRACE_ENABLED -c -MMD -MP -MF ../generated/dependencies/precompiled.hpp.gch.d -fpch-deps -x c++-header /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/precompiled/precompiled.hpp -o precompiled.hpp.gch 
+ /usr/bin/g++ -DLINUX -D_GNU_SOURCE -DAMD64 -DASSERT -I.
-I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/prims -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/precompiled -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/cpu/x86/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/os_cpu/linux_x86/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/os/linux/vm -I/home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/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 -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 -O0 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all --param ssp-buffer-size=1 -D_NMT_NOINLINE_ -DVM_LITTLE_ENDIAN -D_LP64=1 -Werror -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -DDTRACE_ENABLED -c -MMD -MP -MF ../generated/dependencies/precompiled.hpp.gch.d -fpch-deps -x c++-header /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/precompiled/precompiled.hpp -o precompiled.hpp.gch
In file included from /usr/include/stdio.h:27:0,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/prims/jni.h:39,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/utilities/globalDefinitions.hpp:33,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/utilities/debug.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/runtime/globals.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/memory/allocation.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/memory/iterator.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/memory/genOopClosures.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/oops/klass.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/runtime/handles.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/memory/universe.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/code/oopRecorder.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/asm/codeBuffer.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/asm/assembler.hpp:28,

from /home/sgehwolf/Documents/openjdk/upstream-sources/openjdk9-dev-hs-comp/hotspot/src/share/vm/precompiled/precompiled.hpp:29:
/usr/include/features.h:327:4: error: #warning _FORTIFY_SOURCE requires
compiling with optimization (-O) [-Werror=cpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^

The mentioned bug in $subject should be 8047952, *not* 8046765, I think.
JDK-8050803 is also a potential duplicate. FWIW, the proposed patch in
the following thread works for me:
http://mail.openjdk.java.net/pipermail/build-dev/2014-July/012900.html

Cheers,
Severin



More information about the hotspot-dev mailing list