aboutsummaryrefslogtreecommitdiffstats
path: root/toolchain/binutils/patches/2.28/001-ELF-BFD-Limit-_bfd_elf_link_renumber_dynsyms-call-in.patch
blob: e2587b81e06def4bddff7c56b78764e81bcc0e24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 2424aef3a744bc6ca4099a655065c70a63f0fb49 Mon Sep 17 00:00:00 2001
From: "Maciej W. Rozycki" <macro@imgtec.com>
Date: Wed, 26 Apr 2017 22:18:13 +0100
Subject: ELF/BFD: Limit `_bfd_elf_link_renumber_dynsyms' call in section GC

Consistently call `_bfd_elf_link_renumber_dynsyms' only if linking a
dynamic binary, complementing code in `bfd_elf_size_dynsym_hash_dynstr'
and commit ccabcbe51e85 ("New attempt at fixing MIPS --gc-sections et
al."), <https://sourceware.org/ml/binutils/2005-08/msg00258.html>.

	bfd/
	* elflink.c (elf_gc_sweep): Only call
	`_bfd_elf_link_renumber_dynsyms' if dynamic sections have been
	created.

(backported from commit c46cec3a8cfe02fbe0f6c67ba53abc5369c5c659)
---
 bfd/ChangeLog | 6 ++++++
 bfd/elflink.c | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 85c6a817e5..537ebb5e2c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
+
+	* elflink.c (elf_gc_sweep): Only call
+	`_bfd_elf_link_renumber_dynsyms' if dynamic sections have been
+	created.
+
 2017-03-02  Tristan Gingold  <gingold@adacore.com>
 
 	* version.m4: Bump version to 2.28
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 69b66f2831..75d6543dcc 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12986,7 +12986,8 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
   elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol,
 			  &sweep_info);
 
-  _bfd_elf_link_renumber_dynsyms (abfd, info, &section_sym_count);
+  if (elf_hash_table (info)->dynamic_sections_created)
+    _bfd_elf_link_renumber_dynsyms (abfd, info, &section_sym_count);
   return TRUE;
 }
 
-- 
2.11.0