summaryrefslogtreecommitdiff
path: root/binutils/patches/pr14493-ignore-without-bfd.patch
blob: 926700639f71ada7da336983f96990ba52aa41d6 (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
Description: ignore section symbols without a BFD section.
Bug: http://sourceware.org/bugzilla/show_bug.cgi?id=14493
Index: binutils/bfd/elf.c
===================================================================
--- binutils.orig/bfd/elf.c	2012-10-28 16:32:57.498420933 +0400
+++ binutils/bfd/elf.c	2012-10-28 18:07:43.088367811 +0400
@@ -3242,15 +3242,24 @@
 }
 
 /* Don't output section symbols for sections that are not going to be
-   output.  */
+   output, that are duplicates or there is no BFD section.  */
 
 static bfd_boolean
 ignore_section_sym (bfd *abfd, asymbol *sym)
 {
-  return ((sym->flags & BSF_SECTION_SYM) != 0
-	  && !(sym->section->owner == abfd
-	       || (sym->section->output_section->owner == abfd
-		   && sym->section->output_offset == 0)));
+  elf_symbol_type *type_ptr;
+
+  if ((sym->flags & BSF_SECTION_SYM) == 0)
+    return FALSE;
+
+  type_ptr = elf_symbol_from (abfd, sym);
+  return ((type_ptr != NULL
+       && type_ptr->internal_elf_sym.st_shndx != 0
+       && bfd_is_abs_section (sym->section))
+      || !(sym->section->owner == abfd
+           || (sym->section->output_section->owner == abfd
+           && sym->section->output_offset == 0)
+           || bfd_is_abs_section (sym->section)));
 }
 
 static bfd_boolean