-static boolean
-simple_dummy_reloc_dangerous (link_info, message, abfd, section, address)
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
- const char *message ATTRIBUTE_UNUSED;
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- bfd_vma address ATTRIBUTE_UNUSED;
+struct saved_output_info
+{
+ bfd_vma offset;
+ asection *section;
+};
+
+struct saved_offsets
+{
+ unsigned int section_count;
+ struct saved_output_info *sections;
+};
+
+/* The sections in ABFD may already have output sections and offsets
+ set if we are here during linking.
+
+ DWARF-2 specifies offsets into debug sections in many cases and
+ bfd_simple_get_relocated_section_contents is called to relocate
+ debug info for a single relocatable object file. So we want
+ offsets relative to that object file's sections, not offsets in the
+ output file. For that reason, reset a debug section->output_offset
+ to zero.
+
+ If not called during linking then set section->output_section to
+ point back to the input section, because output_section must not be
+ NULL when calling the relocation routines.
+
+ Save the original output offset and section to restore later. */
+
+static void
+simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section,
+ void *ptr)