The security flag '-D_FORTIFY_SOURCE' requires at least -O to work, otherwise a warning is given. If CFLAGS additionally contains -Werror, this warning turns into an error. As Openjdk build system intentionally deoptimizes certains files due to potential bad codegen during optimization, build will fail when both '-D_FORTIFY_SOURCE' and '-Werror' are used. As turning the optimizations back on will likely break things, the warning is silenced instead.
Signed-off-by: Erkka Kääriä <[email protected]> --- recipes-core/openjdk/openjdk-8_72b05.bb | 1 + recipes-core/openjdk/openjre-8_72b05.bb | 1 + ...openjdk8-silence-d_fortify_source-warning.patch | 54 ++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 recipes-core/openjdk/patches-openjdk-8/openjdk8-silence-d_fortify_source-warning.patch diff --git a/recipes-core/openjdk/openjdk-8_72b05.bb b/recipes-core/openjdk/openjdk-8_72b05.bb index f378b0a..bafc6cd 100644 --- a/recipes-core/openjdk/openjdk-8_72b05.bb +++ b/recipes-core/openjdk/openjdk-8_72b05.bb @@ -11,6 +11,7 @@ PATCHES_URI_append = "\ file://openjdk8-use_builtin_frame_address_0_rather_than_returning_address_of_local_variable.patch;apply=no \ file://openjdk8-fix-assembler-flag-handling-in-makefile.patch;apply=no \ file://openjdk8-fix-adlc-flags.patch;apply=no \ + file://openjdk8-silence-d_fortify_source-warning.patch;apply=no \ " do_install() { diff --git a/recipes-core/openjdk/openjre-8_72b05.bb b/recipes-core/openjdk/openjre-8_72b05.bb index 6d29d12..3a34848 100644 --- a/recipes-core/openjdk/openjre-8_72b05.bb +++ b/recipes-core/openjdk/openjre-8_72b05.bb @@ -9,6 +9,7 @@ PATCHES_URI_append = "\ file://openjdk8-fix-shark-build.patch;apply=no \ file://openjdk8-fix-shark-stdc++11.patch;apply=no \ file://openjdk8-use_builtin_frame_address_0_rather_than_returning_address_of_local_variable.patch;apply=no \ + file://openjdk8-silence-d_fortify_source-warning.patch;apply=no \ " do_install() { diff --git a/recipes-core/openjdk/patches-openjdk-8/openjdk8-silence-d_fortify_source-warning.patch b/recipes-core/openjdk/patches-openjdk-8/openjdk8-silence-d_fortify_source-warning.patch new file mode 100644 index 0000000..da94a99 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/openjdk8-silence-d_fortify_source-warning.patch @@ -0,0 +1,54 @@ +makefiles: Add -Wno-cpp to CFLAGS + +The security flag '-D_FORTIFY_SOURCE' requires at least -O to work, +otherwise a warning is given. If CFLAGS additionally contains -Werror, +this warning turns into an error. As Openjdk build system intentionally +deoptimizes certains files due to potential bad codegen during optimization, +build will fail when both '-D_FORTIFY_SOURCE' and '-Werror' are used. +As turning the optimizations back on will likely break things, the +warning is silenced instead. + +Signed-off-by: Erkka Kääriä <[email protected]> +--- + hotspot/make/linux/makefiles/amd64.make | 2 ++ + hotspot/make/linux/makefiles/i486.make | 2 ++ + hotspot/make/linux/makefiles/zero.make | 2 ++ + 3 files changed, 6 insertions(+) + +diff --git hotspot/make/linux/makefiles/amd64.make hotspot/make/linux/makefiles/amd64.make +index 2b77dba..db3965b 100644 +--- hotspot/make/linux/makefiles/amd64.make ++++ hotspot/make/linux/makefiles/amd64.make +@@ -31,4 +31,6 @@ CFLAGS += -DVM_LITTLE_ENDIAN + + CFLAGS += -D_LP64=1 + ++CFLAGS += -Wno-cpp ++ + OPT_CFLAGS/compactingPermGenGen.o = -O1 +diff --git hotspot/make/linux/makefiles/i486.make hotspot/make/linux/makefiles/i486.make +index 86e825d..6a92f09 100644 +--- hotspot/make/linux/makefiles/i486.make ++++ hotspot/make/linux/makefiles/i486.make +@@ -31,4 +31,6 @@ OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT) + # Must also specify if CPU is little endian + CFLAGS += -DVM_LITTLE_ENDIAN + ++CFLAGS += -Wno-cpp ++ + OPT_CFLAGS/compactingPermGenGen.o = -O1 +diff --git hotspot/make/linux/makefiles/zero.make hotspot/make/linux/makefiles/zero.make +index 0270711..2b05f33 100644 +--- hotspot/make/linux/makefiles/zero.make ++++ hotspot/make/linux/makefiles/zero.make +@@ -28,5 +28,7 @@ + # Select which files to use (in top.make) + TYPE = ZERO + ++CFLAGS += -Wno-cpp ++ + # Install libjvm.so, etc in in server directory. + VM_SUBDIR = server +-- +2.7.4 + -- 2.7.4 --------------------------------------------------------------------- Intel Finland Oy Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 - 4 Domiciled in Helsinki This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- _______________________________________________ Openembedded-devel mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-devel
