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=-9.6 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 3FC24C43461 for ; Thu, 10 Sep 2020 16:30:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02EA220829 for ; Thu, 10 Sep 2020 16:30:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="eS8Omoyt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726176AbgIJQag (ORCPT ); Thu, 10 Sep 2020 12:30:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbgIJQ1u (ORCPT ); Thu, 10 Sep 2020 12:27:50 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FCEBC061389 for ; Thu, 10 Sep 2020 08:07:11 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id j7so1058210plk.11 for ; Thu, 10 Sep 2020 08:07:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CkdZTgPQtli4HqKjoybGJC69i/K2eo+/Y/ueOVTU/uQ=; b=eS8OmoytThC7KUY/Rbjn9+OdhHCTAxZHZhtO9Ll397opaMxtZwThboa+C2O8ZFCyZO 3yO7BFlQAHn+yHQOjTkSFxrGQT55I8zRk+ACqC8mUlAGEgaJBYVxdtDOeJYvRXY7OjD1 qoTqm7lymwBPWk5HvlxgcsMnJSmrWwc/CDEf5vU234aNsYZC/feumKaSOaVQM1oeg2rp 5mn5icPj2L2oVd+okglM+aUogVgHmTvRe+DoweL0N0v4d2/lpxJ7oBj1ZuDkqyJtw+x2 MyX0f8gzheaFJLMAEkWsyGR+2G8QUbr85wv/70bydcasoZ+1oXcDIR0JEbGlmuon6m7C zqwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CkdZTgPQtli4HqKjoybGJC69i/K2eo+/Y/ueOVTU/uQ=; b=Nt/BDSGAnhFtibfOJXeYQqsqXJvf8QA/9h+MNh1+Tde+MUXQ2MbnJYbFf+CaABPKgp KEB7k34H4Hr5fXSPbZv/+XiOCzCgs9tPCQTA38fiGVX5oftOJLB7utNS3tDTLVMuD1Ol rqOeW6ejWeQY6J0Z48foyVwZk4loS6TqOWTT7qE18yREgKNwG5ftZXo3IwPoWHljjetr p0fJmMUQpafW+eNPyoHIhccrEJzPyzzThLIrjQMzsnT7dNhOIxLAiTHpkZS0iegzS4sU 7uYd40lDRPLbyiI0AnoD+tECkRuDcBOG+HW1wV0+YCleMTXDWGx321Wwkz+Ah+Y5Sjb9 D9Ng== X-Gm-Message-State: AOAM532McgSuOZhwWuuZ/ZnF97ScP0M630lSsSiRm/nDfIauX+h20Lys hgwW9Sdf7Dshqw1DxUeAk95AEA== X-Google-Smtp-Source: ABdhPJzgkkNJGQRPeFg7lZtu3UZBjQBkf2nGy3Om/c9n+Dj7KFkAAjDpg1xpd04kYgbe9qjhwsW3RQ== X-Received: by 2002:a17:902:82c1:: with SMTP id u1mr6062512plz.38.1599750430560; Thu, 10 Sep 2020 08:07:10 -0700 (PDT) Received: from google.com ([2620:15c:201:2:f693:9fff:fef4:1b6d]) by smtp.gmail.com with ESMTPSA id p5sm5097827pgm.66.2020.09.10.08.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 08:07:09 -0700 (PDT) Date: Thu, 10 Sep 2020 08:07:04 -0700 From: Sami Tolvanen To: David Woodhouse Cc: Masahiro Yamada , Will Deacon , Peter Zijlstra , Steven Rostedt , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v2 15/28] init: lto: ensure initcall ordering Message-ID: <20200910150704.GA2041735@google.com> References: <20200624203200.78870-1-samitolvanen@google.com> <20200903203053.3411268-1-samitolvanen@google.com> <20200903203053.3411268-16-samitolvanen@google.com> <5f45f55340cf54f5506a50adf61e49b27b904322.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f45f55340cf54f5506a50adf61e49b27b904322.camel@infradead.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Thu, Sep 10, 2020 at 10:25:40AM +0100, David Woodhouse wrote: > On Thu, 2020-09-03 at 13:30 -0700, Sami Tolvanen wrote: > > With LTO, the compiler doesn't necessarily obey the link order for > > initcalls, and initcall variables need globally unique names to avoid > > collisions at link time. > > > > This change exports __KBUILD_MODNAME and adds the initcall_id() macro, > > which uses it together with __COUNTER__ and __LINE__ to help ensure > > these variables have unique names, and moves each variable to its own > > section when LTO is enabled, so the correct order can be specified using > > a linker script. > > > > The generate_initcall_ordering.pl script uses nm to find initcalls from > > the object files passed to the linker, and generates a linker script > > that specifies the intended order. With LTO, the script is called in > > link-vmlinux.sh. > > Is this guaranteed to give you the *same* initcall ordering with LTO as > without? Yes. It follows the link order, just like the linker without LTO, and also preserves the order within each file. Sami