From patchwork Mon Oct 15 17:22:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 10642209 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1889F15E2 for ; Mon, 15 Oct 2018 17:22:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F261229B35 for ; Mon, 15 Oct 2018 17:22:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6B5B29B3F; Mon, 15 Oct 2018 17:22:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7223529B35 for ; Mon, 15 Oct 2018 17:22:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726684AbeJPBIe (ORCPT ); Mon, 15 Oct 2018 21:08:34 -0400 Received: from mail-it1-f201.google.com ([209.85.166.201]:44994 "EHLO mail-it1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbeJPBIe (ORCPT ); Mon, 15 Oct 2018 21:08:34 -0400 Received: by mail-it1-f201.google.com with SMTP id k69-v6so22985451ite.9 for ; Mon, 15 Oct 2018 10:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=XMcqh5XRoQ1PvlCwntYAcDsP0fw8oVCaOJbZpBP8xLk=; b=EotbEoNssUEaz7P7Ekbr7i/9IOmadX2W/Q2SdUowGSBDF5VMEg1tUE/iXqxySE4iKR IxzsKrYEDv6WCmUOphiF+wRmRN9sj5t/i8do5eH1ta8VSBV/zk0ZCiiGRaz9mrx1cAsh CM6dhLJrWb7IbcytOagh6Chu61r4FnseaXD9emjkyKs+WnV1sMShYrnOJOMEJHapMGGQ 9H3ZUN9s/mv2BOrb0eQ6epjxpJDUc7ihD9mU6aTIqivWIptCaK6Gu9K1b4FThz9+hra6 Wh6HL0s3S6CNNDwr95e49Lxbluv9ScqpC5XBzMAx+oKRo3VVVox3CSefh52rZUa9/y7D 2oRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=XMcqh5XRoQ1PvlCwntYAcDsP0fw8oVCaOJbZpBP8xLk=; b=O3dvez2ANQRPTsL8EkohVrvZj7O6Q2ZlHQCSCZPG1WLwaD3KfGLr+IA/3Vc2KgNO7M nKxTp0QpDlfZ4Mcfk/q/DBwUi+8DPiqoK7iCrd474OFd16kdZ3wA/4PdOrYApSdM1TJr EuP2oJqrfF+tHfj6xlznLArrY3FuYxF5zw2d4jLMaXW9ePG8ppbhzKBh8J8Tucx9hrmL umhOjXiLmdzh47EnMDl7u9UQyEgjWdq+vEdKwRCaLSAiBblS9DN3VeOd2ck5Q/bOtfQm dBz6UR7bPYghd/jVotCWvPXALFiAWkm9FSa7kJkGFde8H7IapzfP3sOgXWMLeEpYFolH o+Wg== X-Gm-Message-State: ABuFfohjSJ8k+p/FR6Uw/Xh4+6U6qM/kgmQkv6cS6Jsc2tSLDmoAKUeM tkxdQeppNaZRYKslrAivjelYe9muPSpCiDKCrWg= X-Google-Smtp-Source: ACcGV63Gkk658SnEs6ZnHLok8jbp90a/7A2jeP8tM27WFQDmSJWad/4kOrRPnEpGHTRewmPfjdpKmSZm/lujf+D286Y= X-Received: by 2002:a24:2153:: with SMTP id e80-v6mr14602605ita.1.1539624145088; Mon, 15 Oct 2018 10:22:25 -0700 (PDT) Date: Mon, 15 Oct 2018 10:22:21 -0700 Message-Id: <20181015172221.35709-1-ndesaulniers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog Subject: [PATCH] compiler.h: update definition of unreachable() From: ndesaulniers@google.com To: miguel.ojeda.sandonis@gmail.com Cc: luto@amacapital.net, jpoimboe@redhat.com, natechancellor@gmail.com, Nick Desaulniers , Christopher Li , linux-sparse@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fixes the objtool warning seen with Clang: arch/x86/mm/fault.o: warning: objtool: no_context()+0x220: unreachable instruction Fixes commit 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive") Josh noted that the fallback definition was meant to work around a pre-gcc-4.6 bug. GCC still needs to work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365, so compiler-gcc.h defines its own version of unreachable(). Clang and ICC can use this shared definition. Link: https://github.com/ClangBuiltLinux/linux/issues/204 Suggested-by: Andy Lutomirski Suggested-by: Josh Poimboeuf Tested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Miguel, would you mind taking this up in your new compiler attributes tree? include/linux/compiler.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 681d866efb1e..8875fd3243fd 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -124,7 +124,10 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, # define ASM_UNREACHABLE #endif #ifndef unreachable -# define unreachable() do { annotate_reachable(); do { } while (1); } while (0) +# define unreachable() do { \ + annotate_unreachable(); \ + __builtin_unreachable(); \ +} while (0) #endif /*