Re: [PATCH v3 55/58] objtool/klp: Add test for absolute and __ADDRESSABLE symbols
From: Song Liu <song@kernel.org>
Date: 2026-09-15 23:30:00
Also in:
sashiko-reviews
On Mon, Sep 14, 2026 at 5:53 PM [off-list ref] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] objtool: test suite build failure on 32-bit architectures due to .quad -- commit 8413836c45f39cb1efbf4a2f69693cc56d13f861 Author: Song Liu [off-list ref] objtool/klp: Add test for absolute and __ADDRESSABLE symbols This commit adds a test fixture and script to ensure that objtool's livepatching features correctly handle absolute symbols and __ADDRESSABLE pointers without failing or crashing. It uses inline assembly to emit these structures for the test framework.quoted
diff --git a/tools/objtool/tests/generic/fixtures/abs_and_addressable.c b/tools/objtool/tests/generic/fixtures/abs_and_addressable.c new file mode 100644 index 0000000000000..6392ff99af421 --- /dev/null +++ b/tools/objtool/tests/generic/fixtures/abs_and_addressable.c[ ... ]quoted
+int helper(int x); +int helper(int x) { return x + 1; } + +/* The shape of __ADDRESSABLE(helper). */ +__asm__(".pushsection .discard.addressable, \"aw\"\n" + ".balign 8\n" + ".quad helper\n"[Severity: Medium] Does using ".quad" here cause a build failure on 32-bit architectures? When running the generic klp test suite on a 32-bit host (like 32-bit x86), the assembler cannot emit a 64-bit absolute relocation for a symbol and fails with an error like "cannot represent relocation type BFD_RELOC_64". Would using a pointer-sized assembly directive instead of hardcoding a 64-bit directive prevent this from causing a hard failure in build_one() when running `make tests` on 32-bit targets?
klp-build is for 64 bit only, so let's not worry about 32 bit targets. Thanks, Song