Message ID | 20250110233706.1823649-3-hjl.tools@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DAA5C3857BA2 for <patchwork@sourceware.org>; Fri, 10 Jan 2025 23:38:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DAA5C3857BA2 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=I27rvykl X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) by sourceware.org (Postfix) with ESMTPS id E68973857C6A for <binutils@sourceware.org>; Fri, 10 Jan 2025 23:37:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E68973857C6A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E68973857C6A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c29 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736552232; cv=none; b=maR2EWRZmi5c0ixh90eDXTT05c9NkzDSkVdVOVAeMoNBi+I7Hbc1O4Emq6psRe5HRRxr3f/gQm/dS/ARC67ohbIkfdOMoQ6ZlWcM0R05azb1bxVs/ib2MXFrkqsvp1DQZiUvy74y3kjlimyXMIjyNiz9fNjC+TcCaW7Ke/1QHLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736552232; c=relaxed/simple; bh=t98bPbehx9vIrEf0BUousHxSFWYbkaiAGMIgj5pruag=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Vv5eFqD41q48lmi+62VtIb8IWJNb3b4iAChtlgTTDGsr7vb/iY8yvXy3Mr30I/FTjrWHu3NPXhWDMFHfer3asYAbQOx9xx5karUHV4rLn32+y3SJJ0wB5wP1k3U743uELaZJ+jFylEPbIFfOzKNug7iOpdDXouT/rHkO5DU+60c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E68973857C6A Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-5f321876499so1229213eaf.1 for <binutils@sourceware.org>; Fri, 10 Jan 2025 15:37:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736552231; x=1737157031; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1Pr1XRryOuS1sJ1LZyZxfnAsTo4QU6zpi+bezurPf1M=; b=I27rvyklfda9rpECZLLlpXKt+SApjqWP77YyYAJfeh1mJKP/UlvHJ06+Ffu5uyl1an iGARgXHnk5119zVqC8aEzkEKFPoomDm5jk+MwbfBmAw2o1FzfRV7XiJwUigaKsOTlG5b +qV2Mkxz6jnpjigXBbKo/gkp4Kdh2WmhD/lAIyy3GNB8NqP9rLjl+oZRkSFnpQ4V1s3R O2FLf41kDiB/3nFlhhKxc4xXvlcAXtJo2SitBwA5++cQRO4MzrS+ymfMThTnj9O3dF9O S79fnSBOziL4IqPXo5Qe6WRKyPcgbVW+q6zhnOxBb/Zmd2r4QWyQVudEKlxxZVP5xBjH aoiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736552231; x=1737157031; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1Pr1XRryOuS1sJ1LZyZxfnAsTo4QU6zpi+bezurPf1M=; b=A/zTSvoPU3+dJViy8FfRuE67tkzVHACTWv5qCOjLjG+4LllL0SUdEF0yYC8paXVmb2 6BoSus98IQeF0/KQeQvxzww/remsSsWF4ghFD4ISgMZwSJDFScBETcqD8bozL5MHtBo8 flAhKIxhUVTgLw+uSyJyYhd4KB2zed5IGEyJM7Bhia+QX5wPMqlSiusckVVtQ3Ao0Wju J8lM/W6LeMQ8hV7/R67jEyLntZn/ys2ag7leQwGAEeFdPX7PmZpsyv0jlff09C2Devk/ hEd9qYqZR+syvgAH6y7JfFv+xki/870pHCkQ82jkX0v5TP++n1xiSSUQe73jr+udTJu5 GJPQ== X-Gm-Message-State: AOJu0Ywn3baFdnAbumWCZ6VllCmYY/zXM4Qf7ie7kMShqe6MeUI+Jtiz YqxrUo4m4qrEJtahsVhZfkvKVdH6rI4qETAdccuo8H3nxEPBGC+n X-Gm-Gg: ASbGncuBTVBsQlS4KD8p7/ENUXgTNScALFI7Ljxom5DujYRhbU9tT26CGPEHeOxomUQ oRNAA7uPlPAFIqxs6CF1jq7+D+KJ8oKoeTfH4sP1e0ie3h+AokgwFF7iEJRgTemeRtB+ocYaicG 5i7aSDPxIh5xvSbiB2XxQjTaRjtJlRPYwTChklZXPknW1TS05IgOK4YzbgglNPfxSGeev/4nbMC w2ad5WZ5DsJ6u6SRzSIPsB05m1oGB3VDYop0RFgVEeUhFfQv4NE6XZR7X6fKTvhJZaU8XQb7NR7 P4iYItZ0r2mDRKfp X-Google-Smtp-Source: AGHT+IEezMvLsUeNf0ltFNBYPuyhn0x5nGWvugcmrZxXPFx/NxOgDf4BWcCaJBLcPKTXjYDnPWfrjw== X-Received: by 2002:a4a:e842:0:b0:5f2:b632:7e83 with SMTP id 006d021491bc7-5f880d1d425mr5543676eaf.2.1736552231122; Fri, 10 Jan 2025 15:37:11 -0800 (PST) Received: from gnu-tgl-3.localdomain ([172.58.109.61]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-723185481a5sm1195015a34.25.2025.01.10.15.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 15:37:10 -0800 (PST) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id A52B8C02D0; Sat, 11 Jan 2025 07:37:06 +0800 (CST) From: "H.J. Lu" <hjl.tools@gmail.com> To: binutils@sourceware.org Cc: nickc@redhat.com, sam@gentoo.org Subject: [PATCH v2 2/4] ld: Document mixing IR and non-IR objects for -r Date: Sat, 11 Jan 2025 07:37:04 +0800 Message-ID: <20250110233706.1823649-3-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250110233706.1823649-1-hjl.tools@gmail.com> References: <20250110233706.1823649-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3019.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
Series |
Add lto and none-lto input support for ld -r
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_binutils_build--master-arm | success | Build passed |
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 | success | Build passed |
linaro-tcwg-bot/tcwg_binutils_check--master-arm | fail | Test failed |
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 | fail | Test failed |
Commit Message
H.J. Lu
Jan. 10, 2025, 11:37 p.m. UTC
* ld.texi: Document mixing IR and non-IR relocatable files for
"ld -r".
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
ld/ld.texi | 10 ++++++++++
1 file changed, 10 insertions(+)
Comments
Random review comment: On Sat, 11 Jan 2025, H.J. Lu wrote: > * ld.texi: Document mixing IR and non-IR relocatable files for > "ld -r". > +files. Linker will extract it as input when creating executable or shared "*The* linker will extract it" brgds, H-P
On Fri, Jan 10, 2025 at 3:39 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > * ld.texi: Document mixing IR and non-IR relocatable files for > "ld -r". > > Signed-off-by: H.J. Lu <hjl.tools@gmail.com> > --- > ld/ld.texi | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/ld/ld.texi b/ld/ld.texi > index da714a20855..496dd5e5f83 100644 > --- a/ld/ld.texi > +++ b/ld/ld.texi > @@ -1126,6 +1126,16 @@ relocations. Different output formats can have further restrictions; for > example some @code{a.out}-based formats do not support partial linking > with input files in other formats at all. > > +On ELF platforms, when input files contain both IR and non-IR relocatable > +files, a .gnu_object_only section will be created to contain a relocatable > +object file, as if @samp{-r} is applied to all non-IR relocatable input > +files. Linker will extract it as input when creating executable or shared > +library. I have some questions when reading the description: * Is LTO performed on the IR files? * Is it true that the output sections are from the LTO compilation of the IR files while there is a special .gnu_object_only section whose content is a relocatable file that merges all non-IR relocatable files? > +Note that since @samp{-r} groups some sections from different input files > +together, there may be negative impacts on code size and locality in final > +executable or shared library. > + > This option does the same thing as @samp{-i}. > > @kindex -R @var{file} > -- > 2.47.1 >
On Sat, Jan 11, 2025 at 3:06 PM Hans-Peter Nilsson <hp@bitrange.com> wrote: > > Random review comment: > > On Sat, 11 Jan 2025, H.J. Lu wrote: > > > * ld.texi: Document mixing IR and non-IR relocatable files for > > "ld -r". > > > +files. Linker will extract it as input when creating executable or shared > > "*The* linker will extract it" Fixed. > brgds, H-P Thanks.
On Sun, Jan 12, 2025 at 12:45 AM Fangrui Song <i@maskray.me> wrote: > > On Fri, Jan 10, 2025 at 3:39 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > * ld.texi: Document mixing IR and non-IR relocatable files for > > "ld -r". > > > > Signed-off-by: H.J. Lu <hjl.tools@gmail.com> > > --- > > ld/ld.texi | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/ld/ld.texi b/ld/ld.texi > > index da714a20855..496dd5e5f83 100644 > > --- a/ld/ld.texi > > +++ b/ld/ld.texi > > @@ -1126,6 +1126,16 @@ relocations. Different output formats can have further restrictions; for > > example some @code{a.out}-based formats do not support partial linking > > with input files in other formats at all. > > > > +On ELF platforms, when input files contain both IR and non-IR relocatable > > +files, a .gnu_object_only section will be created to contain a relocatable > > +object file, as if @samp{-r} is applied to all non-IR relocatable input > > +files. Linker will extract it as input when creating executable or shared > > +library. > > I have some questions when reading the description: My wording isn't clear. How about this On ELF platforms, when the output contains both IR and non-IR contents, a .gnu_object_only section will be created to contain a relocatable object file, as if @samp{-r} is applied to all non-IR relocatable inputs. The linker will extract it as a separate input when creating the output. > * Is LTO performed on the IR files? LTO is optional. > * Is it true that the output sections are from the LTO compilation of > the IR files while there is a special .gnu_object_only section whose > content is a relocatable file that merges all non-IR relocatable > files? No. See my new wording above. > > > +Note that since @samp{-r} groups some sections from different input files > > +together, there may be negative impacts on code size and locality in final > > +executable or shared library. > > + > > This option does the same thing as @samp{-i}. > > > > @kindex -R @var{file} > > -- > > 2.47.1 > >
diff --git a/ld/ld.texi b/ld/ld.texi index da714a20855..496dd5e5f83 100644 --- a/ld/ld.texi +++ b/ld/ld.texi @@ -1126,6 +1126,16 @@ relocations. Different output formats can have further restrictions; for example some @code{a.out}-based formats do not support partial linking with input files in other formats at all. +On ELF platforms, when input files contain both IR and non-IR relocatable +files, a .gnu_object_only section will be created to contain a relocatable +object file, as if @samp{-r} is applied to all non-IR relocatable input +files. Linker will extract it as input when creating executable or shared +library. + +Note that since @samp{-r} groups some sections from different input files +together, there may be negative impacts on code size and locality in final +executable or shared library. + This option does the same thing as @samp{-i}. @kindex -R @var{file}