// necessarily evaluate the expression until all ordinary symbols have
// been finalized.
+// The GNU linker lets symbol assignments in the linker script
+// silently override defined symbols in object files. We are
+// compatible. FIXME: Should we issue a warning?
+
void
Symbol_assignment::add_to_table(Symbol_table* symtab)
{
elfcpp::STB_GLOBAL,
vis,
0, // nonvis
- this->provide_);
+ this->provide_,
+ true); // force_override
}
// Finalize a symbol value.
elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
- bool only_if_ref)
+ bool only_if_ref,
+ bool force_override)
{
if (parameters->get_size() == 32)
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
return this->do_define_as_constant<32>(name, version, value,
symsize, type, binding,
- visibility, nonvis, only_if_ref);
+ visibility, nonvis, only_if_ref,
+ force_override);
#else
gold_unreachable();
#endif
#if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
return this->do_define_as_constant<64>(name, version, value,
symsize, type, binding,
- visibility, nonvis, only_if_ref);
+ visibility, nonvis, only_if_ref,
+ force_override);
#else
gold_unreachable();
#endif
elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
- bool only_if_ref)
+ bool only_if_ref,
+ bool force_override)
{
Sized_symbol<size>* sym;
Sized_symbol<size>* oldsym;
return sym;
}
- if (Symbol_table::should_override_with_special(oldsym))
+ if (force_override || Symbol_table::should_override_with_special(oldsym))
this->override_with_special(oldsym, sym);
delete sym;
return oldsym;
else
this->define_as_constant(p->name, NULL, 0, p->size, p->type,
p->binding, p->visibility, p->nonvis,
- only_if_ref || p->only_if_ref);
+ only_if_ref || p->only_if_ref,
+ false);
}
}
else
this->define_as_constant(p->name, NULL, 0, p->size, p->type,
p->binding, p->visibility, p->nonvis,
- only_if_ref || p->only_if_ref);
+ only_if_ref || p->only_if_ref,
+ false);
}
}
define_as_constant(const char* name, const char* version,
uint64_t value, uint64_t symsize, elfcpp::STT type,
elfcpp::STB binding, elfcpp::STV visibility,
- unsigned char nonvis, bool only_if_ref);
+ unsigned char nonvis, bool only_if_ref,
+ bool force_override);
// Define a set of symbols in output sections. If ONLY_IF_REF is
// true, only define them if they are referenced.
typename elfcpp::Elf_types<size>::Elf_WXword ssize,
elfcpp::STT type, elfcpp::STB binding,
elfcpp::STV visibility, unsigned char nonvis,
- bool only_if_ref);
+ bool only_if_ref, bool force_override);
// Allocate the common symbols, sized version.
template<int size>