daily update
[deliverable/binutils-gdb.git] / bfd / linker.c
index 426d545e32ce4e9e1a8ac1aa792490b11e8f86c2..9e6199b835a5b40b682e751126f7a6fa0517b982 100644 (file)
@@ -2364,12 +2364,9 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
 
       /* If this symbol is in a section which is not being included
         in the output file, then we don't want to output the
-        symbol.  .bss and similar sections won't have the linker_mark
-        field set.  We also check if its output section has been
-        removed from the output file.  */
-      if (((sym->section->flags & SEC_HAS_CONTENTS) != 0
-          && ! sym->section->linker_mark)
-         || bfd_section_removed_from_list (output_bfd,
+        symbol.  */
+      if (!bfd_is_abs_section (sym->section)
+         && bfd_section_removed_from_list (output_bfd,
                                            sym->section->output_section))
        output = FALSE;
 
@@ -3071,3 +3068,36 @@ _bfd_generic_section_already_linked (bfd *abfd, asection *sec)
   /* This is the first section with this name.  Record it.  */
   bfd_section_already_linked_table_insert (already_linked_list, sec);
 }
+
+/* Convert symbols in excluded output sections to absolute.  */
+
+static bfd_boolean
+fix_syms (struct bfd_link_hash_entry *h, void *data)
+{
+  bfd *obfd = (bfd *) data;
+
+  if (h->type == bfd_link_hash_warning)
+    h = h->u.i.link;
+
+  if (h->type == bfd_link_hash_defined
+      || h->type == bfd_link_hash_defweak)
+    {
+      asection *s = h->u.def.section;
+      if (s != NULL
+         && s->output_section != NULL
+         && (s->output_section->flags & SEC_EXCLUDE) != 0
+         && bfd_section_removed_from_list (obfd, s->output_section))
+       {
+         h->u.def.value += s->output_offset + s->output_section->vma;
+         h->u.def.section = bfd_abs_section_ptr;
+       }
+    }
+
+  return TRUE;
+}
+
+void
+_bfd_fix_excluded_sec_syms (bfd *obfd, struct bfd_link_info *info)
+{
+  bfd_link_hash_traverse (info->hash, fix_syms, obfd);
+}
This page took 0.02345 seconds and 4 git commands to generate.