[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5913cdf4-9c8e-38f8-8914-d3b8a3565d73@kernel.org>
Date: Tue, 24 Aug 2021 13:08:58 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Josh Poimboeuf <jpoimboe@...hat.com>,
Peter Zijlstra <peterz@...radead.org>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
Sami Tolvanen <samitolvanen@...gle.com>,
Kees Cook <keescook@...omium.org>,
clang-built-linux@...glegroups.com, llvm@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: objtool warning in cfg80211_edmg_chandef_valid() with ThinLTO
Hi Josh and Peter,
An in-review LLVM patch [1] introduces an optimization around switch
cases, marking the default case unreachable when all known values are
covered. This ended up introducing a boot regression when building a
kernel with ThinLTO, which Sami reported initially [2] and I reported it
upstream, generating some discussion starting from [3].
There is an objtool warning about the function that the author of the
patch tracked down to be problematic:
vmlinux.o: warning: objtool: cfg80211_edmg_chandef_valid()+0x169: can't
find jump dest instruction at .text.cfg80211_edmg_chandef_valid+0x17b
The LLVM developers are under the impression that this is an issue with
objtool; specifically quoting Eli Friedman:
"The backend can, in general, create basic blocks that don't contain any
instructions, and don't fall through to another block. A jump table
entry can refer to such a block. I guess certain tools could be confused
by this.
If that's the issue, it should be possible to work around it using
'-mllvm -trap-unreachable'."
I can confirm that adding '-mllvm -trap-unreachable' to
KBUILD_{C,LD}FLAGS does resolve the issue but I am curious if that is an
adequate solution (as Nick has frowned upon the presence of '-mllvm'
flags) or if there is something that could be done on the objtool side.
I do have a small reproducer on Phabricator [4] and I can provide any
binary files that would be helpful for seeing what is going on here.
[1] https://reviews.llvm.org/D106056
[2] https://github.com/ClangBuiltLinux/linux/issues/1440
[3] https://reviews.llvm.org/D106056#2953104
[4] https://reviews.llvm.org/D106056#2961136
Cheers,
Nathan
Powered by blists - more mailing lists