Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3022292pxb; Tue, 24 Aug 2021 13:11:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLWL1EmE2ybTujAIfdtx5syMnhsNhRgRCaDlhMQP7VqSu+ylCueZHtAgQGHhc0tTuzF6fe X-Received: by 2002:a05:6638:3789:: with SMTP id w9mr36300905jal.131.1629835875858; Tue, 24 Aug 2021 13:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629835875; cv=none; d=google.com; s=arc-20160816; b=kaN8i3KnjkonIqnq/qzbR2JZT2vLeCkx8v3wB36oiCJy1BRqh/NveralG5V7jQVi8/ hBwPdBs/CDVGq8JCT8buJc660w1zs3hyMusERwJ5iNegVfMG/fbnyxiyndbBorYCjGwB fJYqNfxctjZFuxmMMRxzvFIyjvP3HXyAaMchCb2+lAyRwup6YpZNjYLR3lc6LADvrsdp oCVWe+l50lf+87m71nEiVSGARLR800lrLy+4agcBc9e+EZWlMdqPgF17VBrssPW8itCV cvy2mUEpNV6Ei/V1EfAkryO4xFZyvvQpj0nf4RZqtp++00a4mahF3hBrcXxVonNKgS73 Jn9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:subject:from:cc:to :dkim-signature; bh=180NWdi9GChTnN9A449Q4qkhmJKB3Y7sltNdPuz6uTY=; b=TwkHkG1JV3KtM5K4LgtYSGwlwgIo5lLnn9lym2mDNK3mcwQSahQd9KofLOz6rcCeql H+x/M/mvTMmEnCKi1VZb1WofVUe5vJNbq0+JAvO1kqCx3yhiXOOwbp6SsF/KjPpx1cG0 SIRCyTe/J6oh0DcS3xV1HlFcgZ8L+/0n3ZNrOLxzBhyAHz+CpNMmsTMFM3YVn+pGrKIp 91dBLg0Njpg46yAmYcqsFLve0xmEMLcWdqMy0oQKBea8xeg6kyWDNHlLeiCuD6Oc7QP5 EsEhGZQaBZwbPitX0BWGSzYBmlELdKmaw5HjJ514MU87HZJkpBgAKg4AzJnjJcObEnxI kjTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VSa+FJEW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si8017603iom.43.2021.08.24.13.11.03; Tue, 24 Aug 2021 13:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VSa+FJEW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234860AbhHXUJq (ORCPT + 99 others); Tue, 24 Aug 2021 16:09:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:39320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234818AbhHXUJp (ORCPT ); Tue, 24 Aug 2021 16:09:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AA50B61357; Tue, 24 Aug 2021 20:09:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629835741; bh=uUxS3w4NOSn9JSUG4eMqaNfVV/q8mARt5VKtS0HjAJY=; h=To:Cc:From:Subject:Date:From; b=VSa+FJEW1fAO9sC2RDHgJXnRm4cep9Jr8x9LNqqVZtQF4m2Y/XogiDGoga9/EO7ZI sX4fBWXmTFJoZevWtijrx4i/dYx7RpZaU+SlQAYTLavRKpWjJ9uaTIWvtRYf0AfkuS q009nb+cnd5G93COlmYLj0jZ87/UR80e3XnuFIyOTUBxPANK7PiHGG52QXsZyQ7JQp Q4XNaYkQYLBLP+wZhioJn66cD/TbpQUUuPlfWK0BbRMi/qATZ98CW2TnZ3tbcpLHG9 s891+4NZiVkG2fz2uipkI8bJ2wsOOObUU1vSq9+qhHaPhPsvvJCJGfR7wKYaFBLojk ls1ba2BbiQt/g== To: Josh Poimboeuf , Peter Zijlstra Cc: Nick Desaulniers , Sami Tolvanen , Kees Cook , clang-built-linux@googlegroups.com, llvm@lists.linux.dev, linux-kernel@vger.kernel.org From: Nathan Chancellor Subject: objtool warning in cfg80211_edmg_chandef_valid() with ThinLTO Message-ID: <5913cdf4-9c8e-38f8-8914-d3b8a3565d73@kernel.org> Date: Tue, 24 Aug 2021 13:08:58 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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