Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5636225img; Wed, 27 Mar 2019 12:10:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+eYBMnZwOiJ/Bt8SigVCAeCGcSD0+0+dfwJZ4zSG5yuBPUoFlXELhr1n1xhRflx9FOaQX X-Received: by 2002:a17:902:b181:: with SMTP id s1mr38338541plr.321.1553713836432; Wed, 27 Mar 2019 12:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553713836; cv=none; d=google.com; s=arc-20160816; b=R3tYz8+N7OhZgqGDRgcyO1H3hT+PT9fIuRP1dwEapgIG+SeF6z3u+Kwu5yrWovQRpD q6M1cpYM5ubXpNT4OSbxpb7uv7VqV4izz/1ZcnNhLoViRt3I5gVcYE7A5+fbRXXDP3aa hpryhwVU9iiN4VwOpANb8clRhyxU+28Ve+rPe4fJrGAOz/2LpK5XWjXg6WCSydY6z/to NJdmWTIBey6GdDNr5si+bTN+R2UeyOHT4HvJ7EQGvX1zFjDbCGauJ2crxfxrCEGEQc9i DtilCNchiXAVN7kjkzq+X9HvuAvAt5hfzKqYCAt3WoL1zCfRxWYGf+Ro5svD+I01Iiq9 Glig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=mLG2a6apNdDfqgqbTMBC5zTn8R47W+n4LSwXNsQfDYU=; b=mq8BK7B1+g6KKgEKGXONKJF3oEXkkbFTvsr5IUdTJRZBKC5oJALSnnON/Hlfb6oPa4 jFPeJkYqL0SPr9YuEKd3H98aTWn3SOcvTReidHbZSBhtBucoy5CFpdf6V1iLqBsLSHHr c6XiRlUXrs451AnOUx5iBiuFITSENhodFhk9AHJB8UnUJ7Mq8mAHduCwtjCCv/SUh/Wp EdMmpk5MGcv2tEo6P030ZcCVSeM5zTFIjssZguNLFJtule3szanM45t62av2Xd0p/0YW 2Gwr1YpXyiDEDvfaTZSdxmqqI7ca0ic8lah+N+4KpmY2f7iu/WLUSGZA11vtU41bEQbz kasg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si20674130plb.138.2019.03.27.12.10.21; Wed, 27 Mar 2019 12:10:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389377AbfC0TIc (ORCPT + 99 others); Wed, 27 Mar 2019 15:08:32 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:51551 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727932AbfC0TIb (ORCPT ); Wed, 27 Mar 2019 15:08:31 -0400 Received: from p5492e2fc.dip0.t-ipconnect.de ([84.146.226.252] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1h9DuS-0006py-0s; Wed, 27 Mar 2019 20:08:24 +0100 Date: Wed, 27 Mar 2019 20:08:23 +0100 (CET) From: Thomas Gleixner To: Andi Kleen cc: Andi Kleen , x86@kernel.org, Andrew Morton , LKML , Josh Poimboeuf Subject: Re: [PATCH 02/17] x86, lto: Mark all top level asm statements as .text In-Reply-To: <20190327154522.GV18020@tassilo.jf.intel.com> Message-ID: References: <20190321220009.29334-1-andi@firstfloor.org> <20190321220009.29334-3-andi@firstfloor.org> <20190326213803.GN18020@tassilo.jf.intel.com> <20190327005523.bbxxittqf4d5bdz5@two.firstfloor.org> <20190327145918.GU18020@tassilo.jf.intel.com> <20190327154522.GV18020@tassilo.jf.intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 27 Mar 2019, Andi Kleen wrote: > > From the GCC manual: > > > > "This attribute, attached to a global variable or function, nullifies the > > effect of the -fw hole-program command-line option, so the object remains > > visible outside the current compilation unit." > > > > Neither the variable nor the data generated are global anymore. This data > > is only used inside this compilation unit and I don't see why LTO needs a > > reference outside of it. If so, then I really want to understand WHY > > exactly. > > The LTO code generation doesn't compile file by file, but reorders > all the functions and other top level statements into "partitions". > The partitions are ordered by call graph so that inlining and some > other optimizations work efficiently > > Then it finally runs multiple copies of the gcc code generator that > generate code from these partitions, each generating an own assembler file. > > The top level assembler is not part of the call graph that drives > the partitioning. There is no top level assembly anymore. It's static data in the .rodata section which is completely uninteresting for a call graph. That data is accessed by the C function. It's static so it's scope is within the file and whatever GCC does with that C function it has to respect that it accesses static data. If that's not true then this really needs to be fixed at the compiler side and not in the kernel. Thanks, tglx