diff options
author | Ian Lance Taylor <iant@google.com> | 2007-12-07 19:32:59 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-12-07 19:32:59 +0000 |
commit | e8c846c359fda086b5e550fc795cc1c05b6ee003 (patch) | |
tree | a7efff24a88e4874d11de980263ed408bd5d7a97 /gold/x86_64.cc | |
parent | c68cf8ad105b1605718ea48e5f0f118b35be5654 (diff) | |
download | gdb-e8c846c359fda086b5e550fc795cc1c05b6ee003.zip gdb-e8c846c359fda086b5e550fc795cc1c05b6ee003.tar.gz gdb-e8c846c359fda086b5e550fc795cc1c05b6ee003.tar.bz2 |
From Cary Coutant: Fix handling of RELATIVE RELA relocs.
Diffstat (limited to 'gold/x86_64.cc')
-rw-r--r-- | gold/x86_64.cc | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/gold/x86_64.cc b/gold/x86_64.cc index cb68730..bdc28d4 100644 --- a/gold/x86_64.cc +++ b/gold/x86_64.cc @@ -765,10 +765,13 @@ Target_x86_64::Scan::local(const General_options&, // relocate it easily. if (parameters->output_is_position_independent()) { + unsigned int r_sym = elfcpp::elf_r_sym<64>(reloc.get_r_info()); Reloc_section* rela_dyn = target->rela_dyn_section(layout); - rela_dyn->add_local(object, 0, elfcpp::R_X86_64_RELATIVE, - output_section, data_shndx, - reloc.get_r_offset(), 0); + rela_dyn->add_local_relative(object, r_sym, + elfcpp::R_X86_64_RELATIVE, + output_section, data_shndx, + reloc.get_r_offset(), + reloc.get_r_addend()); } break; @@ -831,8 +834,10 @@ Target_x86_64::Scan::local(const General_options&, Reloc_section* rela_dyn = target->rela_dyn_section(layout); // R_X86_64_RELATIVE assumes a 64-bit relocation. if (r_type != elfcpp::R_X86_64_GOT32) - rela_dyn->add_local(object, 0, elfcpp::R_X86_64_RELATIVE, - got, object->local_got_offset(r_sym), 0); + rela_dyn->add_local_relative(object, r_sym, + elfcpp::R_X86_64_RELATIVE, got, + object->local_got_offset(r_sym), + 0); else rela_dyn->add_local(object, r_sym, r_type, got, object->local_got_offset(r_sym), 0); @@ -1012,9 +1017,10 @@ Target_x86_64::Scan::global(const General_options& options, && gsym->can_use_relative_reloc(false)) { Reloc_section* rela_dyn = target->rela_dyn_section(layout); - rela_dyn->add_local(object, 0, elfcpp::R_X86_64_RELATIVE, - output_section, data_shndx, - reloc.get_r_offset(), 0); + rela_dyn->add_global_relative(gsym, elfcpp::R_X86_64_RELATIVE, + output_section, object, + data_shndx, reloc.get_r_offset(), + reloc.get_r_addend()); } else { @@ -1076,12 +1082,9 @@ Target_x86_64::Scan::global(const General_options& options, else { if (got->add_global(gsym)) - { - rela_dyn->add_local(object, 0, elfcpp::R_X86_64_RELATIVE, - got, gsym->got_offset(), 0); - // Make sure we write the link-time value to the GOT. - gsym->set_needs_value_in_got(); - } + rela_dyn->add_global_relative(gsym, + elfcpp::R_X86_64_RELATIVE, + got, gsym->got_offset(), 0); } } // For GOTPLT64, we also need a PLT entry (but only if the |