Robustify mi-simplerun.
[deliverable/binutils-gdb.git] / gold / target-reloc.h
index e1c3cc37b69892120bc26935a820919dadc9d922..15d59bb9019dad431ba79ded5f8b915767ba16b3 100644 (file)
@@ -227,9 +227,8 @@ relocate_section(
            {
              if (comdat_behavior == CB_UNDETERMINED)
                {
-                 const char* name =
-                   object->section_name(relinfo->data_shndx).c_str();
-                 comdat_behavior = get_comdat_behavior(name);
+                 std::string name = object->section_name(relinfo->data_shndx);
+                 comdat_behavior = get_comdat_behavior(name.c_str());
                }
              if (comdat_behavior == CB_PRETEND)
                {
@@ -543,7 +542,11 @@ relocate_for_relocatable(
       // In an executable or dynamic object, generated by
       // --emit-relocs, r_offset is an absolute address.
       if (!parameters->options().relocatable())
-       new_offset += view_address;
+       {
+         new_offset += view_address;
+         if (offset_in_output_section != -1)
+           new_offset -= offset_in_output_section;
+       }
 
       reloc_write.put_r_offset(new_offset);
       reloc_write.put_r_info(elfcpp::elf_r_info<size>(new_symndx, r_type));
This page took 0.024005 seconds and 4 git commands to generate.