View | Details | Raw Unified | Return to bug 271061
Collapse All | Expand All

(-)b/devel/binutils/Makefile (-1 / +1 lines)
Lines 1-6 Link Here
1
PORTNAME=	binutils
1
PORTNAME=	binutils
2
DISTVERSION=	2.40
2
DISTVERSION=	2.40
3
PORTREVISION=	2
3
PORTREVISION=	3
4
PORTEPOCH?=	1
4
PORTEPOCH?=	1
5
CATEGORIES?=	devel
5
CATEGORIES?=	devel
6
MASTER_SITES=	SOURCEWARE/binutils/releases
6
MASTER_SITES=	SOURCEWARE/binutils/releases
(-)b/devel/binutils/files/patch-bfd_elf.c (+39 lines)
Added Link Here
1
--- bfd/elf.c.orig	2023-01-14 00:00:00 UTC
2
+++ bfd/elf.c
3
@@ -3870,21 +3870,23 @@ assign_section_numbers (bfd *abfd, struct bfd_link_inf
4
 	{
5
 	case SHT_REL:
6
 	case SHT_RELA:
7
-	  /* A reloc section which we are treating as a normal BFD
8
-	     section.  sh_link is the section index of the symbol
9
-	     table.  sh_info is the section index of the section to
10
-	     which the relocation entries apply.  We assume that an
11
-	     allocated reloc section uses the dynamic symbol table
12
-	     if there is one.  Otherwise we guess the normal symbol
13
-	     table.  FIXME: How can we be sure?  */
14
-	  if (d->this_hdr.sh_link == 0 && (sec->flags & SEC_ALLOC) != 0)
15
+	  /* sh_link is the section index of the symbol table.
16
+	     sh_info is the section index of the section to which the
17
+	     relocation entries apply.  */
18
+	  if (d->this_hdr.sh_link == 0)
19
 	    {
20
-	      s = bfd_get_section_by_name (abfd, ".dynsym");
21
-	      if (s != NULL)
22
-		d->this_hdr.sh_link = elf_section_data (s)->this_idx;
23
+	      /* FIXME maybe: If this is a reloc section which we are
24
+		 treating as a normal section then we likely should
25
+		 not be assuming its sh_link is .dynsym or .symtab.  */
26
+	      if ((sec->flags & SEC_ALLOC) != 0)
27
+		{
28
+		  s = bfd_get_section_by_name (abfd, ".dynsym");
29
+		  if (s != NULL)
30
+		    d->this_hdr.sh_link = elf_section_data (s)->this_idx;
31
+		}
32
+	      else
33
+		d->this_hdr.sh_link = elf_onesymtab (abfd);
34
 	    }
35
-	  if (d->this_hdr.sh_link == 0)
36
-	    d->this_hdr.sh_link = elf_onesymtab (abfd);
37
 
38
 	  s = elf_get_reloc_section (sec);
39
 	  if (s != NULL)

Return to bug 271061