summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-02-03 10:29:26 +0000
committerCoprDistGit <infra@openeuler.org>2025-02-03 10:29:26 +0000
commitcb167f72af27aa8d3bc412351ce6590978135d1c (patch)
treedbc8f9c9a4fd475a3bce8a2107650c5496a5a0cd /macros
parent9d624aa4e88e5eb4b0df90060dcd40e518a7458b (diff)
automatic import of openEuler-rpm-config
Diffstat (limited to 'macros')
-rw-r--r--macros11
1 files changed, 10 insertions, 1 deletions
diff --git a/macros b/macros
index 47926b5..7e393a4 100644
--- a/macros
+++ b/macros
@@ -362,9 +362,18 @@ for k,_ in pairs(stripped_flags) do print(k .. " ") end
%_clang_lto_cflags -flto=thin
%_lto_cflags %{expand:%%{_%{toolchain}_lto_cflags}}
+# Default fortification level.
+# "%define _fortify_level 1" to downgrade and
+# "%define _fortify_level 0" or "%undefine _fortify_level" to disable
+#
+# We use a single -Wp here to enforce order so that ccache does not ever
+# reorder them.
+%_fortify_level 2
+%_fortify_level_flags %[ 0%{?_fortify_level} > 0 ? "-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=%{_fortify_level}" : "" ]
+
%_general_options -O2 %{?_lto_cflags} -g -grecord-gcc-switches -pipe -fstack-protector-strong %[ "%{toolchain}" == "clang" ? "-fgcc-compatible" : "" ]
%_warning_options -Wall -Werror=format-security
-%_preprocessor_defines -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
+%_preprocessor_defines %{_fortify_level_flags} -Wp,-D_GLIBCXX_ASSERTIONS
%__global_compiler_flags %{_general_options} %{_warning_options} %{_preprocessor_defines} %{_hardened_cflags}