Don't pass around the target in order to define symbols; get it from
the parameters instead.
This commit is contained in:
parent
8f0a6da7a9
commit
9b07f471e3
|
@ -249,11 +249,10 @@ namespace gold
|
|||
{
|
||||
|
||||
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.
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace gold
|
|||
{
|
||||
|
||||
extern void
|
||||
define_standard_symbols(Symbol_table*, const Layout*, Target*);
|
||||
define_standard_symbols(Symbol_table*, const Layout*);
|
||||
|
||||
} // End namespace gold.
|
||||
|
||||
|
|
|
@ -1415,8 +1415,8 @@ Versions::add_need(Stringpool* dynpool, const char* filename, const char* name,
|
|||
// 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_);
|
||||
|
||||
|
@ -1432,7 +1432,7 @@ Versions::finalize(const Target* target, Symbol_table* symtab,
|
|||
// 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,
|
||||
|
|
|
@ -474,7 +474,7 @@ class Versions
|
|||
// 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.
|
||||
|
|
|
@ -196,18 +196,18 @@ queue_middle_tasks(const General_options& options,
|
|||
|
||||
// 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
|
||||
|
|
|
@ -358,7 +358,7 @@ Target_i386::got_section(Symbol_table* symtab, Layout* layout)
|
|||
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,
|
||||
|
@ -735,7 +735,7 @@ Target_i386::copy_reloc(const General_options* options,
|
|||
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);
|
||||
|
|
|
@ -528,8 +528,7 @@ Layout::layout_gnu_stack(bool seen_gnu_stack, uint64_t gnu_stack_flags)
|
|||
// 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;
|
||||
|
@ -540,8 +539,7 @@ Layout::create_initial_dynamic_sections(const Input_objects* input_objects,
|
|||
(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);
|
||||
|
||||
|
@ -555,7 +553,7 @@ Layout::create_initial_dynamic_sections(const Input_objects* input_objects,
|
|||
// 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();
|
||||
|
@ -573,8 +571,7 @@ Layout::define_section_symbols(Symbol_table* symtab, const Target* target)
|
|||
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
|
||||
|
@ -586,8 +583,7 @@ Layout::define_section_symbols(Symbol_table* symtab, const Target* target)
|
|||
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
|
||||
|
@ -684,7 +680,7 @@ Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab,
|
|||
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);
|
||||
|
||||
|
@ -1373,7 +1369,7 @@ Layout::create_shdrs(off_t* poff)
|
|||
|
||||
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,
|
||||
|
@ -1414,7 +1410,7 @@ Layout::create_dynamic_symtab(const Input_objects* input_objects,
|
|||
|
||||
// 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;
|
||||
|
|
|
@ -137,16 +137,16 @@ class Layout
|
|||
|
||||
// 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*
|
||||
|
@ -319,8 +319,8 @@ class Layout
|
|||
|
||||
// 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);
|
||||
|
|
|
@ -894,11 +894,10 @@ class Script_unblock : public Task
|
|||
// 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
|
||||
|
@ -1036,13 +1035,12 @@ Script_options::add_assertion(Expression* check, const char* message,
|
|||
// 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.
|
||||
|
|
|
@ -46,7 +46,6 @@ class Input_argument;
|
|||
class Input_objects;
|
||||
class Input_group;
|
||||
class Input_file;
|
||||
class Target;
|
||||
class Task_token;
|
||||
class Workqueue;
|
||||
struct Version_dependency_list;
|
||||
|
@ -179,7 +178,7 @@ class Symbol_assignment
|
|||
|
||||
// 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*);
|
||||
|
@ -273,7 +272,7 @@ class Script_options
|
|||
|
||||
// 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
|
||||
|
|
|
@ -939,8 +939,8 @@ Symbol_table::record_weak_aliases(std::vector<Sized_symbol<size>*>* symbols)
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -999,6 +999,7 @@ Symbol_table::define_special_symbol(const Target* target, const char** pname,
|
|||
}
|
||||
}
|
||||
|
||||
const Target* target = parameters->target();
|
||||
if (!target->has_make_symbol())
|
||||
sym = new Sized_symbol<size>();
|
||||
else
|
||||
|
@ -1027,10 +1028,13 @@ Symbol_table::define_special_symbol(const Target* target, const char** pname,
|
|||
// 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,
|
||||
|
@ -1039,7 +1043,7 @@ Symbol_table::define_in_output_data(const Target* target, const char* name,
|
|||
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,
|
||||
|
@ -1051,7 +1055,7 @@ Symbol_table::define_in_output_data(const Target* target, const char* name,
|
|||
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,
|
||||
|
@ -1069,7 +1073,6 @@ Symbol_table::define_in_output_data(const Target* target, const char* name,
|
|||
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,
|
||||
|
@ -1089,7 +1092,7 @@ Symbol_table::do_define_in_output_data(
|
|||
{
|
||||
#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();
|
||||
|
@ -1099,7 +1102,7 @@ Symbol_table::do_define_in_output_data(
|
|||
{
|
||||
#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();
|
||||
|
@ -1130,10 +1133,12 @@ Symbol_table::do_define_in_output_data(
|
|||
// 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,
|
||||
|
@ -1142,7 +1147,7 @@ Symbol_table::define_in_output_segment(const Target* target, const char* name,
|
|||
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);
|
||||
|
@ -1153,7 +1158,7 @@ Symbol_table::define_in_output_segment(const Target* target, const char* name,
|
|||
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);
|
||||
|
@ -1170,7 +1175,6 @@ Symbol_table::define_in_output_segment(const Target* target, const char* name,
|
|||
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,
|
||||
|
@ -1190,7 +1194,7 @@ Symbol_table::do_define_in_output_segment(
|
|||
{
|
||||
#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();
|
||||
|
@ -1200,7 +1204,7 @@ Symbol_table::do_define_in_output_segment(
|
|||
{
|
||||
#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();
|
||||
|
@ -1232,16 +1236,20 @@ Symbol_table::do_define_in_output_segment(
|
|||
// 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
|
||||
|
@ -1251,7 +1259,7 @@ Symbol_table::define_as_constant(const Target* target, const char* name,
|
|||
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
|
||||
|
@ -1267,7 +1275,6 @@ Symbol_table::define_as_constant(const Target* target, const char* name,
|
|||
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,
|
||||
|
@ -1285,7 +1292,7 @@ Symbol_table::do_define_as_constant(
|
|||
{
|
||||
#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();
|
||||
|
@ -1295,7 +1302,7 @@ Symbol_table::do_define_as_constant(
|
|||
{
|
||||
#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();
|
||||
|
@ -1325,19 +1332,19 @@ Symbol_table::do_define_as_constant(
|
|||
// 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);
|
||||
}
|
||||
|
@ -1346,8 +1353,8 @@ Symbol_table::define_symbols(const Layout* layout, const Target* target,
|
|||
// 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)
|
||||
{
|
||||
|
@ -1355,12 +1362,12 @@ Symbol_table::define_symbols(const Layout* layout, const Target* target,
|
|||
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);
|
||||
}
|
||||
|
@ -1373,7 +1380,6 @@ Symbol_table::define_symbols(const Layout* layout, const Target* target,
|
|||
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)
|
||||
|
@ -1390,7 +1396,7 @@ Symbol_table::define_with_copy_reloc(
|
|||
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(),
|
||||
|
@ -1438,8 +1444,7 @@ Symbol_table::get_copy_source(const Symbol* sym) const
|
|||
// 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)
|
||||
|
@ -1471,7 +1476,7 @@ Symbol_table::set_dynsym_indexes(const Target* target,
|
|||
|
||||
// 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;
|
||||
}
|
||||
|
@ -2280,7 +2285,6 @@ Symbol_table::add_from_dynobj<64, true>(
|
|||
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);
|
||||
|
@ -2290,7 +2294,6 @@ Symbol_table::define_with_copy_reloc<32>(
|
|||
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);
|
||||
|
|
|
@ -52,7 +52,6 @@ class Output_data;
|
|||
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.
|
||||
|
@ -1031,7 +1030,7 @@ class Symbol_table
|
|||
// 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,
|
||||
|
@ -1040,9 +1039,8 @@ class Symbol_table
|
|||
// 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);
|
||||
|
@ -1050,28 +1048,25 @@ class Symbol_table
|
|||
// 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.
|
||||
|
@ -1135,8 +1130,8 @@ class Symbol_table
|
|||
// 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,
|
||||
|
@ -1234,15 +1229,14 @@ class Symbol_table
|
|||
// 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,
|
||||
|
@ -1253,7 +1247,7 @@ class Symbol_table
|
|||
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,
|
||||
|
@ -1264,7 +1258,7 @@ class Symbol_table
|
|||
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,
|
||||
|
|
|
@ -352,7 +352,7 @@ Target_x86_64::got_section(Symbol_table* symtab, Layout* layout)
|
|||
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,
|
||||
|
@ -691,7 +691,7 @@ Target_x86_64::copy_reloc(const General_options* options,
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue