summaryrefslogtreecommitdiff
path: root/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/clang-common/clang-common-17.0.0.9999.ebuild')
-rw-r--r--sys-devel/clang-common/clang-common-17.0.0.9999.ebuild19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild b/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild
index 3165f42a329f..808c1e1a0ae1 100644
--- a/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild
@@ -106,11 +106,20 @@ src_install() {
# without optimization and that would at the very least be very noisy
# during builds and at worst trigger many -Werror builds.
cat >> "${ED}/usr/include/gentoo/fortify.h" <<- EOF || die
- #ifndef _FORTIFY_SOURCE
- #if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
- #define _FORTIFY_SOURCE ${fortify_level}
- #endif
- #endif
+ #ifndef _FORTIFY_SOURCE
+ # if defined(__has_feature)
+ # define __GENTOO_HAS_FEATURE(x) __has_feature(x)
+ # else
+ # define __GENTOO_HAS_FEATURE(x) 0
+ # endif
+ #
+ # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
+ # if !defined(__SANITIZE_ADDRESS__) && !__GENTOO_HAS_FEATURE(address_sanitizer) && !__GENTOO_HAS_FEATURE(memory_sanitizer)
+ # define _FORTIFY_SOURCE ${fortify_level}
+ # endif
+ # endif
+ # undef __GENTOO_HAS_FEATURE
+ #endif
EOF
if use hardened ; then