Message ID | 20240905111452.2554-1-hjl.tools@gmail.com |
---|---|
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 B0FD9384AB53 for <patchwork@sourceware.org>; Thu, 5 Sep 2024 11:15:42 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 361CE3850200 for <binutils@sourceware.org>; Thu, 5 Sep 2024 11:14:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 361CE3850200 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 361CE3850200 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::431 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725534897; cv=none; b=HlIg3aaMxnMjdmMmI0LzxhT551Ht6rrZz9F82/PxH1+Gg/PuyVQgR+Gb7J3Dc2qAgRCC0FKQTUGv0oWtr7xiybbngsoefFo1UGpzgk3kEkkfRnQPw4gO0bxrnWqNAChw3mMFmkXeywoT/6E2L51/d1nKqEhFQpZBfDTHVvXjY+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725534897; c=relaxed/simple; bh=IMlQpRcwcG3eLuu/2bwpGbj/Mmkai2evEUb/OCenFu4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=r8i6kr69c++x1B2uEUHw98/dDzw6Yh7QvGkRmTt+QakZ2fqP/Ltwodts93vnAEDDx0RpoP5mF3IGjcbgRs5cp7Lp89f0HBmYpITSt1hvzzln/lusFKxdtztYFdlCex/0DBIM7N5YXgwKfXuNg1wesWUC4PUTtOtKDf47QN06Hrk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-7179069d029so316333b3a.2 for <binutils@sourceware.org>; Thu, 05 Sep 2024 04:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725534894; x=1726139694; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=83WSeLs84owjY1envtrmYhTYpFXdwI46mmMZ+htZ8XE=; b=cdQYcldHGmSOq30eJ2VpuMBYF7OwUSaPxvIKoEmjjnmp9QgFlMEiKJohaKFUmHAiQ5 G1t3kKlAxHmkmiaPHPCnMj2Ncruh/pJcrCN50TCPPztriQ3wTwXf3Kc2EKk0FL8PtLT+ gVaTd5RwPT3QTuoGZ1pSjV5yE8wxTK1odbQEG6DoYk+RcFjNf5NoUe2vcFsOsLdWx+9W sp/luYaV+zVLvnb/dMasrIfB71I3cm1WKj5ak2h6vqcXWl4r7pc4H9aBY/uJOzt1tAGM zX9EkgFia79z7kNSWIjNgMeW7eRC764lnYmYM6LdK4ta4ibSuhBMivkfWHjyK5m5MQ9V LLtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725534894; x=1726139694; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=83WSeLs84owjY1envtrmYhTYpFXdwI46mmMZ+htZ8XE=; b=DxJQOHRi4RWueqUgD9/TwaHLKYRqXeHOCI6nR5qwkE8DcHtpWQRVm+1z/dmXenW4HS Hny5vMp0CZhgt2i1O/4v6+dxiOmHftNiV/dv4lN5PmLqY9Dpvhdl4PVOO9N121WTXUd1 jBabd5bQufltJC6v8y6fzJb/wlbi6EQJ+ZA73gD/I7adbDTjbvcSH80OntckG7sTMJeU 8bGpJKFxbkyfdlAPN8udt7WsTBQSI7lV+MebPe3I28Vwa3/t06UGEPpE0cDVfrCjV3nj GEyOF5yQqkr0tYn4lrjIWe3PuvowO8zxWGWJ/7oU/9nH0d04SaI7SIgc+wQYeVzkvx/l ls+Q== X-Gm-Message-State: AOJu0YzPqVZxme+XOsTMrIFAhQKtA0w639sETUUZcK/v/IaCZFkCcxJB 76k3Ud4hCa3CSyYWE6nKBf+7prYT6fkddGc5jXjOH9dhuDVV+D1y X-Google-Smtp-Source: AGHT+IHAr6KY8aICoDDZRd8UcooCQW1Ahpricp2+p+qJCyZkeJfttMvuM71OiyLREEuuz/ti16WPeA== X-Received: by 2002:a05:6a00:887:b0:714:3cd0:a7b2 with SMTP id d2e1a72fcca58-7173fb7d6c6mr18181455b3a.28.1725534893893; Thu, 05 Sep 2024 04:14:53 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.59.129.158]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d4fbd85a0asm3167313a12.2.2024.09.05.04.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 04:14:53 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 8401AC00BF; Thu, 5 Sep 2024 04:14:52 -0700 (PDT) From: "H.J. Lu" <hjl.tools@gmail.com> To: binutils@sourceware.org Cc: nickc@redhat.com, amodra@gmail.com, sam@gentoo.org Subject: [PATCH v2 0/4] Add lto and none-lto input support for ld -r Date: Thu, 5 Sep 2024 04:14:48 -0700 Message-ID: <20240905111452.2554-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3014.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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
|
|
Message
H.J. Lu
Sept. 5, 2024, 11:14 a.m. UTC
Changes in v2: 1. Allow no-leading spaces in "objdump -h" output. --- We generate a mixed ET_REL object with ld -r from non-IR ET_REL objects and IR ET_REL objects, which contains IR sections and a special non-IR section. When generating ET_EXEC or ET_DYN output, linker extracts an non-IR ET_REL object from the special non-IR section in the mixed ET_REL object and adds it to the list of linker inputs. H.J. Lu (4): ld: Add lto and none-lto input support for ld -r Add test for nm on mixed LTO/non-LTO object Don't check the plugin target twice h8300: Handle .gnu_object_only section bfd/bfd-in2.h | 16 +- bfd/bfd.c | 46 +- bfd/elf.c | 1 + bfd/format.c | 39 +- bfd/opncls.c | 66 ++ bfd/plugin.c | 193 +++++- bfd/plugin.h | 2 + bfd/section.c | 3 + binutils/objcopy.c | 32 +- binutils/readelf.c | 1 + gas/config/tc-h8300.c | 6 +- gas/testsuite/gas/elf/section9.d | 1 + gas/testsuite/gas/elf/section9.s | 2 + include/elf/common.h | 1 + ld/emultempl/aarch64elf.em | 2 +- ld/emultempl/alphaelf.em | 2 +- ld/emultempl/armelf.em | 2 +- ld/emultempl/avrelf.em | 2 +- ld/emultempl/elf.em | 1 + ld/emultempl/ppc32elf.em | 2 +- ld/emultempl/ppc64elf.em | 2 +- ld/emultempl/spuelf.em | 2 +- ld/ld.h | 6 + ld/ldelf.c | 26 +- ld/ldelf.h | 1 + ld/ldexp.c | 16 +- ld/ldexp.h | 4 +- ld/ldfile.c | 2 + ld/ldlang.c | 1027 ++++++++++++++++++++++++++++- ld/ldlang.h | 44 +- ld/ldmain.c | 80 ++- ld/ldmain.h | 2 + ld/plugin.c | 3 + ld/scripttempl/elf.sc | 2 +- ld/scripttempl/elf64hppa.sc | 2 +- ld/scripttempl/elfxtensa.sc | 2 +- ld/scripttempl/mep.sc | 2 +- ld/scripttempl/pe.sc | 1 + ld/scripttempl/pep.sc | 1 + ld/testsuite/ld-plugin/lto-10.out | 1 + ld/testsuite/ld-plugin/lto-10a.c | 6 + ld/testsuite/ld-plugin/lto-10b.c | 7 + ld/testsuite/ld-plugin/lto-10r.d | 9 + ld/testsuite/ld-plugin/lto-4.out | 2 + ld/testsuite/ld-plugin/lto-4a.c | 7 + ld/testsuite/ld-plugin/lto-4b.c | 9 + ld/testsuite/ld-plugin/lto-4c.c | 6 + ld/testsuite/ld-plugin/lto-4r-a.d | 7 + ld/testsuite/ld-plugin/lto-4r-b.d | 7 + ld/testsuite/ld-plugin/lto-4r-c.d | 7 + ld/testsuite/ld-plugin/lto-4r-d.d | 7 + ld/testsuite/ld-plugin/lto.exp | 66 ++ 52 files changed, 1658 insertions(+), 128 deletions(-) create mode 100644 ld/testsuite/ld-plugin/lto-10.out create mode 100644 ld/testsuite/ld-plugin/lto-10a.c create mode 100644 ld/testsuite/ld-plugin/lto-10b.c create mode 100644 ld/testsuite/ld-plugin/lto-10r.d create mode 100644 ld/testsuite/ld-plugin/lto-4.out create mode 100644 ld/testsuite/ld-plugin/lto-4a.c create mode 100644 ld/testsuite/ld-plugin/lto-4b.c create mode 100644 ld/testsuite/ld-plugin/lto-4c.c create mode 100644 ld/testsuite/ld-plugin/lto-4r-a.d create mode 100644 ld/testsuite/ld-plugin/lto-4r-b.d create mode 100644 ld/testsuite/ld-plugin/lto-4r-c.d create mode 100644 ld/testsuite/ld-plugin/lto-4r-d.d
Comments
I haven't yet reviewed this patch and it's going to be a while before I can, so if someone else can review that would be good. The following tweak is needed to compile using gcc-4.9. diff --git a/bfd/format.c b/bfd/format.c index 949fbd72000..8655c7f639e 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -360,7 +360,7 @@ bfd_set_lto_type (bfd *abfd ATTRIBUTE_UNUSED) { asection *sec; enum bfd_lto_object_type type = lto_non_ir_object; - struct lto_section lsection = { 0 }; + struct lto_section lsection = { 0, 0, 0, 0 }; /* GCC uses .gnu.lto_.lto.<some_hash> as a LTO bytecode information section. */ for (sec = abfd->sections; sec != NULL; sec = sec->next)
On Mon, Sep 9, 2024 at 5:25 PM Alan Modra <amodra@gmail.com> wrote: > > I haven't yet reviewed this patch and it's going to be a while before > I can, so if someone else can review that would be good. > > The following tweak is needed to compile using gcc-4.9. > > diff --git a/bfd/format.c b/bfd/format.c > index 949fbd72000..8655c7f639e 100644 > --- a/bfd/format.c > +++ b/bfd/format.c > @@ -360,7 +360,7 @@ bfd_set_lto_type (bfd *abfd ATTRIBUTE_UNUSED) > { > asection *sec; > enum bfd_lto_object_type type = lto_non_ir_object; > - struct lto_section lsection = { 0 }; > + struct lto_section lsection = { 0, 0, 0, 0 }; > /* GCC uses .gnu.lto_.lto.<some_hash> as a LTO bytecode information > section. */ > for (sec = abfd->sections; sec != NULL; sec = sec->next) > > -- > Alan Modra I included it in my local branch. Thanks.