* archive.cc (Library_base::should_include_member): Pull in object
from archive if it defines the entry symbol. * parameters.cc (Parameters::entry): New function. * parameters.h (class Parameters): Declare entry. * output.h (class Output_file_header): Remove entry_ field. * output.cc (Output_file_header::Output_file_header): Remove entry parameter. Change all callers. (Output_file_header::entry): Use parameters->entry. * gold.cc (queue_middle_tasks): Likewise. * plugin.cc (Plugin_hook::run): Likewise.
This commit is contained in:
parent
012ca7c8a8
commit
a10ae76082
@ -1,3 +1,16 @@
|
|||||||
|
2011-05-24 Ian Lance Taylor <iant@google.com>
|
||||||
|
|
||||||
|
* archive.cc (Library_base::should_include_member): Pull in object
|
||||||
|
from archive if it defines the entry symbol.
|
||||||
|
* parameters.cc (Parameters::entry): New function.
|
||||||
|
* parameters.h (class Parameters): Declare entry.
|
||||||
|
* output.h (class Output_file_header): Remove entry_ field.
|
||||||
|
* output.cc (Output_file_header::Output_file_header): Remove entry
|
||||||
|
parameter. Change all callers.
|
||||||
|
(Output_file_header::entry): Use parameters->entry.
|
||||||
|
* gold.cc (queue_middle_tasks): Likewise.
|
||||||
|
* plugin.cc (Plugin_hook::run): Likewise.
|
||||||
|
|
||||||
2011-05-24 Cary Coutant <ccoutant@google.com>
|
2011-05-24 Cary Coutant <ccoutant@google.com>
|
||||||
|
|
||||||
* gold.cc (queue_initial_tasks): Pass incremental base filename
|
* gold.cc (queue_initial_tasks): Pass incremental base filename
|
||||||
|
@ -113,6 +113,11 @@ Library_base::should_include_member(Symbol_table* symtab, Layout* layout,
|
|||||||
*why = buf;
|
*why = buf;
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(sym_name, parameters->entry()) == 0)
|
||||||
|
{
|
||||||
|
*why = "entry symbol ";
|
||||||
|
*why += sym_name;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return Library_base::SHOULD_INCLUDE_UNKNOWN;
|
return Library_base::SHOULD_INCLUDE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -501,11 +501,7 @@ queue_middle_tasks(const General_options& options,
|
|||||||
if (parameters->options().gc_sections())
|
if (parameters->options().gc_sections())
|
||||||
{
|
{
|
||||||
// Find the start symbol if any.
|
// Find the start symbol if any.
|
||||||
Symbol* start_sym;
|
Symbol* start_sym = symtab->lookup(parameters->entry());
|
||||||
if (parameters->options().entry())
|
|
||||||
start_sym = symtab->lookup(parameters->options().entry());
|
|
||||||
else
|
|
||||||
start_sym = symtab->lookup("_start");
|
|
||||||
if (start_sym != NULL)
|
if (start_sym != NULL)
|
||||||
{
|
{
|
||||||
bool is_ordinary;
|
bool is_ordinary;
|
||||||
|
@ -2192,9 +2192,8 @@ Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab,
|
|||||||
: new Output_segment_headers(this->segment_list_));
|
: new Output_segment_headers(this->segment_list_));
|
||||||
|
|
||||||
// Lay out the file header.
|
// Lay out the file header.
|
||||||
Output_file_header* file_header
|
Output_file_header* file_header = new Output_file_header(target, symtab,
|
||||||
= new Output_file_header(target, symtab, segment_headers,
|
segment_headers);
|
||||||
parameters->options().entry());
|
|
||||||
|
|
||||||
this->special_output_list_.push_back(file_header);
|
this->special_output_list_.push_back(file_header);
|
||||||
if (segment_headers != NULL)
|
if (segment_headers != NULL)
|
||||||
|
@ -425,14 +425,12 @@ Output_segment_headers::do_size() const
|
|||||||
|
|
||||||
Output_file_header::Output_file_header(const Target* target,
|
Output_file_header::Output_file_header(const Target* target,
|
||||||
const Symbol_table* symtab,
|
const Symbol_table* symtab,
|
||||||
const Output_segment_headers* osh,
|
const Output_segment_headers* osh)
|
||||||
const char* entry)
|
|
||||||
: target_(target),
|
: target_(target),
|
||||||
symtab_(symtab),
|
symtab_(symtab),
|
||||||
segment_header_(osh),
|
segment_header_(osh),
|
||||||
section_header_(NULL),
|
section_header_(NULL),
|
||||||
shstrtab_(NULL),
|
shstrtab_(NULL)
|
||||||
entry_(entry)
|
|
||||||
{
|
{
|
||||||
this->set_data_size(this->do_size());
|
this->set_data_size(this->do_size());
|
||||||
}
|
}
|
||||||
@ -572,22 +570,16 @@ Output_file_header::do_sized_write(Output_file* of)
|
|||||||
of->write_output_view(0, ehdr_size, view);
|
of->write_output_view(0, ehdr_size, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the value to use for the entry address. THIS->ENTRY_ is the
|
// Return the value to use for the entry address.
|
||||||
// symbol specified on the command line, if any.
|
|
||||||
|
|
||||||
template<int size>
|
template<int size>
|
||||||
typename elfcpp::Elf_types<size>::Elf_Addr
|
typename elfcpp::Elf_types<size>::Elf_Addr
|
||||||
Output_file_header::entry()
|
Output_file_header::entry()
|
||||||
{
|
{
|
||||||
const bool should_issue_warning = (this->entry_ != NULL
|
const bool should_issue_warning = (parameters->options().entry() != NULL
|
||||||
&& !parameters->options().relocatable()
|
&& !parameters->options().relocatable()
|
||||||
&& !parameters->options().shared());
|
&& !parameters->options().shared());
|
||||||
|
const char* entry = parameters->entry();
|
||||||
// FIXME: Need to support target specific entry symbol.
|
|
||||||
const char* entry = this->entry_;
|
|
||||||
if (entry == NULL)
|
|
||||||
entry = "_start";
|
|
||||||
|
|
||||||
Symbol* sym = this->symtab_->lookup(entry);
|
Symbol* sym = this->symtab_->lookup(entry);
|
||||||
|
|
||||||
typename Sized_symbol<size>::Value_type v;
|
typename Sized_symbol<size>::Value_type v;
|
||||||
|
@ -566,8 +566,7 @@ class Output_file_header : public Output_data
|
|||||||
public:
|
public:
|
||||||
Output_file_header(const Target*,
|
Output_file_header(const Target*,
|
||||||
const Symbol_table*,
|
const Symbol_table*,
|
||||||
const Output_segment_headers*,
|
const Output_segment_headers*);
|
||||||
const char* entry);
|
|
||||||
|
|
||||||
// Add information about the section headers. We lay out the ELF
|
// Add information about the section headers. We lay out the ELF
|
||||||
// file header before we create the section headers.
|
// file header before we create the section headers.
|
||||||
@ -614,7 +613,6 @@ class Output_file_header : public Output_data
|
|||||||
const Output_segment_headers* segment_header_;
|
const Output_segment_headers* segment_header_;
|
||||||
const Output_section_headers* section_header_;
|
const Output_section_headers* section_header_;
|
||||||
const Output_section* shstrtab_;
|
const Output_section* shstrtab_;
|
||||||
const char* entry_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Output sections are mainly comprised of input sections. However,
|
// Output sections are mainly comprised of input sections. However,
|
||||||
|
@ -211,6 +211,20 @@ Parameters::check_target_endianness()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return the name of the entry symbol.
|
||||||
|
|
||||||
|
const char*
|
||||||
|
Parameters::entry() const
|
||||||
|
{
|
||||||
|
const char* ret = this->options().entry();
|
||||||
|
if (ret == NULL)
|
||||||
|
{
|
||||||
|
// FIXME: Need to support target specific entry symbol.
|
||||||
|
ret = "_start";
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the incremental linking mode to INCREMENTAL_FULL. Used when
|
// Set the incremental linking mode to INCREMENTAL_FULL. Used when
|
||||||
// the linker determines that an incremental update is not possible.
|
// the linker determines that an incremental update is not possible.
|
||||||
// Returns false if the incremental mode was INCREMENTAL_UPDATE,
|
// Returns false if the incremental mode was INCREMENTAL_UPDATE,
|
||||||
|
@ -134,6 +134,10 @@ class Parameters
|
|||||||
return debug_;
|
return debug_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return the name of the entry symbol.
|
||||||
|
const char*
|
||||||
|
entry() const;
|
||||||
|
|
||||||
// A convenience routine for combining size and endianness. It also
|
// A convenience routine for combining size and endianness. It also
|
||||||
// checks the HAVE_TARGET_FOO configure options and dies if the
|
// checks the HAVE_TARGET_FOO configure options and dies if the
|
||||||
// current target's size/endianness is not supported according to
|
// current target's size/endianness is not supported according to
|
||||||
|
@ -1218,11 +1218,7 @@ void
|
|||||||
Plugin_hook::run(Workqueue* workqueue)
|
Plugin_hook::run(Workqueue* workqueue)
|
||||||
{
|
{
|
||||||
gold_assert(this->options_.has_plugins());
|
gold_assert(this->options_.has_plugins());
|
||||||
Symbol* start_sym;
|
Symbol* start_sym = this->symtab_->lookup(parameters->entry());
|
||||||
if (parameters->options().entry())
|
|
||||||
start_sym = this->symtab_->lookup(parameters->options().entry());
|
|
||||||
else
|
|
||||||
start_sym = this->symtab_->lookup("_start");
|
|
||||||
if (start_sym != NULL)
|
if (start_sym != NULL)
|
||||||
start_sym->set_in_real_elf();
|
start_sym->set_in_real_elf();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user