[PATCH 10/11] x86/purgatory: Compile purgatory.c with -D__NO_FORTIFY

From: Thomas Huth

Date: Thu Aug 13 2026 - 09:56:27 EST


From: Thomas Huth <thuth@xxxxxxxxxx>

purgatory.c includes both, the <crypto/sha2.h> header and the
arch/x86/boot/string.h header. The latter provides its own prototypes
for a lot of string functions which clash with the fortified macros
from <linux/string.h>.
The next patch will add #include <linux/string.h> to sha2.h to be able
to use memzero_explicit() there, so we have to compile the code in
purgatory.c with -D__NO_FORTIFY to avoid compilation problems in this
file.

Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
---
arch/x86/purgatory/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
index 5ce1d42630000..9191e3cffc30b 100644
--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -12,6 +12,7 @@ $(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
$(call if_changed_rule,cc_o_c)

CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY
+CFLAGS_purgatory.o += -D__NO_FORTIFY

# When profile-guided optimization is enabled, llvm emits two different
# overlapping text sections, which is not supported by kexec. Remove profile
--
2.55.0