Thread (212 messages) 212 messages, 19 authors, 2020-09-10

Re: [PATCH 00/22] add support for Clang LTO

From: Sami Tolvanen <samitolvanen@google.com>
Date: 2020-07-07 16:05:40
Also in: linux-arch, linux-kbuild, linux-pci, lkml

On Tue, Jul 07, 2020 at 08:51:07AM -0700, Sami Tolvanen wrote:
After spending some time debugging this with Nick, it looks like the
error is caused by a recent optimization change in LLVM, which together
with the inlining of ur_load_imm_any into jeq_imm, changes a runtime
check in FIELD_FIT that would always fail, to a compile-time check that
breaks the build. In jeq_imm, we have:

    /* struct bpf_insn: _s32 imm */
    u64 imm = insn->imm; /* sign extend */
    ...
    if (imm >> 32) { /* non-zero only if insn->imm is negative */
    	/* inlined from ur_load_imm_any */
	u32 __imm = imm >> 32; /* therefore, always 0xffffffff */

        /*
	 * __imm has a value known at compile-time, which means
	 * __builtin_constant_p(__imm) is true and we end up with
	 * essentially this in __BF_FIELD_CHECK:
	 */
	if (__builtin_constant_p(__imm) && __imm <= 255)
Should be __imm > 255, of course, which means the compiler will generate
a call to __compiletime_assert.
Jiong, Jakub, do you see any issues here?
(Jiong's email bounced, so removing from the recipient list.)

Sami

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help