the parameters instead.
{
void
-define_standard_symbols(Symbol_table* symtab, const Layout* layout,
- Target* target)
+define_standard_symbols(Symbol_table* symtab, const Layout* layout)
{
- symtab->define_symbols(layout, target, in_section_count, in_section);
- symtab->define_symbols(layout, target, in_segment_count, in_segment);
+ symtab->define_symbols(layout, in_section_count, in_section);
+ symtab->define_symbols(layout, in_segment_count, in_segment);
}
} // End namespace gold.
{
extern void
-define_standard_symbols(Symbol_table*, const Layout*, Target*);
+define_standard_symbols(Symbol_table*, const Layout*);
} // End namespace gold.
// each new version definition.
unsigned int
-Versions::finalize(const Target* target, Symbol_table* symtab,
- unsigned int dynsym_index, std::vector<Symbol*>* syms)
+Versions::finalize(Symbol_table* symtab, unsigned int dynsym_index,
+ std::vector<Symbol*>* syms)
{
gold_assert(!this->is_finalized_);
// Create a version symbol if necessary.
if (!(*p)->is_symbol_created())
{
- Symbol* vsym = symtab->define_as_constant(target, (*p)->name(),
+ Symbol* vsym = symtab->define_as_constant((*p)->name(),
(*p)->name(), 0, 0,
elfcpp::STT_OBJECT,
elfcpp::STB_GLOBAL,
// for the next dynamic symbol. We add new dynamic symbols to SYMS
// and return an updated DYNSYM_INDEX.
unsigned int
- finalize(const Target*, Symbol_table* symtab, unsigned int dynsym_index,
+ finalize(Symbol_table* symtab, unsigned int dynsym_index,
std::vector<Symbol*>* syms);
// Return whether there are any version definitions.
// Define some sections and symbols needed for a dynamic link. This
// handles some cases we want to see before we read the relocs.
- layout->create_initial_dynamic_sections(input_objects, symtab);
+ layout->create_initial_dynamic_sections(symtab);
// Predefine standard symbols. This should be fast, so we don't
// bother to create a task for it.
- define_standard_symbols(symtab, layout, input_objects->target());
+ define_standard_symbols(symtab, layout);
// Define __start and __stop symbols for output sections where
// appropriate.
- layout->define_section_symbols(symtab, input_objects->target());
+ layout->define_section_symbols(symtab);
// Define symbols from any linker scripts.
- layout->define_script_symbols(symtab, input_objects->target());
+ layout->define_script_symbols(symtab);
// Read the relocations of the input files. We do this to find
// which symbols are used by relocations which require a GOT and/or
this->got_plt_->set_current_data_size(3 * 4);
// Define _GLOBAL_OFFSET_TABLE_ at the start of the PLT.
- symtab->define_in_output_data(this, "_GLOBAL_OFFSET_TABLE_", NULL,
+ symtab->define_in_output_data("_GLOBAL_OFFSET_TABLE_", NULL,
this->got_plt_,
0, 0, elfcpp::STT_OBJECT,
elfcpp::STB_LOCAL,
section_size_type offset = dynbss_size;
dynbss->set_current_data_size(dynbss_size + symsize);
- symtab->define_with_copy_reloc(this, ssym, dynbss, offset);
+ symtab->define_with_copy_reloc(ssym, dynbss, offset);
// Add the COPY reloc.
Reloc_section* rel_dyn = this->rel_dyn_section(layout);
// relocs.
void
-Layout::create_initial_dynamic_sections(const Input_objects* input_objects,
- Symbol_table* symtab)
+Layout::create_initial_dynamic_sections(Symbol_table* symtab)
{
if (parameters->doing_static_link())
return;
(elfcpp::SHF_ALLOC
| elfcpp::SHF_WRITE));
- symtab->define_in_output_data(input_objects->target(), "_DYNAMIC", NULL,
- this->dynamic_section_, 0, 0,
+ symtab->define_in_output_data("_DYNAMIC", NULL, this->dynamic_section_, 0, 0,
elfcpp::STT_OBJECT, elfcpp::STB_LOCAL,
elfcpp::STV_HIDDEN, 0, false, false);
// extension.
void
-Layout::define_section_symbols(Symbol_table* symtab, const Target* target)
+Layout::define_section_symbols(Symbol_table* symtab)
{
for (Section_list::const_iterator p = this->section_list_.begin();
p != this->section_list_.end();
const std::string start_name("__start_" + name_string);
const std::string stop_name("__stop_" + name_string);
- symtab->define_in_output_data(target,
- start_name.c_str(),
+ symtab->define_in_output_data(start_name.c_str(),
NULL, // version
*p,
0, // value
false, // offset_is_from_end
false); // only_if_ref
- symtab->define_in_output_data(target,
- stop_name.c_str(),
+ symtab->define_in_output_data(stop_name.c_str(),
NULL, // version
*p,
0, // value
std::vector<Symbol*> dynamic_symbols;
unsigned int local_dynamic_count;
Versions versions(this->options_, &this->dynpool_);
- this->create_dynamic_symtab(input_objects, target, symtab, &dynstr,
+ this->create_dynamic_symtab(input_objects, symtab, &dynstr,
&local_dynamic_count, &dynamic_symbols,
&versions);
void
Layout::create_dynamic_symtab(const Input_objects* input_objects,
- const Target* target, Symbol_table* symtab,
+ Symbol_table* symtab,
Output_section **pdynstr,
unsigned int* plocal_dynamic_count,
std::vector<Symbol*>* pdynamic_symbols,
// FIXME: We have to tell set_dynsym_indexes whether the
// -E/--export-dynamic option was used.
- index = symtab->set_dynsym_indexes(target, index, pdynamic_symbols,
+ index = symtab->set_dynsym_indexes(index, pdynamic_symbols,
&this->dynpool_, pversions);
int symsize;
// Create dynamic sections if necessary.
void
- create_initial_dynamic_sections(const Input_objects*, Symbol_table*);
+ create_initial_dynamic_sections(Symbol_table*);
// Define __start and __stop symbols for output sections.
void
- define_section_symbols(Symbol_table*, const Target*);
+ define_section_symbols(Symbol_table*);
// Define symbols from any linker script.
void
- define_script_symbols(Symbol_table* symtab, const Target* target)
- { this->script_options_->add_symbols_to_table(symtab, target); }
+ define_script_symbols(Symbol_table* symtab)
+ { this->script_options_->add_symbols_to_table(symtab); }
// Return the Stringpool used for symbol names.
const Stringpool*
// Create the dynamic symbol table.
void
- create_dynamic_symtab(const Input_objects*, const Target*,
- Symbol_table*, Output_section** pdynstr,
+ create_dynamic_symtab(const Input_objects*, Symbol_table*,
+ Output_section** pdynstr,
unsigned int* plocal_dynamic_count,
std::vector<Symbol*>* pdynamic_symbols,
Versions* versions);
// been finalized.
void
-Symbol_assignment::add_to_table(Symbol_table* symtab, const Target* target)
+Symbol_assignment::add_to_table(Symbol_table* symtab)
{
elfcpp::STV vis = this->hidden_ ? elfcpp::STV_HIDDEN : elfcpp::STV_DEFAULT;
- this->sym_ = symtab->define_as_constant(target,
- this->name_.c_str(),
+ this->sym_ = symtab->define_as_constant(this->name_.c_str(),
NULL, // version
0, // value
0, // size
// Add any symbols we are defining to the symbol table.
void
-Script_options::add_symbols_to_table(Symbol_table* symtab,
- const Target* target)
+Script_options::add_symbols_to_table(Symbol_table* symtab)
{
for (Symbol_assignments::iterator p = this->symbol_assignments_.begin();
p != this->symbol_assignments_.end();
++p)
- (*p)->add_to_table(symtab, target);
+ (*p)->add_to_table(symtab);
}
// Finalize symbol values.
class Input_objects;
class Input_group;
class Input_file;
-class Target;
class Task_token;
class Workqueue;
struct Version_dependency_list;
// Add the symbol to the symbol table.
void
- add_to_table(Symbol_table*, const Target*);
+ add_to_table(Symbol_table*);
// Finalize the symbol value.
void finalize(Symbol_table*, const Layout*);
// Add all symbol definitions to the symbol table.
void
- add_symbols_to_table(Symbol_table*, const Target*);
+ add_symbols_to_table(Symbol_table*);
// Finalize the symbol values.
void
template<int size, bool big_endian>
Sized_symbol<size>*
-Symbol_table::define_special_symbol(const Target* target, const char** pname,
- const char** pversion, bool only_if_ref,
+Symbol_table::define_special_symbol(const char** pname, const char** pversion,
+ bool only_if_ref,
Sized_symbol<size>** poldsym
ACCEPT_SIZE_ENDIAN)
{
}
}
+ const Target* target = parameters->target();
if (!target->has_make_symbol())
sym = new Sized_symbol<size>();
else
// Define a symbol based on an Output_data.
Symbol*
-Symbol_table::define_in_output_data(const Target* target, const char* name,
- const char* version, Output_data* od,
- uint64_t value, uint64_t symsize,
- elfcpp::STT type, elfcpp::STB binding,
+Symbol_table::define_in_output_data(const char* name,
+ const char* version,
+ Output_data* od,
+ uint64_t value,
+ uint64_t symsize,
+ elfcpp::STT type,
+ elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
bool offset_is_from_end,
if (parameters->get_size() == 32)
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
- return this->do_define_in_output_data<32>(target, name, version, od,
+ return this->do_define_in_output_data<32>(name, version, od,
value, symsize, type, binding,
visibility, nonvis,
offset_is_from_end,
else if (parameters->get_size() == 64)
{
#if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
- return this->do_define_in_output_data<64>(target, name, version, od,
+ return this->do_define_in_output_data<64>(name, version, od,
value, symsize, type, binding,
visibility, nonvis,
offset_is_from_end,
template<int size>
Sized_symbol<size>*
Symbol_table::do_define_in_output_data(
- const Target* target,
const char* name,
const char* version,
Output_data* od,
{
#if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) (
- target, &name, &version, only_if_ref, &oldsym
+ &name, &version, only_if_ref, &oldsym
SELECT_SIZE_ENDIAN(size, true));
#else
gold_unreachable();
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) (
- target, &name, &version, only_if_ref, &oldsym
+ &name, &version, only_if_ref, &oldsym
SELECT_SIZE_ENDIAN(size, false));
#else
gold_unreachable();
// Define a symbol based on an Output_segment.
Symbol*
-Symbol_table::define_in_output_segment(const Target* target, const char* name,
+Symbol_table::define_in_output_segment(const char* name,
const char* version, Output_segment* os,
- uint64_t value, uint64_t symsize,
- elfcpp::STT type, elfcpp::STB binding,
+ uint64_t value,
+ uint64_t symsize,
+ elfcpp::STT type,
+ elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
Symbol::Segment_offset_base offset_base,
if (parameters->get_size() == 32)
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
- return this->do_define_in_output_segment<32>(target, name, version, os,
+ return this->do_define_in_output_segment<32>(name, version, os,
value, symsize, type,
binding, visibility, nonvis,
offset_base, only_if_ref);
else if (parameters->get_size() == 64)
{
#if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
- return this->do_define_in_output_segment<64>(target, name, version, os,
+ return this->do_define_in_output_segment<64>(name, version, os,
value, symsize, type,
binding, visibility, nonvis,
offset_base, only_if_ref);
template<int size>
Sized_symbol<size>*
Symbol_table::do_define_in_output_segment(
- const Target* target,
const char* name,
const char* version,
Output_segment* os,
{
#if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) (
- target, &name, &version, only_if_ref, &oldsym
+ &name, &version, only_if_ref, &oldsym
SELECT_SIZE_ENDIAN(size, true));
#else
gold_unreachable();
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) (
- target, &name, &version, only_if_ref, &oldsym
+ &name, &version, only_if_ref, &oldsym
SELECT_SIZE_ENDIAN(size, false));
#else
gold_unreachable();
// definition error if this symbol is already defined.
Symbol*
-Symbol_table::define_as_constant(const Target* target, 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)
+Symbol_table::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)
{
if (parameters->get_size() == 32)
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
- return this->do_define_as_constant<32>(target, name, version, value,
+ return this->do_define_as_constant<32>(name, version, value,
symsize, type, binding,
visibility, nonvis, only_if_ref);
#else
else if (parameters->get_size() == 64)
{
#if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
- return this->do_define_as_constant<64>(target, name, version, value,
+ return this->do_define_as_constant<64>(name, version, value,
symsize, type, binding,
visibility, nonvis, only_if_ref);
#else
template<int size>
Sized_symbol<size>*
Symbol_table::do_define_as_constant(
- const Target* target,
const char* name,
const char* version,
typename elfcpp::Elf_types<size>::Elf_Addr value,
{
#if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) (
- target, &name, &version, only_if_ref, &oldsym
+ &name, &version, only_if_ref, &oldsym
SELECT_SIZE_ENDIAN(size, true));
#else
gold_unreachable();
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) (
- target, &name, &version, only_if_ref, &oldsym
+ &name, &version, only_if_ref, &oldsym
SELECT_SIZE_ENDIAN(size, false));
#else
gold_unreachable();
// Define a set of symbols in output sections.
void
-Symbol_table::define_symbols(const Layout* layout, const Target* target,
- int count, const Define_symbol_in_section* p)
+Symbol_table::define_symbols(const Layout* layout, int count,
+ const Define_symbol_in_section* p)
{
for (int i = 0; i < count; ++i, ++p)
{
Output_section* os = layout->find_output_section(p->output_section);
if (os != NULL)
- this->define_in_output_data(target, p->name, NULL, os, p->value,
+ this->define_in_output_data(p->name, NULL, os, p->value,
p->size, p->type, p->binding,
p->visibility, p->nonvis,
p->offset_is_from_end, p->only_if_ref);
else
- this->define_as_constant(target, p->name, NULL, 0, p->size, p->type,
+ this->define_as_constant(p->name, NULL, 0, p->size, p->type,
p->binding, p->visibility, p->nonvis,
p->only_if_ref);
}
// Define a set of symbols in output segments.
void
-Symbol_table::define_symbols(const Layout* layout, const Target* target,
- int count, const Define_symbol_in_segment* p)
+Symbol_table::define_symbols(const Layout* layout, int count,
+ const Define_symbol_in_segment* p)
{
for (int i = 0; i < count; ++i, ++p)
{
p->segment_flags_set,
p->segment_flags_clear);
if (os != NULL)
- this->define_in_output_segment(target, p->name, NULL, os, p->value,
+ this->define_in_output_segment(p->name, NULL, os, p->value,
p->size, p->type, p->binding,
p->visibility, p->nonvis,
p->offset_base, p->only_if_ref);
else
- this->define_as_constant(target, p->name, NULL, 0, p->size, p->type,
+ this->define_as_constant(p->name, NULL, 0, p->size, p->type,
p->binding, p->visibility, p->nonvis,
p->only_if_ref);
}
template<int size>
void
Symbol_table::define_with_copy_reloc(
- const Target* target,
Sized_symbol<size>* csym,
Output_data* posd,
typename elfcpp::Elf_types<size>::Elf_Addr value)
if (binding == elfcpp::STB_WEAK)
binding = elfcpp::STB_GLOBAL;
- this->define_in_output_data(target, csym->name(), csym->version(),
+ this->define_in_output_data(csym->name(), csym->version(),
posd, value, csym->symsize(),
csym->type(), binding,
csym->visibility(), csym->nonvis(),
// updated dynamic symbol index.
unsigned int
-Symbol_table::set_dynsym_indexes(const Target* target,
- unsigned int index,
+Symbol_table::set_dynsym_indexes(unsigned int index,
std::vector<Symbol*>* syms,
Stringpool* dynpool,
Versions* versions)
// Finish up the versions. In some cases this may add new dynamic
// symbols.
- index = versions->finalize(target, this, index, syms);
+ index = versions->finalize(this, index, syms);
return index;
}
template
void
Symbol_table::define_with_copy_reloc<32>(
- const Target* target,
Sized_symbol<32>* sym,
Output_data* posd,
elfcpp::Elf_types<32>::Elf_Addr value);
template
void
Symbol_table::define_with_copy_reloc<64>(
- const Target* target,
Sized_symbol<64>* sym,
Output_data* posd,
elfcpp::Elf_types<64>::Elf_Addr value);
class Output_section;
class Output_segment;
class Output_file;
-class Target;
// The base class of an entry in the symbol table. The symbol table
// can have a lot of entries, so we don't want this class to big.
// Define a special symbol based on an Output_data. It is a
// multiple definition error if this symbol is already defined.
Symbol*
- define_in_output_data(const Target*, const char* name, const char* version,
+ define_in_output_data(const char* name, const char* version,
Output_data*, uint64_t value, uint64_t symsize,
elfcpp::STT type, elfcpp::STB binding,
elfcpp::STV visibility, unsigned char nonvis,
// Define a special symbol based on an Output_segment. It is a
// multiple definition error if this symbol is already defined.
Symbol*
- define_in_output_segment(const Target*, const char* name,
- const char* version, Output_segment*,
- uint64_t value, uint64_t symsize,
+ define_in_output_segment(const char* name, const char* version,
+ Output_segment*, uint64_t value, uint64_t symsize,
elfcpp::STT type, elfcpp::STB binding,
elfcpp::STV visibility, unsigned char nonvis,
Symbol::Segment_offset_base, bool only_if_ref);
// Define a special symbol with a constant value. It is a multiple
// definition error if this symbol is already defined.
Symbol*
- define_as_constant(const Target*, const char* name, const char* version,
+ 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);
// Define a set of symbols in output sections.
void
- define_symbols(const Layout*, const Target*, int count,
- const Define_symbol_in_section*);
+ define_symbols(const Layout*, int count, const Define_symbol_in_section*);
// Define a set of symbols in output segments.
void
- define_symbols(const Layout*, const Target*, int count,
- const Define_symbol_in_segment*);
+ define_symbols(const Layout*, int count, const Define_symbol_in_segment*);
// Define SYM using a COPY reloc. POSD is the Output_data where the
// symbol should be defined--typically a .dyn.bss section. VALUE is
// the offset within POSD.
template<int size>
void
- define_with_copy_reloc(const Target*, Sized_symbol<size>* sym,
- Output_data* posd,
+ define_with_copy_reloc(Sized_symbol<size>* sym, Output_data* posd,
typename elfcpp::Elf_types<size>::Elf_Addr);
// Look up a symbol.
// the vector. The names are stored into the Stringpool. This
// returns an updated dynamic symbol index.
unsigned int
- set_dynsym_indexes(const Target*, unsigned int index,
- std::vector<Symbol*>*, Stringpool*, Versions*);
+ set_dynsym_indexes(unsigned int index, std::vector<Symbol*>*,
+ Stringpool*, Versions*);
// Finalize the symbol table after we have set the final addresses
// of all the input sections. This sets the final symbol indexes,
// Define a special symbol.
template<int size, bool big_endian>
Sized_symbol<size>*
- define_special_symbol(const Target* target, const char** pname,
- const char** pversion, bool only_if_ref,
- Sized_symbol<size>** poldsym ACCEPT_SIZE_ENDIAN);
+ define_special_symbol(const char** pname, const char** pversion,
+ bool only_if_ref, Sized_symbol<size>** poldsym
+ ACCEPT_SIZE_ENDIAN);
// Define a symbol in an Output_data, sized version.
template<int size>
Sized_symbol<size>*
- do_define_in_output_data(const Target*, const char* name,
- const char* version, Output_data*,
+ do_define_in_output_data(const char* name, const char* version, Output_data*,
typename elfcpp::Elf_types<size>::Elf_Addr value,
typename elfcpp::Elf_types<size>::Elf_WXword ssize,
elfcpp::STT type, elfcpp::STB binding,
template<int size>
Sized_symbol<size>*
do_define_in_output_segment(
- const Target*, const char* name, const char* version, Output_segment* os,
+ const char* name, const char* version, Output_segment* os,
typename elfcpp::Elf_types<size>::Elf_Addr value,
typename elfcpp::Elf_types<size>::Elf_WXword ssize,
elfcpp::STT type, elfcpp::STB binding,
template<int size>
Sized_symbol<size>*
do_define_as_constant(
- const Target*, const char* name, const char* version,
+ const char* name, const char* version,
typename elfcpp::Elf_types<size>::Elf_Addr value,
typename elfcpp::Elf_types<size>::Elf_WXword ssize,
elfcpp::STT type, elfcpp::STB binding,
this->got_plt_->set_current_data_size(3 * 8);
// Define _GLOBAL_OFFSET_TABLE_ at the start of the PLT.
- symtab->define_in_output_data(this, "_GLOBAL_OFFSET_TABLE_", NULL,
+ symtab->define_in_output_data("_GLOBAL_OFFSET_TABLE_", NULL,
this->got_plt_,
0, 0, elfcpp::STT_OBJECT,
elfcpp::STB_LOCAL,
section_size_type offset = dynbss_size;
dynbss->set_current_data_size(dynbss_size + symsize);
- symtab->define_with_copy_reloc(this, ssym, dynbss, offset);
+ symtab->define_with_copy_reloc(ssym, dynbss, offset);
// Add the COPY reloc.
Reloc_section* rela_dyn = this->rela_dyn_section(layout);