Re: [PATCH] objtool: ignore unreachable trap after call to noreturn functions

From: Josh Poimboeuf
Date: Thu Sep 17 2020 - 18:18:04 EST


On Thu, Sep 17, 2020 at 11:49:04AM +0300, Ilie Halip wrote:
> With CONFIG_UBSAN_TRAP enabled, the compiler may insert a trap instruction
> after a call to a noreturn function. In this case, objtool warns that the
> ud2 instruction is unreachable.
>
> objtool silences similar warnings (trap after dead end instructions), so
> expand that check to include dead end functions.
>
> Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> Cc: Rong Chen <rong.a.chen@xxxxxxxxx>
> Cc: Marco Elver <elver@xxxxxxxxxx>
> Cc: Philip Li <philip.li@xxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: kasan-dev@xxxxxxxxxxxxxxxx
> Cc: x86@xxxxxxxxxx
> Cc: clang-built-linux@xxxxxxxxxxxxxxxx
> BugLink: https://github.com/ClangBuiltLinux/linux/issues/1148
> Link: https://lore.kernel.org/lkml/CAKwvOdmptEpi8fiOyWUo=AiZJiX+Z+VHJOM2buLPrWsMTwLnyw@xxxxxxxxxxxxxx
> Suggested-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> Signed-off-by: Ilie Halip <ilie.halip@xxxxxxxxx>

The patch looks good to me. Which versions of Clang do the trap after
noreturn call? It would be good to have that in the commit message.

--
Josh