Bug 271061 - devel/binutils: Import upstream patch
Summary: devel/binutils: Import upstream patch
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Cy Schubert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-25 06:59 UTC by Emanuel Haupt
Modified: 2023-05-01 17:42 UTC (History)
2 users (show)

See Also:
cy: maintainer-feedback+
cy: merge-quarterly+


Attachments
Setting sh_link for SHT_REL/SHT_RELA (2.10 KB, patch)
2023-04-25 06:59 UTC, Emanuel Haupt
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuel Haupt freebsd_committer freebsd_triage 2023-04-25 06:59:04 UTC
Created attachment 241731 [details]
Setting sh_link for SHT_REL/SHT_RELA

Import upstream patch to fix strip when using llvm-strip.

See also:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270961
Comment 1 Cy Schubert freebsd_committer freebsd_triage 2023-04-25 14:08:33 UTC
Upstream commit:

commit 6b958fe36b765f70878e8d3d002864967c4bc3a4
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Thu Mar 30 12:10:16 2023 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Thu Mar 30 15:18:02 2023 +1030

    Setting sh_link for SHT_REL/SHT_RELA
    
    It's wrong to have an alloc reloc section trying to use a non-alloc
    symbol table.
    
            * elf.c (assign_section_numbers <SHT_REL, SHT_RELA>): Correct
            comment.  Always set sh_link to .dynsym for alloc reloc
            sections and to .symtab for non-alloc.
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-04-25 14:16:15 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=898053f9100240f305a2bc6d49998a13728d3a71

commit 898053f9100240f305a2bc6d49998a13728d3a71
Author:     Emanuel Haupt <ehaupt@FreeBSD.org>
AuthorDate: 2023-04-25 14:05:48 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
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 <SHT_REL, SHT_RELA>): 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 <ehaupt@FreeBSD.org>
    Approved by:    cy
    Obtained from:  Upstream commit 6b958fe36b7
    MFH:            2022Q2

 devel/binutils/Makefile                    |  2 +-
 devel/binutils/files/patch-bfd_elf.c (new) | 39 ++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-04-25 15:23:25 UTC
A commit in branch 2023Q2 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8098bf5371cf0eac0d3039aedfe2b7d90c4ad1b5

commit 8098bf5371cf0eac0d3039aedfe2b7d90c4ad1b5
Author:     Emanuel Haupt <ehaupt@FreeBSD.org>
AuthorDate: 2023-04-25 14:05:48 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-04-25 15:22:48 +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 <SHT_REL, SHT_RELA>): 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 <ehaupt@FreeBSD.org>
    Approved by:    cy
    Obtained from:  Upstream commit 6b958fe36b7

    (cherry picked from commit 898053f9100240f305a2bc6d49998a13728d3a71)

 devel/binutils/Makefile                    |  2 +-
 devel/binutils/files/patch-bfd_elf.c (new) | 39 ++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)