hc
2023-11-20 2e7bd41e4e8ab3d1efdabd9e263a2f7fe79bff8c
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
From 278989f23735aa501be1052e085540c75c126dbb Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Thu, 28 Mar 2019 17:03:57 -0700
Subject: [PATCH] bfd: xtensa: fix shrink_dynamic_reloc_sections for
 export-dynamic
 
shrink_dynamic_reloc_sections must remove PLT entry that was created for
an undefined weak symbol in the presence of --export-dynamic option when
relaxation coalesces literals pointing to that symbol. This fixes the
following assertion:
 
  ld: BFD (GNU Binutils) 2.31.1 internal error, aborting at
  elf32-xtensa.c:3292 in elf_xtensa_finish_dynamic_sections
 
2019-03-28  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
   * elf32-xtensa.c (shrink_dynamic_reloc_sections): Add
   info->export_dynamic to the conditional.
 
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 bfd/elf32-xtensa.c                                         |  3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
 
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index c3df3d6db756..37ea200eea74 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -10083,7 +10083,8 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
       && (input_section->flags & SEC_ALLOC) != 0
       && (dynamic_symbol || bfd_link_pic (info))
       && (!h || h->root.type != bfd_link_hash_undefweak
-      || (dynamic_symbol && bfd_link_dll (info))))
+      || (dynamic_symbol
+          && (bfd_link_dll (info) || info->export_dynamic))))
     {
       asection *srel;
       bfd_boolean is_plt = FALSE;
-- 
2.11.0