]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/bugs: Make i386 use GENERIC_BUG_RELATIVE_POINTERS
authorPeter Zijlstra <peterz@infradead.org>
Wed, 26 Nov 2025 10:57:06 +0000 (11:57 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 27 Nov 2025 08:32:48 +0000 (09:32 +0100)
Linus figured less #ifdef is more better and making x86-32 use
GENERIC_BUG_RELATIVE_POINTERS removes one layer of macro magic from
the bug.h bits.

Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
arch/x86/Kconfig
arch/x86/include/asm/bug.h

index ac9692093215f1623ec2a625ca1e6ee5e349ffa1..31c54d6480e0c0fdd669c2f97fb2722d202cba1b 100644 (file)
@@ -380,7 +380,7 @@ config GENERIC_CSUM
 config GENERIC_BUG
        def_bool y
        depends on BUG
-       select GENERIC_BUG_RELATIVE_POINTERS if X86_64
+       select GENERIC_BUG_RELATIVE_POINTERS
 
 config GENERIC_BUG_RELATIVE_POINTERS
        bool
index 4b5ab56903bb784e40105cafdc7605ba40cdd748..ab5bba6cf7f52bf817222d81bb16621580ab0af9 100644 (file)
@@ -42,16 +42,10 @@ extern void __WARN_trap(struct bug_entry *bug, ...);
 
 #ifdef CONFIG_GENERIC_BUG
 
-#ifdef CONFIG_X86_32
-#define __BUG_REL(val)         ".long " val
-#else
-#define __BUG_REL(val)         ".long " val " - ."
-#endif
-
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 #define __BUG_ENTRY_VERBOSE(file, line)                                        \
-       "\t" __BUG_REL(file)   "\t# bug_entry::file\n"                  \
-       "\t.word " line        "\t# bug_entry::line\n"
+       "\t.long " file " - .\t# bug_entry::file\n"                     \
+       "\t.word " line     "\t# bug_entry::line\n"
 #else
 #define __BUG_ENTRY_VERBOSE(file, line)
 #endif
@@ -59,7 +53,7 @@ extern void __WARN_trap(struct bug_entry *bug, ...);
 #if defined(CONFIG_X86_64) || defined(CONFIG_DEBUG_BUGVERBOSE_DETAILED)
 #define HAVE_ARCH_BUG_FORMAT
 #define __BUG_ENTRY_FORMAT(format)                                     \
-       "\t" __BUG_REL(format)  "\t# bug_entry::format\n"
+       "\t.long " format " - .\t# bug_entry::format\n"
 #else
 #define __BUG_ENTRY_FORMAT(format)
 #endif
@@ -69,7 +63,7 @@ extern void __WARN_trap(struct bug_entry *bug, ...);
 #endif
 
 #define __BUG_ENTRY(format, file, line, flags)                         \
-       __BUG_REL("1b")         "\t# bug_entry::bug_addr\n"             \
+       "\t.long 1b - ."        "\t# bug_entry::bug_addr\n"             \
        __BUG_ENTRY_FORMAT(format)                                      \
        __BUG_ENTRY_VERBOSE(file, line)                                 \
        "\t.word " flags        "\t# bug_entry::flags\n"