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
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.
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(-)
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(-)