11#
2- # Copyright (c) 2011, 2024 , Oracle and/or its affiliates. All rights reserved.
2+ # Copyright (c) 2011, 2025 , Oracle and/or its affiliates. All rights reserved.
33# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44#
55# This code is free software; you can redistribute it and/or modify it
@@ -235,9 +235,10 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
235235 CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
236236
237237 # Additional warnings that are not activated by -Wall and -Wextra
238- WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wreturn-type -Wsign-compare \
239- -Wtrampolines -Wundef -Wunused-const-variable=1 -Wunused-function \
240- -Wunused-result -Wunused-value -Wtype-limits -Wuninitialized"
238+ WARNINGS_ENABLE_ADDITIONAL="-Winvalid-pch -Wpointer-arith -Wreturn-type \
239+ -Wsign-compare -Wtrampolines -Wtype-limits -Wundef -Wuninitialized \
240+ -Wunused-const-variable=1 -Wunused-function -Wunused-result \
241+ -Wunused-value"
241242 WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual -Wreorder"
242243 WARNINGS_ENABLE_ALL_CFLAGS="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
243244 WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX"
@@ -277,7 +278,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
277278AC_DEFUN ( [ FLAGS_SETUP_QUALITY_CHECKS] ,
278279[
279280 # bounds, memory and behavior checking options
280- if test "x$TOOLCHAIN_TYPE" = xgcc; then
281+ if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang ; then
281282 case $DEBUG_LEVEL in
282283 release )
283284 # no adjustment
@@ -516,12 +517,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
516517 -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
517518 fi
518519
519- if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
520- # clang compiler on aix needs -ffunction-sections
521- TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -ftls-model -fno-math-errno -fstack-protector"
522- TOOLCHAIN_CFLAGS_JDK="-ffunction-sections -fsigned-char -fstack-protector"
523- fi
524-
525520 if test "x$TOOLCHAIN_TYPE" = xgcc; then
526521 TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fstack-protector"
527522 TOOLCHAIN_CFLAGS_JDK="-fvisibility=hidden -pipe -fstack-protector"
@@ -541,7 +536,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
541536 # Restrict the debug information created by Clang to avoid
542537 # too big object files and speed the build up a little bit
543538 # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
544- TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
539+ TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info -fstack-protector "
545540
546541 # In principle the stack alignment below is cpu- and ABI-dependent and
547542 # should agree with values of StackAlignmentInBytes in various
@@ -559,7 +554,13 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
559554 TOOLCHAIN_CFLAGS_JDK="-pipe"
560555 TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
561556 fi
562- TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -fvisibility=hidden"
557+
558+ if test "x$OPENJDK_TARGET_OS" = xaix; then
559+ TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -ftls-model -fno-math-errno"
560+ TOOLCHAIN_CFLAGS_JDK="-ffunction-sections -fsigned-char"
561+ fi
562+
563+ TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -fvisibility=hidden -fstack-protector"
563564
564565 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
565566 # The -utf-8 option sets source and execution character sets to UTF-8 to enable correct
@@ -736,6 +737,11 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
736737 # for all archs except arm and ppc, prevent gcc to omit frame pointer
737738 $1 _CFLAGS_CPU_JDK="${$1 _CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
738739 fi
740+ if test "x$FLAGS_CPU" = xppc64le; then
741+ # Little endian machine uses ELFv2 ABI.
742+ # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
743+ $1 _CFLAGS_CPU_JVM="${$1 _CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=power8 -mtune=power8"
744+ fi
739745 fi
740746 if test "x$OPENJDK_TARGET_OS" = xaix; then
741747 $1 _CFLAGS_CPU="-mcpu=pwr8"
0 commit comments