Skip to content

Commit 0e5b9f2

Browse files
nickdesaulnierskees
authored andcommitted
overflow: disable failing tests for older clang versions
Building the overflow kunit tests with clang-11 fails with: $ ./tools/testing/kunit/kunit.py run --arch=arm --make_options LLVM=1 \ overflow ... ld.lld: error: undefined symbol: __mulodi4 ... Clang 11 and earlier generate unwanted libcalls for signed output, unsigned input. Disable these tests for now, but should these become used in the kernel we might consider that as justification for dropping clang-11 support. Keep the clang-11 build alive a little bit longer. Avoid -Wunused-function warnings via __maybe_unused. To test W=1: $ make LLVM=1 -j128 defconfig $ ./scripts/config -e KUNIT -e KUNIT_ALL $ make LLVM=1 -j128 olddefconfig lib/overflow_kunit.o W=1 Link: ClangBuiltLinux#1711 Link: llvm/llvm-project@3203143 Reported-by: Nathan Chancellor <[email protected]> Signed-off-by: Nick Desaulniers <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3197060 commit 0e5b9f2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/overflow_kunit.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ static void do_test_ ## n(struct kunit *test, const struct test_ ## n *p) \
254254
check_one_op(t, fmt, mul, "*", p->b, p->a, p->prod, p->p_of); \
255255
} \
256256
\
257+
__maybe_unused \
257258
static void n ## _overflow_test(struct kunit *test) { \
258259
unsigned i; \
259260
\
@@ -720,8 +721,14 @@ static struct kunit_case overflow_test_cases[] = {
720721
KUNIT_CASE(u64_u64__u64_overflow_test),
721722
KUNIT_CASE(s64_s64__s64_overflow_test),
722723
#endif
723-
KUNIT_CASE(u32_u32__u8_overflow_test),
724+
/*
725+
* Clang 11 and earlier generate unwanted libcalls for signed output, unsigned
726+
* input.
727+
*/
728+
#if !(defined(CONFIG_CC_IS_CLANG) && __clang_major__ <= 11)
724729
KUNIT_CASE(u32_u32__int_overflow_test),
730+
#endif
731+
KUNIT_CASE(u32_u32__u8_overflow_test),
725732
KUNIT_CASE(u8_u8__int_overflow_test),
726733
KUNIT_CASE(int_int__u8_overflow_test),
727734
KUNIT_CASE(shift_sane_test),

0 commit comments

Comments
 (0)