From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50E44C4361B for ; Wed, 9 Dec 2020 16:26:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1FCA523BDF for ; Wed, 9 Dec 2020 16:26:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731831AbgLIQ0G (ORCPT ); Wed, 9 Dec 2020 11:26:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731314AbgLIQ0G (ORCPT ); Wed, 9 Dec 2020 11:26:06 -0500 Received: from mail-vs1-xe41.google.com (mail-vs1-xe41.google.com [IPv6:2607:f8b0:4864:20::e41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9CA9C061793 for ; Wed, 9 Dec 2020 08:25:25 -0800 (PST) Received: by mail-vs1-xe41.google.com with SMTP id s85so1201835vsc.3 for ; Wed, 09 Dec 2020 08:25:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6iPujSFaRf63ICzfMH9y30wFs4tc+8uoN3o287lcAKc=; b=nzPpXpurtim/Xt5h6cpZ0FcvFvOqsIz73uPe8GdrX81v6Uzipkco7k/pVTqqXga/3b t+MHYk2nyM/C5LzuujzPgJdof9Lw0igpw+9YIzcLX2aV9A7LWZuzXeyuxEEk0n6rnxmr aB75dnMFiO0VIGfeysS0gVynJ82rbBrfZklB+Bzln+JpuyM1FmY2SW0AVlvT8AFlHmcv +k2dhUROuMIdDtrfh/AYyNOH6SNMuuXgt6E9DSBT8poKxOx/tZH9KA6OYlO1moFwCsec UN8w6J3OR3+Eg9iTGgpIl1yYNJAoycddhbXwnLvbb6Sd+NqVgZFEd0Hm1D7SxRunGlrN MppQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6iPujSFaRf63ICzfMH9y30wFs4tc+8uoN3o287lcAKc=; b=CWYiQVMxyRH8h8GY47quK+h4HFGGWePNRUGgoxvn0VWQXccFSmSAm/tBbeirkq/0z3 MdGmh0zlD8kSG9hF+kDQjjxwiJBYAp7z6MMMtcqNEfuyCUmd/MX04Y23OjaajeYdywNb aiDlCXVx2NcIhC/nKxpG14cqc2ZGdSbdkKq+IVC+4rNJdx3Qk/GtTmXXiP2Z5AuhHqlR Vy4jpAncQ4rfLpKgV7ZxcByqWg5mHpiMazqnA/L2JVKSLcMJINLQFDoQVteyVfFo1JMT nAnVPAnguu9TkhpWrN8v+4haNFj2KBpgV7yYCdzkfolBqWg/DrpEtbq1Pwxxk7hAIM2e ptlg== X-Gm-Message-State: AOAM530xpaQeloa/64oRLCArKNxVbPPbkZwBWjsW0pxVLUEm+qBGLP6z YimlTB5FjIk7hHPL8yTuXX7Y//+X1QVIR9MixejN2w== X-Google-Smtp-Source: ABdhPJyTSS/IMLVSvJ+ApeZ9gBaaSGKG/HtQ8GyhKk+KWuIUDMry01JIQBMoQq94UvqMYjXmfFLduigKrpEFXyqQG0Y= X-Received: by 2002:a67:2cc1:: with SMTP id s184mr2651932vss.23.1607531124951; Wed, 09 Dec 2020 08:25:24 -0800 (PST) MIME-Version: 1.0 References: <20201201213707.541432-1-samitolvanen@google.com> In-Reply-To: From: Sami Tolvanen Date: Wed, 9 Dec 2020 08:25:13 -0800 Message-ID: Subject: Re: [PATCH v8 00/16] Add support for Clang LTO To: Arnd Bergmann Cc: Masahiro Yamada , Steven Rostedt , Will Deacon , Josh Poimboeuf , Peter Zijlstra , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux , Kernel Hardening , linux-arch , Linux ARM , Linux Kbuild mailing list , "linux-kernel@vger.kernel.org" , linux-pci Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Wed, Dec 9, 2020 at 4:36 AM Arnd Bergmann wrote: > > On Tue, Dec 8, 2020 at 1:15 PM Arnd Bergmann wrote: > > > > - one build seems to have dropped all symbols the string operations > > from vmlinux, > > so while the link goes through, modules cannot be loaded: > > ERROR: modpost: "memmove" [drivers/media/rc/rc-core.ko] undefined! > > ERROR: modpost: "memcpy" [net/wireless/cfg80211.ko] undefined! > > ERROR: modpost: "memcpy" [net/8021q/8021q.ko] undefined! > > ERROR: modpost: "memset" [net/8021q/8021q.ko] undefined! > > ERROR: modpost: "memcpy" [net/unix/unix.ko] undefined! > > ERROR: modpost: "memset" [net/sched/cls_u32.ko] undefined! > > ERROR: modpost: "memcpy" [net/sched/cls_u32.ko] undefined! > > ERROR: modpost: "memset" [net/sched/sch_skbprio.ko] undefined! > > ERROR: modpost: "memcpy" [net/802/garp.ko] undefined! > > I first thought this was related to a clang-12 bug I saw the other day, but > > this also happens with clang-11 > > It seems to happen because of CONFIG_TRIM_UNUSED_KSYMS, > which is a shame, since I think that is an option we'd always want to > have enabled with LTO, to allow more dead code to be eliminated. Ah yes, this is a known issue. We use TRIM_UNUSED_KSYMS with LTO in Android's Generic Kernel Image and the problem is that bitcode doesn't yet contain calls to these functions, so autoksyms won't see them. The solution is to use a symbol whitelist with LTO to prevent these from being trimmed. I suspect we would need a default whitelist for LTO builds. Sami