aboutsummaryrefslogtreecommitdiff
path: root/gold/i386.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-12-07 19:32:59 +0000
committerIan Lance Taylor <iant@google.com>2007-12-07 19:32:59 +0000
commite8c846c359fda086b5e550fc795cc1c05b6ee003 (patch)
treea7efff24a88e4874d11de980263ed408bd5d7a97 /gold/i386.cc
parentc68cf8ad105b1605718ea48e5f0f118b35be5654 (diff)
downloadfsf-binutils-gdb-e8c846c359fda086b5e550fc795cc1c05b6ee003.zip
fsf-binutils-gdb-e8c846c359fda086b5e550fc795cc1c05b6ee003.tar.gz
fsf-binutils-gdb-e8c846c359fda086b5e550fc795cc1c05b6ee003.tar.bz2
From Cary Coutant: Fix handling of RELATIVE RELA relocs.
Diffstat (limited to 'gold/i386.cc')
-rw-r--r--gold/i386.cc43
1 files changed, 24 insertions, 19 deletions
diff --git a/gold/i386.cc b/gold/i386.cc
index 071940b..a03893c 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -811,8 +811,10 @@ Target_i386::Scan::local(const General_options&,
if (parameters->output_is_position_independent())
{
Reloc_section* rel_dyn = target->rel_dyn_section(layout);
- rel_dyn->add_local(object, 0, elfcpp::R_386_RELATIVE, output_section,
- data_shndx, reloc.get_r_offset());
+ unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
+ rel_dyn->add_local_relative(object, r_sym, elfcpp::R_386_RELATIVE,
+ output_section, data_shndx,
+ reloc.get_r_offset());
}
break;
@@ -860,8 +862,11 @@ Target_i386::Scan::local(const General_options&,
if (parameters->output_is_position_independent())
{
Reloc_section* rel_dyn = target->rel_dyn_section(layout);
- rel_dyn->add_local(object, 0, elfcpp::R_386_RELATIVE,
- got, object->local_got_offset(r_sym));
+ unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
+ rel_dyn->add_local_relative(object, r_sym,
+ elfcpp::R_386_RELATIVE,
+ got,
+ object->local_got_offset(r_sym));
}
}
}
@@ -955,9 +960,12 @@ Target_i386::Scan::local(const General_options&,
&& parameters->output_is_shared())
{
Reloc_section* rel_dyn = target->rel_dyn_section(layout);
- rel_dyn->add_local(object, 0, elfcpp::R_386_RELATIVE,
- output_section, data_shndx,
- reloc.get_r_offset());
+ unsigned int r_sym
+ = elfcpp::elf_r_sym<32>(reloc.get_r_info());
+ rel_dyn->add_local_relative(object, r_sym,
+ elfcpp::R_386_RELATIVE,
+ output_section, data_shndx,
+ reloc.get_r_offset());
}
// Create a GOT entry for the tp-relative offset.
Output_data_got<32, false>* got
@@ -1070,9 +1078,9 @@ Target_i386::Scan::global(const General_options& options,
&& gsym->can_use_relative_reloc(false))
{
Reloc_section* rel_dyn = target->rel_dyn_section(layout);
- rel_dyn->add_local(object, 0, elfcpp::R_386_RELATIVE,
- output_section, data_shndx,
- reloc.get_r_offset());
+ rel_dyn->add_global_relative(gsym, elfcpp::R_386_RELATIVE,
+ output_section, object,
+ data_shndx, reloc.get_r_offset());
}
else
{
@@ -1136,12 +1144,8 @@ Target_i386::Scan::global(const General_options& options,
else
{
if (got->add_global(gsym))
- {
- rel_dyn->add_local(object, 0, elfcpp::R_386_RELATIVE,
- got, gsym->got_offset());
- // Make sure we write the link-time value to the GOT.
- gsym->set_needs_value_in_got();
- }
+ rel_dyn->add_global_relative(gsym, elfcpp::R_386_RELATIVE,
+ got, gsym->got_offset());
}
}
}
@@ -1264,9 +1268,10 @@ Target_i386::Scan::global(const General_options& options,
&& parameters->output_is_shared())
{
Reloc_section* rel_dyn = target->rel_dyn_section(layout);
- rel_dyn->add_local(object, 0, elfcpp::R_386_RELATIVE,
- output_section, data_shndx,
- reloc.get_r_offset());
+ rel_dyn->add_global_relative(gsym, elfcpp::R_386_RELATIVE,
+ output_section, object,
+ data_shndx,
+ reloc.get_r_offset());
}
// Create a GOT entry for the tp-relative offset.
Output_data_got<32, false>* got