diff options
author | Ryan Moeller <[email protected]> | 2020-02-06 12:24:37 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-06 09:24:37 -0800 |
commit | 5b7e6a36175c1c13803785557b17977d2a9ecd9d (patch) | |
tree | 135889609205c599ac5173f4f102ba2f51e4ce76 | |
parent | 81acb1edcb595a7377a6ad188c65dd23f2702ce9 (diff) |
Fix unknown cc flag -fno-ipa-sra
Clang does not recognize -fno-ipa-sra, so add a check for it.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Prakash Surya <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #9946
-rw-r--r-- | config/always-compiler-options.m4 | 21 | ||||
-rw-r--r-- | config/zfs-build.m4 | 5 |
2 files changed, 24 insertions, 2 deletions
diff --git a/config/always-compiler-options.m4 b/config/always-compiler-options.m4 index f903655fa..ca8b6bfcc 100644 --- a/config/always-compiler-options.m4 +++ b/config/always-compiler-options.m4 @@ -160,3 +160,24 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_OMIT_FRAME_POINTER], [ CFLAGS="$saved_flags" AC_SUBST([NO_OMIT_FRAME_POINTER]) ]) + +dnl # +dnl # Check if cc supports -fno-ipa-sra option. +dnl # +AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_IPA_SRA], [ + AC_MSG_CHECKING([whether $CC supports -fno-ipa-sra]) + + saved_flags="$CFLAGS" + CFLAGS="$CFLAGS -Werror -fno-ipa-sra" + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [ + NO_IPA_SRA=-fno-ipa-sra + AC_MSG_RESULT([yes]) + ], [ + NO_IPA_SRA= + AC_MSG_RESULT([no]) + ]) + + CFLAGS="$saved_flags" + AC_SUBST([NO_IPA_SRA]) +]) diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 5b53e9c5c..2ee9b8eb9 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -59,9 +59,9 @@ AC_DEFUN([ZFS_AC_DEBUG], [ ]) AC_DEFUN([ZFS_AC_DEBUGINFO_ENABLE], [ - DEBUG_CFLAGS="$DEBUG_CFLAGS -g -fno-inline -fno-ipa-sra" + DEBUG_CFLAGS="$DEBUG_CFLAGS -g -fno-inline $NO_IPA_SRA" - KERNEL_DEBUG_CFLAGS="$KERNEL_DEBUG_CFLAGS -fno-inline -fno-ipa-sra" + KERNEL_DEBUG_CFLAGS="$KERNEL_DEBUG_CFLAGS -fno-inline $NO_IPA_SRA" KERNEL_MAKE="$KERNEL_MAKE CONFIG_DEBUG_INFO=y" DEBUGINFO_ZFS="_with_debuginfo" @@ -158,6 +158,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION ZFS_AC_CONFIG_ALWAYS_CC_NO_OMIT_FRAME_POINTER + ZFS_AC_CONFIG_ALWAYS_CC_NO_IPA_SRA ZFS_AC_CONFIG_ALWAYS_CC_ASAN ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD ZFS_AC_CONFIG_ALWAYS_SYSTEM |