diff options
| author | Thomas Huth <thuth@redhat.com> | 2026-09-28 10:30:53 +0200 |
|---|---|---|
| committer | Eric Biggers <ebiggers@kernel.org> | 2026-09-30 09:42:09 -0700 |
| commit | e5fc5477391326a84217da8b35899ed6547552f0 (patch) | |
| tree | f6be8cee1c73657224a701248e66886cf40e2c0f /tools/perf/scripts/python/stackcollapse.py | |
| parent | 6df761375819da85517b2de53b3767f8f8dfb97c (diff) | |
| download | linux-e5fc5477391326a84217da8b35899ed6547552f0.tar.gz linux-e5fc5477391326a84217da8b35899ed6547552f0.zip | |
x86/purgatory: Compile purgatory with -D__NO_FORTIFY and -D__DISABLE_EXPORTS
A subsequent patch will add #include <linux/string.h> to <crypto/sha2.h>
to use memzero_explicit() there. This will introduce a conflict with the
purgatory code: 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>, causing the compiler to emit errors like this:
In file included from .../linux/include/linux/string.h:383,
from .../linux/include/crypto/sha2.h:10,
from .../linux/arch/x86/purgatory/purgatory.c:14:
.../linux/include/linux/fortify-string.h:576:63: error: expected identifier or ‘(’ before ‘{’ token
576 | p_size_field, q_size_field, op) ({ \
| ^
.../linux/include/linux/fortify-string.h:644:27: note: in expansion of macro ‘__fortify_memcpy_chk’
644 | #define memmove(p, q, s) __fortify_memcpy_chk(p, q, s, \
| ^~~~~~~~~~~~~~~~~~~~
.../linux/arch/x86/purgatory/../boot/string.h:11:7: note: in expansion of macro ‘memmove’
11 | void *memmove(void *dst, const void *src, size_t len);
| ^~~~~~~
.../linux/include/linux/fortify-string.h:208:9: error: expected identifier or ‘(’ before ‘__builtin_choose_expr’
208 | __builtin_choose_expr(__is_constexpr(__builtin_strlen(p)), \
| ^~~~~~~~~~~~~~~~~~~~~
./linux/arch/x86/purgatory/../boot/string.h:23:15: note: in expansion of macro ‘strlen’
23 | extern size_t strlen(const char *s);
| ^~~~~~
To avoid the problem, let's compile the whole code in the purgatory with
-D__NO_FORTIFY, so <linux/string.h> can properly be included from headers
like <crypto/sha2.h> in the purgatory, too.
When compiling/linking with the LLVM tools, and CONFIG_CFI=y, there is
an additional problem during linking:
ld.lld: error: undefined symbol: __memset
>>> referenced by string.c
>>> arch/x86/purgatory/purgatory.ro:(__UNIQUE_ID_addressable___memset_5)
ld.lld: error: undefined symbol: __memmove
>>> referenced by string.c
>>> arch/x86/purgatory/purgatory.ro:(__UNIQUE_ID_addressable___memmove_6)
This can be fixed by moving the -D__DISABLE_EXPORTS to the general CFLAGS
of the purgatory, too.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Link: https://patch.msgid.link/20260928083055.104266-2-thuth@redhat.com
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
