summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-09-19 10:12:36 +0100
committerSam James <sam@gentoo.org>2023-09-19 10:12:36 +0100
commit01362dba1be773ca4782e753a5e63d68da43787d (patch)
treedd5c9df1eed9940895ddac36150303a7a7c18bc6 /sys-devel
parentdev-util/cppcheck: drop 2.6.3, 2.8.1, 2.8.1-r1, 2.8.2 (diff)
downloadgentoo-01362dba1be773ca4782e753a5e63d68da43787d.tar.gz
gentoo-01362dba1be773ca4782e753a5e63d68da43787d.tar.bz2
gentoo-01362dba1be773ca4782e753a5e63d68da43787d.zip
sys-devel/clang-common: adapt to 17 final (hardened mode); disable F_S for freestanding
* In 84bffb47c84bc57fbbd409a72e5ae3d1cdb8cf9e, we changed from -D_LIBCPP_ENABLE_ASSERTIONS=1 to -D_LIBCPP_ENABLE_HARDENED_MODE=1. Unfortunately, LLVM upstream has reverted last minute back to _ENABLE_ASSERTIONS in https://reviews.llvm.org/D159171. This didn't land in any RCs. Go back for 17.x (but not 18.x). * Disable F_S for freestanding (thanks ceamac!) as it might emit calls to e.g. _memcpy_chk. Closes: https://bugs.gentoo.org/912223 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/clang-common/clang-common-17.0.0.9999.ebuild11
-rw-r--r--sys-devel/clang-common/clang-common-18.0.0.9999.ebuild9
2 files changed, 17 insertions, 3 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 430e91d98aee..e3a7af989d05 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
@@ -169,12 +169,19 @@ src_install() {
# define __GENTOO_HAS_FEATURE(x) 0
# endif
#
- # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
+ # if defined(__STDC_HOSTED__) && __STDC_HOSTED__ == 1
+ # define __GENTOO_NOT_FREESTANDING 1
+ # else
+ # define __GENTOO_NOT_FREESTANDING 0
+ # endif
+ #
+ # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 && __GENTOO_NOT_FREESTANDING > 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
+ # undef __GENTOO_NOT_FREESTANDING
#endif
EOF
@@ -186,7 +193,7 @@ src_install() {
# Analogue to GLIBCXX_ASSERTIONS
# https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
# https://libcxx.llvm.org/Hardening.html#using-hardened-mode
- -D_LIBCPP_ENABLE_HARDENED_MODE=1
+ -D_LIBCPP_ENABLE_ASSERTIONS=1
EOF
cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die
diff --git a/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild b/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
index 430e91d98aee..baa1dffade6a 100644
--- a/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
@@ -169,12 +169,19 @@ src_install() {
# define __GENTOO_HAS_FEATURE(x) 0
# endif
#
- # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
+ # if defined(__STDC_HOSTED__) && __STDC_HOSTED__ == 1
+ # define __GENTOO_NOT_FREESTANDING 1
+ # else
+ # define __GENTOO_NOT_FREESTANDING 0
+ # endif
+ #
+ # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 && __GENTOO_NOT_FREESTANDING > 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
+ # undef __GENTOO_NOT_FREESTANDING
#endif
EOF