Generate a GLOB_DAT reloc for a GOT32 reloc against a symbol defined

in a dynamic object.
This commit is contained in:
Ian Lance Taylor 2007-09-12 16:38:04 +00:00
parent 40b5398770
commit 8462ae85e4
1 changed files with 19 additions and 14 deletions

View File

@ -834,13 +834,21 @@ Target_i386::Scan::global(const General_options& options,
break;
case elfcpp::R_386_GOT32:
{
// The symbol requires a GOT entry.
if (target->got_section(&options, symtab, layout)->add_global(gsym))
Output_data_got<32, false>* got = target->got_section(&options, symtab,
layout);
if (got->add_global(gsym))
{
// If this symbol is not fully resolved, we need to add a
// dynamic relocation for it.
if (!gsym->final_value_is_known(&options))
gold_unreachable();
{
Reloc_section* rel_dyn = target->rel_dyn_section(layout);
rel_dyn->add_global(gsym, elfcpp::R_386_GLOB_DAT, got,
gsym->got_offset());
}
}
}
break;
@ -1051,11 +1059,8 @@ Target_i386::Relocate::relocate(const Relocate_info<32, false>* relinfo,
// Pick the value to use for symbols defined in shared objects.
Symbol_value<32> symval;
if (gsym != NULL && gsym->is_from_dynobj())
if (gsym != NULL && gsym->is_from_dynobj() && gsym->has_plt_offset())
{
if (!gsym->has_plt_offset())
gold_unreachable();
symval.set_output_value(target->plt_section()->address()
+ gsym->plt_offset());
psymval = &symval;