From nobody Tue Apr 25 14:15:58 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q5PDZ5sFyz47Fc1; Tue, 25 Apr 2023 14:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q5PDZ5R6yz3HlJ; Tue, 25 Apr 2023 14:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682432158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kAHypKb6hzzQaGSSrBe0W/xsPYa3Rr60yTXQMh5Y/CU=; b=u26H998yXhngydf9YofhpMNP+ZmTZVclufw6L+SyL7pQ7torjqkEkz8QjWiIaXjAGiro9g m31LvtRYb0KPLBmpzHiAWIDiBFfWPD6LuyR6wgETLg56PmP2OrvMtOBUip/KgyXm2allnf 8EmhEJrXL1K1IA6K2P4j8w7/owflAL4gZqK4P+uYoP0kKC6Lqp8bdZApdmfjceFF2V1IwD fhDJrIcHSJ2Pw6hWm8DJSAfQiOcq4u8AGqQ3y4KreR21LJM5R0VQmZQ2qQk58vtVjjO5b0 7AtXftE4I1viMa07gkeaqHVmYNKDZXuRWTXtk3ugPutNU74s+0AMW8aPzu8CDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682432158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kAHypKb6hzzQaGSSrBe0W/xsPYa3Rr60yTXQMh5Y/CU=; b=Jw+4y6djpEyybz05w8Q3ckMxjPszqIO3x5kyoZi7nrQv0WvjRE1A2ZGI5RuEzI8xvWTNdv nIkv42oTU38Q4plf6EwfO+ENjmqoMPDA55vShTygvpuR6LwVw/dQd+3nJ8zm15Rlnf33gj SZ06s9qTBPdr9RUFoIE6JRgEvDiWdB5ao4xP8OC80BFRRcvz+8jSLUUiKpkwzRSAHRlCOT 5oZbLvkZFJaK6YSkVlTRtTNVY/HWxs56JPDVO3jz1JXKEGdYQb1qgR5SzM6LwLlAa+GR9B 9bvUoZVfctaAijtdqGUdaLRA5yEe8lUwsLheqOR8vviuFCYlTf0dZHVFQ2V7Bw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682432158; a=rsa-sha256; cv=none; b=PI7FBgtMNZ2U0Kzk2EhWbcX9QF8jtO0RR+CHA/GqjOeqSWyqWJYGArl5sA9WZd3pbL60y/ QGs5blaHT7qy5fLCoAZfmLtPMc6S0jAf1nI7txGTxxucLdCETl6CRzuGJGR9ubxIXZxFgK N8TPyrS6Mq1ojlnWDd/WkFQun/jmpcjzVWA/OCQa6qPzV2ZGpczz1JyrkvmUe9YKKPIodO K4H9dAADI2RglWBEmsvdFTlGe/5NYwPFhNMACHAoKKdrhE/XQtB0S5e01ink5KWgsCfigU SJrkZpYgKOnOytueaSx21A/mcNhcc3tKXOFdJvFYtXg7sbrH4WA4uMbHP3LIlw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Q5PDZ4TnHz19BQ; Tue, 25 Apr 2023 14:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33PEFw7e010507; Tue, 25 Apr 2023 14:15:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33PEFwS4010506; Tue, 25 Apr 2023 14:15:58 GMT (envelope-from git) Date: Tue, 25 Apr 2023 14:15:58 GMT Message-Id: <202304251415.33PEFwS4010506@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Cy Schubert Subject: git: 898053f91002 - main - devel/binutils: Setting sh_link for SHT_REL/SHT_RELA List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 898053f9100240f305a2bc6d49998a13728d3a71 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/ports/commit/?id=898053f9100240f305a2bc6d49998a13728d3a71 commit 898053f9100240f305a2bc6d49998a13728d3a71 Author: Emanuel Haupt AuthorDate: 2023-04-25 14:05:48 +0000 Commit: Cy Schubert CommitDate: 2023-04-25 14:15:25 +0000 devel/binutils: Setting sh_link for SHT_REL/SHT_RELA Import upstream commit 6b958fe36b7: It's wrong to have an alloc reloc section trying to use a non-alloc symbol table. * elf.c (assign_section_numbers ): Correct comment. Always set sh_link to .dynsym for alloc reloc sections and to .symtab for non-alloc. This also fixes strip when using llvm-strip, i.e. when base built with WITH_LLVM_BINUTILS. PR: 271061, see also: 270961, 270960 Reported by: Emanuel Haupt Approved by: cy Obtained from: Upstream commit 6b958fe36b7 MFH: 2022Q2 --- devel/binutils/Makefile | 2 +- devel/binutils/files/patch-bfd_elf.c | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/devel/binutils/Makefile b/devel/binutils/Makefile index a468d736263d..f33baaa17357 100644 --- a/devel/binutils/Makefile +++ b/devel/binutils/Makefile @@ -1,6 +1,6 @@ PORTNAME= binutils DISTVERSION= 2.40 -PORTREVISION= 2 +PORTREVISION= 3 PORTEPOCH?= 1 CATEGORIES?= devel MASTER_SITES= SOURCEWARE/binutils/releases diff --git a/devel/binutils/files/patch-bfd_elf.c b/devel/binutils/files/patch-bfd_elf.c new file mode 100644 index 000000000000..7f27ebb80a10 --- /dev/null +++ b/devel/binutils/files/patch-bfd_elf.c @@ -0,0 +1,39 @@ +--- bfd/elf.c.orig 2023-01-14 00:00:00 UTC ++++ bfd/elf.c +@@ -3870,21 +3870,23 @@ assign_section_numbers (bfd *abfd, struct bfd_link_inf + { + case SHT_REL: + case SHT_RELA: +- /* A reloc section which we are treating as a normal BFD +- section. sh_link is the section index of the symbol +- table. sh_info is the section index of the section to +- which the relocation entries apply. We assume that an +- allocated reloc section uses the dynamic symbol table +- if there is one. Otherwise we guess the normal symbol +- table. FIXME: How can we be sure? */ +- if (d->this_hdr.sh_link == 0 && (sec->flags & SEC_ALLOC) != 0) ++ /* sh_link is the section index of the symbol table. ++ sh_info is the section index of the section to which the ++ relocation entries apply. */ ++ if (d->this_hdr.sh_link == 0) + { +- s = bfd_get_section_by_name (abfd, ".dynsym"); +- if (s != NULL) +- d->this_hdr.sh_link = elf_section_data (s)->this_idx; ++ /* FIXME maybe: If this is a reloc section which we are ++ treating as a normal section then we likely should ++ not be assuming its sh_link is .dynsym or .symtab. */ ++ if ((sec->flags & SEC_ALLOC) != 0) ++ { ++ s = bfd_get_section_by_name (abfd, ".dynsym"); ++ if (s != NULL) ++ d->this_hdr.sh_link = elf_section_data (s)->this_idx; ++ } ++ else ++ d->this_hdr.sh_link = elf_onesymtab (abfd); + } +- if (d->this_hdr.sh_link == 0) +- d->this_hdr.sh_link = elf_onesymtab (abfd); + + s = elf_get_reloc_section (sec); + if (s != NULL)