Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4105180pxu; Wed, 9 Dec 2020 08:28:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRcynynCnsDmwx8lDAotOX/+O9p/TgAmK/BUnFalSh2QUSBsxTuXm790e1HXbGwnBsoB6I X-Received: by 2002:a17:907:101c:: with SMTP id ox28mr2546456ejb.201.1607531323708; Wed, 09 Dec 2020 08:28:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607531323; cv=none; d=google.com; s=arc-20160816; b=bxx66EunB1Yp3Qga7MEgsXRHiLWIie9onbF4qcxukLAeGc9wJT/6Ph8WK1R520M92j Lj66d/SHH+vnvZ+m2dHA6p3DR7F0EItXvlJwlki8lNc3ejErdYUQL5I4uhkfkovY6AXk ZTqzJAiTHTUqU78yAr7DKzzNvUys6+6Rb5dlnWUm/SAy8QIDswSh4XOPtqDEdZJlWiO1 BLgrOzTaHZGJL8dMLvtqVf85yk/0qGs8ltkIKIu12YyzOmVrxTC4DjU2oOVq0eeBqQYg cbBRljicxux4DtO2qZJjSPU0yBq7kQbyzAcYNHrm3NGj8XEs1RlKnDyyHwY+eL7zj2+i kCng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6iPujSFaRf63ICzfMH9y30wFs4tc+8uoN3o287lcAKc=; b=clPg0K5mz/oGoo8cXK+czSrNXLaylftK55msxainQIkRvQiVpNj9yCM8DdU7NreWFc UKEXN+qjFwIuJnSqyzJAzANO186O6zC4zyRy7jxGBvBzGcrEIwdjM0jSHchqurbfxOLJ pM1Gb/c8RHkva53Ptqc+/6s4JAz5Yh379OkGDU9hVy95y84dbWJFv0ISVrMcUCWVZjmv cpMUCVmjJpchE5VSRZjPdEbf7mbAeUzUGvJ931f2HDDIFhQDy95hrSNn9yDEtimzP3Sn 47NXUIu+VvDLv5NHRvkTPb5d3MEfcH6jYEvlKpC5zYhxzrHQaJK6sUR0lRVnGaQP4Thy 5CNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nzPpXpur; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr9si913570ejc.729.2020.12.09.08.28.19; Wed, 09 Dec 2020 08:28:43 -0800 (PST) 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=@google.com header.s=20161025 header.b=nzPpXpur; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731778AbgLIQ0N (ORCPT + 99 others); Wed, 9 Dec 2020 11:26:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729938AbgLIQ0G (ORCPT ); Wed, 9 Dec 2020 11:26:06 -0500 Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E969EC0613D6 for ; Wed, 9 Dec 2020 08:25:25 -0800 (PST) Received: by mail-vs1-xe42.google.com with SMTP id z16so1199540vsp.5 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=hMHyzRXUGaGRKuR2/CAs2k8xisSp64+m67GoLVKyOfOfJj1CzZZuu/8mDO/xFJuOBH GXQ5T91/JuQUtfFJ7THd/B/kIWAE5MN9QyV16xBu6wXB7Dm8kBAomLN6TkTuuwbwMQlX 7He5eObBK6wiAdBNCi9KXlv2Q3yio3pGNaiqN/Ut+n74nt26VJdnei3O02srJ6xBcJ2i 4PgX3oND3u+aHSk1oBhQnxXGlkncZgzAL4Sb1ZFUK8H9U1zUAm60GaK2H4RS4nGRckBH yGx7xDBTbwGyN1pr6XxkVovzwHXb2MOi718ucPbKzCew9Ukmpsz6axSRpGcp0IhDQWdw RuPg== X-Gm-Message-State: AOAM5303Af4VCr/cq1+XColA9rlP5d3sWzhyeebh7OM3RE1zs1QrCrAA zgdnfBG5uBecnz5Bf4aATY4RbTA4oFzjBKUvc5F7rA== 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-kernel@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