Locietta / xanmod-kernel-WSL2

Xanmod kernel for WSL2, built by clang with ThinLTO enabled. Build & Release are automated by Github Action.
GNU General Public License v2.0
88 stars 20 forks source link

[Kernel Patch] Remove `unreachable()` in nf_nat_fullcone fix patch. #67

Closed Locietta closed 5 months ago

Locietta commented 5 months ago

Previously, I use unreachable() to mark unreachable branches, so clang will not complain about variables uninitialized on unreachable branches.

It turns out that clang compilers will somehow emit empty basic blocks with unreachable() involved, which confuses objtool during the ThinLTO phase. It's very similar to https://lore.kernel.org/all/5913cdf4-9c8e-38f8-8914-d3b8a3565d73@kernel.org

objtool gives following warning👇

vmlinux.o: warning: objtool: nf_nat_handle_postrouting+0x291: can't find jump dest instruction at .text.nf_nat_handle_postrouting+0x14bf

So, it's better to avoid unreachable() and just initialize unreachable branch anyway. This fixes boot regression on my machine.

Resolve #65