aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gold/Makefile.am2
-rw-r--r--gold/Makefile.in9
-rw-r--r--gold/archive.cc25
-rw-r--r--gold/archive.h21
-rw-r--r--gold/dynobj.cc22
-rw-r--r--gold/dynobj.h9
-rw-r--r--gold/i386.cc138
-rw-r--r--gold/layout.cc12
-rw-r--r--gold/main.cc2
-rw-r--r--gold/object.cc5
-rw-r--r--gold/object.h11
-rw-r--r--gold/output.cc15
-rw-r--r--gold/output.h11
-rw-r--r--gold/parameters.cc36
-rw-r--r--gold/parameters.h70
-rw-r--r--gold/po/POTFILES.in2
-rw-r--r--gold/po/gold.pot221
-rw-r--r--gold/readsyms.cc14
-rw-r--r--gold/readsyms.h16
-rw-r--r--gold/symtab.h5
-rw-r--r--gold/target.h6
21 files changed, 396 insertions, 256 deletions
diff --git a/gold/Makefile.am b/gold/Makefile.am
index a411127..6975be4 100644
--- a/gold/Makefile.am
+++ b/gold/Makefile.am
@@ -34,6 +34,7 @@ CCFILES = \
object.cc \
options.cc \
output.cc \
+ parameters.cc \
readsyms.cc \
reloc.cc \
resolve.cc \
@@ -57,6 +58,7 @@ HFILES = \
object.h \
options.h \
output.h \
+ parameters.h \
readsyms.h \
reloc.h \
reloc-types.h \
diff --git a/gold/Makefile.in b/gold/Makefile.in
index 884b1a5..a07680e 100644
--- a/gold/Makefile.in
+++ b/gold/Makefile.in
@@ -72,9 +72,9 @@ am__objects_1 = archive.$(OBJEXT) common.$(OBJEXT) defstd.$(OBJEXT) \
dirsearch.$(OBJEXT) dynobj.$(OBJEXT) fileread.$(OBJEXT) \
gold.$(OBJEXT) gold-threads.$(OBJEXT) layout.$(OBJEXT) \
merge.$(OBJEXT) object.$(OBJEXT) options.$(OBJEXT) \
- output.$(OBJEXT) readsyms.$(OBJEXT) reloc.$(OBJEXT) \
- resolve.$(OBJEXT) script.$(OBJEXT) symtab.$(OBJEXT) \
- stringpool.$(OBJEXT) target-select.$(OBJEXT) \
+ output.$(OBJEXT) parameters.$(OBJEXT) readsyms.$(OBJEXT) \
+ reloc.$(OBJEXT) resolve.$(OBJEXT) script.$(OBJEXT) \
+ symtab.$(OBJEXT) stringpool.$(OBJEXT) target-select.$(OBJEXT) \
workqueue.$(OBJEXT)
am__objects_2 =
am__objects_3 = yyscript.$(OBJEXT)
@@ -261,6 +261,7 @@ CCFILES = \
object.cc \
options.cc \
output.cc \
+ parameters.cc \
readsyms.cc \
reloc.cc \
resolve.cc \
@@ -284,6 +285,7 @@ HFILES = \
object.h \
options.h \
output.h \
+ parameters.h \
readsyms.h \
reloc.h \
reloc-types.h \
@@ -405,6 +407,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parameters.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readsyms.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reloc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resolve.Po@am__quote@
diff --git a/gold/archive.cc b/gold/archive.cc
index 840ba01..47b65c5 100644
--- a/gold/archive.cc
+++ b/gold/archive.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "elfcpp.h"
+#include "options.h"
#include "fileread.h"
#include "readsyms.h"
#include "symtab.h"
@@ -238,11 +239,11 @@ Archive::interpret_header(const Archive_header* hdr, off_t off,
// may be satisfied by other objects in the archive.
void
-Archive::add_symbols(const General_options& options, Symbol_table* symtab,
- Layout* layout, Input_objects* input_objects)
+Archive::add_symbols(Symbol_table* symtab, Layout* layout,
+ Input_objects* input_objects)
{
if (this->input_file_->options().include_whole_archive())
- return this->include_all_members(options, symtab, layout, input_objects);
+ return this->include_all_members(symtab, layout, input_objects);
const size_t armap_size = this->armap_.size();
@@ -290,7 +291,7 @@ Archive::add_symbols(const General_options& options, Symbol_table* symtab,
last_seen_offset = this->armap_[i].offset;
this->seen_offsets_.insert(last_seen_offset);
this->armap_checked_[i] = true;
- this->include_member(options, symtab, layout, input_objects,
+ this->include_member(symtab, layout, input_objects,
last_seen_offset);
added_new_object = true;
}
@@ -301,8 +302,7 @@ Archive::add_symbols(const General_options& options, Symbol_table* symtab,
// Include all the archive members in the link. This is for --whole-archive.
void
-Archive::include_all_members(const General_options& options,
- Symbol_table* symtab, Layout* layout,
+Archive::include_all_members(Symbol_table* symtab, Layout* layout,
Input_objects* input_objects)
{
off_t off = sarmag;
@@ -336,7 +336,7 @@ Archive::include_all_members(const General_options& options,
// Extended name table.
}
else
- this->include_member(options, symtab, layout, input_objects, off);
+ this->include_member(symtab, layout, input_objects, off);
off += sizeof(Archive_header) + size;
if ((off & 1) != 0)
@@ -348,9 +348,8 @@ Archive::include_all_members(const General_options& options,
// the member header.
void
-Archive::include_member(const General_options& options, Symbol_table* symtab,
- Layout* layout, Input_objects* input_objects,
- off_t off)
+Archive::include_member(Symbol_table* symtab, Layout* layout,
+ Input_objects* input_objects, off_t off)
{
std::string n;
this->read_header(off, &n);
@@ -392,7 +391,7 @@ Archive::include_member(const General_options& options, Symbol_table* symtab,
Read_symbols_data sd;
obj->read_symbols(&sd);
- obj->layout(options, symtab, layout, &sd);
+ obj->layout(symtab, layout, &sd);
obj->add_symbols(symtab, &sd);
}
@@ -441,8 +440,8 @@ Add_archive_symbols::locks(Workqueue* workqueue)
void
Add_archive_symbols::run(Workqueue*)
{
- this->archive_->add_symbols(this->options_, this->symtab_, this->layout_,
- this->input_objects_);
+ this->archive_->add_symbols(this->symtab_, this->layout_,
+ this->input_objects_);
if (this->input_group_ != NULL)
this->input_group_->add_archive(this->archive_);
diff --git a/gold/archive.h b/gold/archive.h
index 4f4c7f3..f86f2ee 100644
--- a/gold/archive.h
+++ b/gold/archive.h
@@ -11,7 +11,6 @@
namespace gold
{
-class General_options;
class Input_file;
class Input_objects;
class Input_group;
@@ -69,7 +68,7 @@ class Archive
// Select members from the archive as needed and add them to the
// link.
void
- add_symbols(const General_options&, Symbol_table*, Layout*, Input_objects*);
+ add_symbols(Symbol_table*, Layout*, Input_objects*);
private:
Archive(const Archive&);
@@ -98,13 +97,11 @@ class Archive
// Include all the archive members in the link.
void
- include_all_members(const General_options&, Symbol_table*, Layout*,
- Input_objects*);
+ include_all_members(Symbol_table*, Layout*, Input_objects*);
// Include an archive member in the link.
void
- include_member(const General_options&, Symbol_table*, Layout*,
- Input_objects*, off_t off);
+ include_member(Symbol_table*, Layout*, Input_objects*, off_t off);
// An entry in the archive map of symbols to object files.
struct Armap_entry
@@ -144,15 +141,14 @@ class Archive
class Add_archive_symbols : public Task
{
public:
- Add_archive_symbols(const General_options& options, Symbol_table* symtab,
- Layout* layout, Input_objects* input_objects,
+ Add_archive_symbols(Symbol_table* symtab, Layout* layout,
+ Input_objects* input_objects,
Archive* archive, Input_group* input_group,
Task_token* this_blocker,
Task_token* next_blocker)
- : options_(options), symtab_(symtab), layout_(layout),
- input_objects_(input_objects), archive_(archive),
- input_group_(input_group), this_blocker_(this_blocker),
- next_blocker_(next_blocker)
+ : symtab_(symtab), layout_(layout), input_objects_(input_objects),
+ archive_(archive), input_group_(input_group),
+ this_blocker_(this_blocker), next_blocker_(next_blocker)
{ }
~Add_archive_symbols();
@@ -171,7 +167,6 @@ class Add_archive_symbols : public Task
private:
class Add_archive_symbols_locker;
- const General_options& options_;
Symbol_table* symtab_;
Layout* layout_;
Input_objects* input_objects_;
diff --git a/gold/dynobj.cc b/gold/dynobj.cc
index 10f8fbe..a328b4d 100644
--- a/gold/dynobj.cc
+++ b/gold/dynobj.cc
@@ -6,6 +6,7 @@
#include <cstring>
#include "elfcpp.h"
+#include "parameters.h"
#include "symtab.h"
#include "dynobj.h"
@@ -340,8 +341,7 @@ Sized_dynobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
template<int size, bool big_endian>
void
-Sized_dynobj<size, big_endian>::do_layout(const General_options&,
- Symbol_table* symtab,
+Sized_dynobj<size, big_endian>::do_layout(Symbol_table* symtab,
Layout*,
Read_symbols_data* sd)
{
@@ -1196,7 +1196,7 @@ Versions::record_version(const General_options* options,
if (!sym->is_from_dynobj())
{
- if (options->is_shared())
+ if (parameters->output_is_shared())
this->add_def(options, sym, version, version_key);
}
else
@@ -1239,7 +1239,7 @@ Versions::add_def(const General_options* options, const Symbol* sym,
// If we are creating a shared object, it is an error to
// find a definition of a symbol with a version which is not
// in the version script.
- if (options->is_shared())
+ if (parameters->output_is_shared())
{
fprintf(stderr, _("%s: symbol %s has undefined version %s\n"),
program_name, sym->name(), version);
@@ -1366,8 +1366,7 @@ Versions::finalize(const Target* target, Symbol_table* symtab,
// pointers.
unsigned int
-Versions::version_index(const General_options* options,
- const Stringpool* dynpool, const Symbol* sym) const
+Versions::version_index(const Stringpool* dynpool, const Symbol* sym) const
{
Stringpool::Key version_key;
const char* version = dynpool->find(sym->version(), &version_key);
@@ -1376,7 +1375,7 @@ Versions::version_index(const General_options* options,
Key k;
if (!sym->is_from_dynobj())
{
- if (!options->is_shared())
+ if (!parameters->output_is_shared())
return elfcpp::VER_NDX_GLOBAL;
k = Key(version_key, 0);
}
@@ -1404,8 +1403,7 @@ Versions::version_index(const General_options* options,
template<int size, bool big_endian>
void
-Versions::symbol_section_contents(const General_options* options,
- const Stringpool* dynpool,
+Versions::symbol_section_contents(const Stringpool* dynpool,
unsigned int local_symcount,
const std::vector<Symbol*>& syms,
unsigned char** pp,
@@ -1430,7 +1428,7 @@ Versions::symbol_section_contents(const General_options* options,
if (version == NULL)
version_index = elfcpp::VER_NDX_GLOBAL;
else
- version_index = this->version_index(options, dynpool, *p);
+ version_index = this->version_index(dynpool, *p);
elfcpp::Swap<16, big_endian>::writeval(pbuf + (*p)->dynsym_index() * 2,
version_index);
}
@@ -1554,7 +1552,6 @@ class Sized_dynobj<64, true>;
template
void
Versions::symbol_section_contents<32, false>(
- const General_options*,
const Stringpool*,
unsigned int,
const std::vector<Symbol*>&,
@@ -1567,7 +1564,6 @@ Versions::symbol_section_contents<32, false>(
template
void
Versions::symbol_section_contents<32, true>(
- const General_options*,
const Stringpool*,
unsigned int,
const std::vector<Symbol*>&,
@@ -1580,7 +1576,6 @@ Versions::symbol_section_contents<32, true>(
template
void
Versions::symbol_section_contents<64, false>(
- const General_options*,
const Stringpool*,
unsigned int,
const std::vector<Symbol*>&,
@@ -1593,7 +1588,6 @@ Versions::symbol_section_contents<64, false>(
template
void
Versions::symbol_section_contents<64, true>(
- const General_options*,
const Stringpool*,
unsigned int,
const std::vector<Symbol*>&,
diff --git a/gold/dynobj.h b/gold/dynobj.h
index 7575acd..46fea66 100644
--- a/gold/dynobj.h
+++ b/gold/dynobj.h
@@ -106,8 +106,7 @@ class Sized_dynobj : public Dynobj
// Lay out the input sections.
void
- do_layout(const General_options&, Symbol_table*, Layout*,
- Read_symbols_data*);
+ do_layout(Symbol_table*, Layout*, Read_symbols_data*);
// Add the symbols to the symbol table.
void
@@ -415,8 +414,7 @@ class Versions
// version section (.gnu.version).
template<int size, bool big_endian>
void
- symbol_section_contents(const General_options*, const Stringpool*,
- unsigned int local_symcount,
+ symbol_section_contents(const Stringpool*, unsigned int local_symcount,
const std::vector<Symbol*>& syms,
unsigned char**, unsigned int*
ACCEPT_SIZE_ENDIAN) const;
@@ -456,8 +454,7 @@ class Versions
// Return the version index to use for SYM.
unsigned int
- version_index(const General_options*, const Stringpool*,
- const Symbol* sym) const;
+ version_index(const Stringpool*, const Symbol* sym) const;
// We keep a hash table mapping canonicalized name/version pairs to
// a version base.
diff --git a/gold/i386.cc b/gold/i386.cc
index 6eb0b2c..8be178c 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -5,6 +5,7 @@
#include <cstring>
#include "elfcpp.h"
+#include "parameters.h"
#include "reloc.h"
#include "i386.h"
#include "object.h"
@@ -51,7 +52,7 @@ class Target_i386 : public Sized_target<32, false>
// Finalize the sections.
void
- do_finalize_sections(const General_options*, Layout*);
+ do_finalize_sections(Layout*);
// Relocate a section.
void
@@ -162,16 +163,15 @@ class Target_i386 : public Sized_target<32, false>
// Adjust TLS relocation type based on the options and whether this
// is a local symbol.
static unsigned int
- optimize_tls_reloc(const General_options*, bool is_final, int r_type);
+ optimize_tls_reloc(bool is_final, int r_type);
// Get the GOT section, creating it if necessary.
Output_data_got<32, false>*
- got_section(const General_options*, Symbol_table*, Layout*);
+ got_section(Symbol_table*, Layout*);
// Create a PLT entry for a global symbol.
void
- make_plt_entry(const General_options* options, Symbol_table*,
- Layout*, Symbol*);
+ make_plt_entry(Symbol_table*, Layout*, Symbol*);
// Get the PLT section.
Output_data_plt_i386*
@@ -226,14 +226,13 @@ const Target::Target_info Target_i386::i386_info =
// Get the GOT section, creating it if necessary.
Output_data_got<32, false>*
-Target_i386::got_section(const General_options* options, Symbol_table* symtab,
- Layout* layout)
+Target_i386::got_section(Symbol_table* symtab, Layout* layout)
{
if (this->got_ == NULL)
{
- gold_assert(options != NULL && symtab != NULL && layout != NULL);
+ gold_assert(symtab != NULL && layout != NULL);
- this->got_ = new Output_data_got<32, false>(options);
+ this->got_ = new Output_data_got<32, false>();
layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
elfcpp::SHF_ALLOC | elfcpp::SHF_WRITE,
@@ -285,7 +284,7 @@ class Output_data_plt_i386 : public Output_section_data
public:
typedef Output_data_reloc<elfcpp::SHT_REL, true, 32, false> Reloc_section;
- Output_data_plt_i386(Layout*, Output_data_space*, bool is_shared);
+ Output_data_plt_i386(Layout*, Output_data_space*);
// Add an entry to the PLT.
void
@@ -331,8 +330,6 @@ class Output_data_plt_i386 : public Output_section_data
Output_data_space* got_plt_;
// The number of PLT entries.
unsigned int count_;
- // Whether we are generated a shared object.
- bool is_shared_;
};
// Create the PLT section. The ordinary .got section is an argument,
@@ -340,9 +337,8 @@ class Output_data_plt_i386 : public Output_section_data
// section just for PLT entries.
Output_data_plt_i386::Output_data_plt_i386(Layout* layout,
- Output_data_space* got_plt,
- bool is_shared)
- : Output_section_data(4), got_plt_(got_plt), is_shared_(is_shared)
+ Output_data_space* got_plt)
+ : Output_section_data(4), got_plt_(got_plt)
{
this->rel_ = new Reloc_section();
layout->add_output_section_data(".rel.plt", elfcpp::SHT_REL,
@@ -454,7 +450,7 @@ Output_data_plt_i386::do_write(Output_file* of)
elfcpp::Elf_types<32>::Elf_Addr plt_address = this->address();
elfcpp::Elf_types<32>::Elf_Addr got_address = this->got_plt_->address();
- if (this->is_shared_)
+ if (parameters->output_is_shared())
memcpy(pov, dyn_first_plt_entry, plt_entry_size);
else
{
@@ -486,7 +482,7 @@ Output_data_plt_i386::do_write(Output_file* of)
{
// Set and adjust the PLT entry itself.
- if (this->is_shared_)
+ if (parameters->output_is_shared())
{
memcpy(pov, dyn_plt_entry, plt_entry_size);
elfcpp::Swap_unaligned<32, false>::writeval(pov + 2, got_offset);
@@ -517,8 +513,7 @@ Output_data_plt_i386::do_write(Output_file* of)
// Create a PLT entry for a global symbol.
void
-Target_i386::make_plt_entry(const General_options* options,
- Symbol_table* symtab, Layout* layout, Symbol* gsym)
+Target_i386::make_plt_entry(Symbol_table* symtab, Layout* layout, Symbol* gsym)
{
if (gsym->has_plt_offset())
return;
@@ -526,10 +521,9 @@ Target_i386::make_plt_entry(const General_options* options,
if (this->plt_ == NULL)
{
// Create the GOT sections first.
- this->got_section(options, symtab, layout);
+ this->got_section(symtab, layout);
- this->plt_ = new Output_data_plt_i386(layout, this->got_plt_,
- options->is_shared());
+ this->plt_ = new Output_data_plt_i386(layout, this->got_plt_);
layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS,
(elfcpp::SHF_ALLOC
| elfcpp::SHF_EXECINSTR),
@@ -629,13 +623,11 @@ Target_i386::copy_reloc(const General_options* options,
// known at link time.
unsigned int
-Target_i386::optimize_tls_reloc(const General_options* options,
- bool is_final,
- int r_type)
+Target_i386::optimize_tls_reloc(bool is_final, int r_type)
{
// If we are generating a shared library, then we can't do anything
// in the linker.
- if (options->is_shared())
+ if (parameters->output_is_shared())
return r_type;
switch (r_type)
@@ -686,7 +678,7 @@ Target_i386::optimize_tls_reloc(const General_options* options,
// Scan a relocation for a local symbol.
inline void
-Target_i386::Scan::local(const General_options& options,
+Target_i386::Scan::local(const General_options&,
Symbol_table* symtab,
Layout* layout,
Target_i386* target,
@@ -708,7 +700,7 @@ Target_i386::Scan::local(const General_options& options,
case elfcpp::R_386_8:
// FIXME: If we are generating a shared object we need to copy
// this relocation into the object.
- gold_assert(!options.is_shared());
+ gold_assert(!parameters->output_is_shared());
break;
case elfcpp::R_386_PC32:
@@ -719,7 +711,7 @@ Target_i386::Scan::local(const General_options& options,
case elfcpp::R_386_GOTOFF:
case elfcpp::R_386_GOTPC:
// We need a GOT section.
- target->got_section(&options, symtab, layout);
+ target->got_section(symtab, layout);
break;
case elfcpp::R_386_COPY:
@@ -746,31 +738,33 @@ Target_i386::Scan::local(const General_options& options,
case elfcpp::R_386_TLS_LE_32:
case elfcpp::R_386_TLS_GOTDESC:
case elfcpp::R_386_TLS_DESC_CALL:
- r_type = Target_i386::optimize_tls_reloc(&options,
- !options.is_shared(),
- r_type);
- switch (r_type)
- {
- case elfcpp::R_386_TLS_LE:
- case elfcpp::R_386_TLS_LE_32:
- // FIXME: If generating a shared object, we need to copy
- // this relocation into the object.
- gold_assert(!options.is_shared());
- break;
+ {
+ bool output_is_executable = parameters->output_is_executable();
+ r_type = Target_i386::optimize_tls_reloc(output_is_executable,
+ r_type);
+ switch (r_type)
+ {
+ case elfcpp::R_386_TLS_LE:
+ case elfcpp::R_386_TLS_LE_32:
+ // FIXME: If generating a shared object, we need to copy
+ // this relocation into the object.
+ gold_assert(output_is_executable);
+ break;
- case elfcpp::R_386_TLS_IE:
- case elfcpp::R_386_TLS_GOTIE:
- case elfcpp::R_386_TLS_GD:
- case elfcpp::R_386_TLS_LDM:
- case elfcpp::R_386_TLS_LDO_32:
- case elfcpp::R_386_TLS_IE_32:
- case elfcpp::R_386_TLS_GOTDESC:
- case elfcpp::R_386_TLS_DESC_CALL:
- fprintf(stderr,
- _("%s: %s: unsupported reloc %u against local symbol\n"),
- program_name, object->name().c_str(), r_type);
- break;
- }
+ case elfcpp::R_386_TLS_IE:
+ case elfcpp::R_386_TLS_GOTIE:
+ case elfcpp::R_386_TLS_GD:
+ case elfcpp::R_386_TLS_LDM:
+ case elfcpp::R_386_TLS_LDO_32:
+ case elfcpp::R_386_TLS_IE_32:
+ case elfcpp::R_386_TLS_GOTDESC:
+ case elfcpp::R_386_TLS_DESC_CALL:
+ fprintf(stderr,
+ _("%s: %s: unsupported reloc %u against local symbol\n"),
+ program_name, object->name().c_str(), r_type);
+ break;
+ }
+ }
break;
case elfcpp::R_386_GOT32:
@@ -822,7 +816,7 @@ Target_i386::Scan::global(const General_options& options,
// copy this relocation into the object. If this symbol is
// defined in a shared object, we may need to copy this
// relocation in order to avoid a COPY relocation.
- gold_assert(!options.is_shared());
+ gold_assert(!parameters->output_is_shared());
if (gsym->is_from_dynobj())
{
@@ -830,7 +824,7 @@ Target_i386::Scan::global(const General_options& options,
// function, we make a PLT entry. Otherwise we need to
// either generate a COPY reloc or copy this reloc.
if (gsym->type() == elfcpp::STT_FUNC)
- target->make_plt_entry(&options, symtab, layout, gsym);
+ target->make_plt_entry(symtab, layout, gsym);
else
target->copy_reloc(&options, symtab, layout, object, data_shndx,
gsym, reloc);
@@ -841,13 +835,12 @@ Target_i386::Scan::global(const General_options& options,
case elfcpp::R_386_GOT32:
{
// The symbol requires a GOT entry.
- Output_data_got<32, false>* got = target->got_section(&options, symtab,
- layout);
+ Output_data_got<32, false>* got = target->got_section(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))
+ if (!gsym->final_value_is_known())
{
Reloc_section* rel_dyn = target->rel_dyn_section(layout);
rel_dyn->add_global(gsym, elfcpp::R_386_GLOB_DAT, got,
@@ -860,15 +853,15 @@ Target_i386::Scan::global(const General_options& options,
case elfcpp::R_386_PLT32:
// If the symbol is fully resolved, this is just a PC32 reloc.
// Otherwise we need a PLT entry.
- if (gsym->final_value_is_known(&options))
+ if (gsym->final_value_is_known())
break;
- target->make_plt_entry(&options, symtab, layout, gsym);
+ target->make_plt_entry(symtab, layout, gsym);
break;
case elfcpp::R_386_GOTOFF:
case elfcpp::R_386_GOTPC:
// We need a GOT section.
- target->got_section(&options, symtab, layout);
+ target->got_section(symtab, layout);
break;
case elfcpp::R_386_COPY:
@@ -896,15 +889,15 @@ Target_i386::Scan::global(const General_options& options,
case elfcpp::R_386_TLS_GOTDESC:
case elfcpp::R_386_TLS_DESC_CALL:
{
- const bool is_final = gsym->final_value_is_known(&options);
- r_type = Target_i386::optimize_tls_reloc(&options, is_final, r_type);
+ const bool is_final = gsym->final_value_is_known();
+ r_type = Target_i386::optimize_tls_reloc(is_final, r_type);
switch (r_type)
{
case elfcpp::R_386_TLS_LE:
case elfcpp::R_386_TLS_LE_32:
// FIXME: If generating a shared object, we need to copy
// this relocation into the object.
- gold_assert(!options.is_shared());
+ gold_assert(!parameters->output_is_shared());
break;
case elfcpp::R_386_TLS_IE:
@@ -983,8 +976,7 @@ Target_i386::scan_relocs(const General_options& options,
// Finalize the sections.
void
-Target_i386::do_finalize_sections(const General_options* options,
- Layout* layout)
+Target_i386::do_finalize_sections(Layout* layout)
{
// Fill in some more dynamic tags.
Output_data_dynamic* const odyn = layout->dynamic_data();
@@ -1010,7 +1002,7 @@ Target_i386::do_finalize_sections(const General_options* options,
elfcpp::Elf_sizes<32>::rel_size);
}
- if (!options->is_shared())
+ if (!parameters->output_is_shared())
{
// The value of the DT_DEBUG tag is filled in by the dynamic
// linker at run time, and used by the debugger.
@@ -1106,7 +1098,7 @@ Target_i386::Relocate::relocate(const Relocate_info<32, false>* relinfo,
case elfcpp::R_386_PLT32:
gold_assert(gsym->has_plt_offset()
- || gsym->final_value_is_known(relinfo->options));
+ || gsym->final_value_is_known());
Relocate_functions<32, false>::pcrel32(view, object, psymval, address);
break;
@@ -1121,7 +1113,7 @@ Target_i386::Relocate::relocate(const Relocate_info<32, false>* relinfo,
{
elfcpp::Elf_types<32>::Elf_Addr value;
value = (psymval->value(object, 0)
- - target->got_section(NULL, NULL, NULL)->address());
+ - target->got_section(NULL, NULL)->address());
Relocate_functions<32, false>::rel32(view, value);
}
break;
@@ -1129,7 +1121,7 @@ Target_i386::Relocate::relocate(const Relocate_info<32, false>* relinfo,
case elfcpp::R_386_GOTPC:
{
elfcpp::Elf_types<32>::Elf_Addr value;
- value = target->got_section(NULL, NULL, NULL)->address();
+ value = target->got_section(NULL, NULL)->address();
Relocate_functions<32, false>::pcrel32(view, value, address);
}
break;
@@ -1211,10 +1203,10 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
elfcpp::Elf_types<32>::Elf_Addr value = psymval->value(relinfo->object, 0);
const bool is_final = (gsym == NULL
- ? !relinfo->options->is_shared()
- : gsym->final_value_is_known(relinfo->options));
+ ? !parameters->output_is_shared()
+ : gsym->final_value_is_known());
const unsigned int opt_r_type =
- Target_i386::optimize_tls_reloc(relinfo->options, is_final, r_type);
+ Target_i386::optimize_tls_reloc(is_final, r_type);
switch (r_type)
{
case elfcpp::R_386_TLS_LE_32:
diff --git a/gold/layout.cc b/gold/layout.cc
index 35de9e4..9d4b644 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -7,6 +7,7 @@
#include <iostream>
#include <utility>
+#include "parameters.h"
#include "output.h"
#include "symtab.h"
#include "dynobj.h"
@@ -86,7 +87,7 @@ Layout::include_section(Object*, const char*,
case elfcpp::SHT_RELA:
case elfcpp::SHT_REL:
case elfcpp::SHT_GROUP:
- return this->options_.is_relocatable();
+ return parameters->output_is_object();
default:
// FIXME: Handle stripping debug sections here.
@@ -170,7 +171,7 @@ Layout::layout(Relobj* object, unsigned int shndx, const char* name,
// If we are not doing a relocateable link, choose the name to use
// for the output section.
size_t len = strlen(name);
- if (!this->options_.is_relocatable())
+ if (!parameters->output_is_object())
name = Layout::output_section_name(name, &len);
// FIXME: Handle SHF_OS_NONCONFORMING here.
@@ -395,7 +396,7 @@ Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab)
Target* const target = input_objects->target();
const int size = target->get_size();
- target->finalize_sections(&this->options_, this);
+ target->finalize_sections(this);
Output_segment* phdr_seg = NULL;
if (input_objects->any_dynamic())
@@ -453,7 +454,6 @@ Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab)
Output_file_header* file_header;
file_header = new Output_file_header(size,
big_endian,
- this->options_,
target,
symtab,
segment_headers);
@@ -1057,8 +1057,8 @@ Layout::sized_create_version_sections(
unsigned char* vbuf;
unsigned int vsize;
versions->symbol_section_contents SELECT_SIZE_ENDIAN_NAME(size, big_endian)(
- &this->options_, &this->dynpool_, local_symcount, dynamic_symbols,
- &vbuf, &vsize SELECT_SIZE_ENDIAN(size, big_endian));
+ &this->dynpool_, local_symcount, dynamic_symbols, &vbuf, &vsize
+ SELECT_SIZE_ENDIAN(size, big_endian));
Output_section_data* vdata = new Output_data_const_buffer(vbuf, vsize, 2);
diff --git a/gold/main.cc b/gold/main.cc
index ea65c2d..6395e62 100644
--- a/gold/main.cc
+++ b/gold/main.cc
@@ -3,6 +3,7 @@
#include "gold.h"
#include "options.h"
+#include "parameters.h"
#include "dirsearch.h"
#include "workqueue.h"
#include "object.h"
@@ -28,6 +29,7 @@ main(int argc, char** argv)
// Handle the command line options.
Command_line command_line;
command_line.process(argc - 1, argv + 1);
+ initialize_parameters(&command_line.options());
// The work queue.
Workqueue workqueue(command_line.options());
diff --git a/gold/object.cc b/gold/object.cc
index 1d20b76..39022c6 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -386,8 +386,7 @@ Sized_relobj<size, big_endian>::include_linkonce_section(
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_layout(const General_options& options,
- Symbol_table* symtab,
+Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab,
Layout* layout,
Read_symbols_data* sd)
{
@@ -427,7 +426,7 @@ Sized_relobj<size, big_endian>::do_layout(const General_options& options,
if (this->handle_gnu_warning_section(name, i, symtab))
{
- if (!options.is_relocatable())
+ if (!parameters->output_is_object())
omit[i] = true;
}
diff --git a/gold/object.h b/gold/object.h
index 2027f8e..a4b53da 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -171,9 +171,8 @@ class Object
// Pass sections which should be included in the link to the Layout
// object, and record where the sections go in the output file.
void
- layout(const General_options& options, Symbol_table* symtab,
- Layout* layout, Read_symbols_data* sd)
- { this->do_layout(options, symtab, layout, sd); }
+ layout(Symbol_table* symtab, Layout* layout, Read_symbols_data* sd)
+ { this->do_layout(symtab, layout, sd); }
// Add symbol information to the global symbol table.
void
@@ -233,8 +232,7 @@ class Object
// Lay out sections--implemented by child class.
virtual void
- do_layout(const General_options&, Symbol_table*, Layout*,
- Read_symbols_data*) = 0;
+ do_layout(Symbol_table*, Layout*, Read_symbols_data*) = 0;
// Add symbol information to the global symbol table--implemented by
// child class.
@@ -589,8 +587,7 @@ class Sized_relobj : public Relobj
// Lay out the input sections.
void
- do_layout(const General_options&, Symbol_table*, Layout*,
- Read_symbols_data*);
+ do_layout(Symbol_table*, Layout*, Read_symbols_data*);
// Add the symbols to the symbol table.
void
diff --git a/gold/output.cc b/gold/output.cc
index bbd7af1..19ea562 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -9,6 +9,7 @@
#include <sys/mman.h>
#include <algorithm>
+#include "parameters.h"
#include "object.h"
#include "symtab.h"
#include "reloc.h"
@@ -226,13 +227,11 @@ Output_segment_headers::do_sized_write(Output_file* of)
Output_file_header::Output_file_header(int size,
bool big_endian,
- const General_options& options,
const Target* target,
const Symbol_table* symtab,
const Output_segment_headers* osh)
: size_(size),
big_endian_(big_endian),
- options_(options),
target_(target),
symtab_(symtab),
segment_header_(osh),
@@ -316,7 +315,7 @@ Output_file_header::do_sized_write(Output_file* of)
elfcpp::ET e_type;
// FIXME: ET_DYN.
- if (this->options_.is_relocatable())
+ if (parameters->output_is_object())
e_type = elfcpp::ET_REL;
else
e_type = elfcpp::ET_EXEC;
@@ -564,9 +563,7 @@ Output_data_reloc_base<sh_type, dynamic, size, big_endian>::do_write(
template<int size, bool big_endian>
void
-Output_data_got<size, big_endian>::Got_entry::write(
- const General_options* options,
- unsigned char* pov) const
+Output_data_got<size, big_endian>::Got_entry::write(unsigned char* pov) const
{
Valtype val = 0;
@@ -580,7 +577,7 @@ Output_data_got<size, big_endian>::Got_entry::write(
// value. Otherwise we just write zero. The target code is
// responsible for creating a relocation entry to fill in the
// value at runtime.
- if (gsym->final_value_is_known(options))
+ if (gsym->final_value_is_known())
{
Sized_symbol<size>* sgsym;
// This cast is a bit ugly. We don't want to put a
@@ -639,7 +636,7 @@ Output_data_got<size, big_endian>::do_write(Output_file* of)
p != this->entries_.end();
++p)
{
- p->write(this->options_, pov);
+ p->write(pov);
pov += add;
}
@@ -1546,7 +1543,7 @@ Output_file::open(off_t file_size)
{
this->file_size_ = file_size;
- int mode = this->options_.is_relocatable() ? 0666 : 0777;
+ int mode = parameters->output_is_object() ? 0666 : 0777;
int o = ::open(this->name_, O_RDWR | O_CREAT | O_TRUNC, mode);
if (o < 0)
{
diff --git a/gold/output.h b/gold/output.h
index b219805..4fb859b 100644
--- a/gold/output.h
+++ b/gold/output.h
@@ -248,7 +248,6 @@ class Output_file_header : public Output_data
public:
Output_file_header(int size,
bool big_endian,
- const General_options&,
const Target*,
const Symbol_table*,
const Output_segment_headers*);
@@ -281,7 +280,6 @@ class Output_file_header : public Output_data
int size_;
bool big_endian_;
- const General_options& options_;
const Target* target_;
const Symbol_table* symtab_;
const Output_segment_headers* segment_header_;
@@ -892,9 +890,8 @@ class Output_data_got : public Output_section_data
public:
typedef typename elfcpp::Elf_types<size>::Elf_Addr Valtype;
- Output_data_got(const General_options* options)
- : Output_section_data(Output_data::default_alignment(size)),
- options_(options), entries_()
+ Output_data_got()
+ : Output_section_data(Output_data::default_alignment(size)), entries_()
{ }
// Add an entry for a global symbol to the GOT. Return true if this
@@ -958,7 +955,7 @@ class Output_data_got : public Output_section_data
// Write the GOT entry to an output view.
void
- write(const General_options*, unsigned char* pov) const;
+ write(unsigned char* pov) const;
private:
enum
@@ -998,8 +995,6 @@ class Output_data_got : public Output_section_data
set_got_size()
{ this->set_data_size(this->got_offset(this->entries_.size())); }
- // Options.
- const General_options* options_;
// The list of GOT entries.
Got_entries entries_;
};
diff --git a/gold/parameters.cc b/gold/parameters.cc
new file mode 100644
index 0000000..1780724
--- /dev/null
+++ b/gold/parameters.cc
@@ -0,0 +1,36 @@
+// parameters.cc -- general parameters for a link using gold
+
+#include "gold.h"
+
+#include "options.h"
+#include "parameters.h"
+
+namespace gold
+{
+
+// Initialize the parameters from the options.
+
+Parameters::Parameters(const General_options* options)
+ : optimization_level_(options->optimization_level())
+{
+ if (options->is_shared())
+ this->output_file_type_ = OUTPUT_SHARED;
+ else if (options->is_relocatable())
+ this->output_file_type_ = OUTPUT_OBJECT;
+ else
+ this->output_file_type_ = OUTPUT_EXECUTABLE;
+}
+
+// The global variable.
+
+const Parameters* parameters;
+
+// Initialize the global variable.
+
+void
+initialize_parameters(const General_options* options)
+{
+ parameters = new Parameters(options);
+}
+
+} // End namespace gold.
diff --git a/gold/parameters.h b/gold/parameters.h
new file mode 100644
index 0000000..040cc28
--- /dev/null
+++ b/gold/parameters.h
@@ -0,0 +1,70 @@
+// parameters.h -- general parameters for a link using gold -*- C++ -*-
+
+#ifndef GOLD_PARAMETERS_H
+#define GOLD_PARAMETERS_H
+
+namespace gold
+{
+
+class General_options;
+
+// Here we define the Parameters class which simply holds simple
+// general parameters which apply to the entire link. We use a global
+// variable for this. This is in contrast to the General_options
+// class, which holds the complete state of position independent
+// command line options. The hope is that Parameters will stay fairly
+// simple, so that if this turns into a library it will be clear how
+// these parameters should be set.
+
+class Parameters
+{
+ public:
+ Parameters(const General_options*);
+
+ // Whether we are generating a regular executable.
+ bool
+ output_is_executable() const
+ { return this->output_file_type_ == OUTPUT_EXECUTABLE; }
+
+ // Whether we are generating a shared library.
+ bool
+ output_is_shared() const
+ { return this->output_file_type_ == OUTPUT_SHARED; }
+
+ // Whether we are generating an object file.
+ bool
+ output_is_object() const
+ { return this->output_file_type_ == OUTPUT_OBJECT; }
+
+ // The general linker optimization level.
+ int
+ optimization_level() const
+ { return this->optimization_level_; }
+
+ private:
+ // The types of output files.
+ enum Output_file_type
+ {
+ // Generating executable.
+ OUTPUT_EXECUTABLE,
+ // Generating shared library.
+ OUTPUT_SHARED,
+ // Generating object file.
+ OUTPUT_OBJECT
+ };
+
+ // The type of the output file.
+ Output_file_type output_file_type_;
+ // The optimization level.
+ int optimization_level_;
+};
+
+// This is a global variable.
+extern const Parameters* parameters;
+
+// Initialize the global variable.
+extern void initialize_parameters(const General_options*);
+
+} // End namespace gold.
+
+#endif // !defined(GOLD_PARAMATERS_H)
diff --git a/gold/po/POTFILES.in b/gold/po/POTFILES.in
index 0c4145a..6dcc015 100644
--- a/gold/po/POTFILES.in
+++ b/gold/po/POTFILES.in
@@ -25,6 +25,8 @@ options.cc
options.h
output.cc
output.h
+parameters.cc
+parameters.h
readsyms.cc
readsyms.h
reloc.cc
diff --git a/gold/po/gold.pot b/gold/po/gold.pot
index 79d0628..286ba19 100644
--- a/gold/po/gold.pot
+++ b/gold/po/gold.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-05-16 10:40-0700\n"
+"POT-Creation-Date: 2007-09-21 00:18-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,42 +16,47 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: archive.cc:62
+#: archive.cc:69
#, c-format
msgid "%s: %s: no archive symbol table (run ranlib)\n"
msgstr ""
-#: archive.cc:91
+#: archive.cc:121
#, c-format
msgid "%s: %s: bad archive symbol table names\n"
msgstr ""
-#: archive.cc:129
+#: archive.cc:153
#, c-format
msgid "%s; %s: malformed archive header at %ld\n"
msgstr ""
-#: archive.cc:150
+#: archive.cc:174
#, c-format
msgid "%s: %s: malformed archive header size at %ld\n"
msgstr ""
-#: archive.cc:162
+#: archive.cc:186
#, c-format
msgid "%s: %s: malformed archive header name at %ld\n"
msgstr ""
-#: archive.cc:188
+#: archive.cc:212
#, c-format
msgid "%s: %s: bad extended name index at %ld\n"
msgstr ""
-#: archive.cc:199
+#: archive.cc:223
#, c-format
msgid "%s: %s: bad extended name entry at header %ld\n"
msgstr ""
-#: archive.cc:280 archive.cc:293
+#: archive.cc:318
+#, c-format
+msgid "%s: %s: short archive header at %ld\n"
+msgstr ""
+
+#: archive.cc:367 archive.cc:380
#, c-format
msgid "%s: %s: member at %ld is not an ELF object"
msgstr ""
@@ -61,47 +66,47 @@ msgstr ""
msgid "can not read directory %s"
msgstr ""
-#: dynobj.cc:109
+#: dynobj.cc:110
#, c-format
msgid "%s: %s: unexpected duplicate type %u section: %u, %u\n"
msgstr ""
-#: dynobj.cc:150
+#: dynobj.cc:151
#, c-format
msgid "%s: %s: unexpected link in section %u header: %u != %u\n"
msgstr ""
-#: dynobj.cc:188
+#: dynobj.cc:189
#, c-format
msgid "%s: %s: DYNAMIC section %u link out of range: %u\n"
msgstr ""
-#: dynobj.cc:198
+#: dynobj.cc:199
#, c-format
msgid "%s: %s: DYNAMIC section %u link %u is not a strtab\n"
msgstr ""
-#: dynobj.cc:220
+#: dynobj.cc:221
#, c-format
msgid "%s: %s: DT_SONAME value out of range: %lld >= %lld\n"
msgstr ""
-#: dynobj.cc:237
+#: dynobj.cc:238
#, c-format
msgid "%s: %s: missing DT_NULL in dynamic segment\n"
msgstr ""
-#: dynobj.cc:285
+#: dynobj.cc:286
#, c-format
msgid "%s: %s: invalid dynamic symbol table name index: %u\n"
msgstr ""
-#: dynobj.cc:293
+#: dynobj.cc:294
#, c-format
msgid "%s: %s: dynamic symbol table name section has wrong type: %u\n"
msgstr ""
-#: dynobj.cc:368 object.cc:420
+#: dynobj.cc:368 object.cc:419
#, c-format
msgid "%s: %s: bad section name offset for section %u: %lu\n"
msgstr ""
@@ -166,7 +171,7 @@ msgstr ""
msgid "%s: %s: size of dynamic symbols is not multiple of symbol size\n"
msgstr ""
-#: dynobj.cc:1241
+#: dynobj.cc:1244
#, c-format
msgid "%s: symbol %s has undefined version %s\n"
msgstr ""
@@ -250,57 +255,57 @@ msgid "pthread_cond_signal failed"
msgstr ""
#. FIXME: This needs to specify the location somehow.
-#: i386.cc:100
+#: i386.cc:105
#, c-format
msgid "%s: missing expected TLS relocation\n"
msgstr ""
-#: i386.cc:729 i386.cc:870 i386.cc:1136
+#: i386.cc:726 i386.cc:876 i386.cc:1138
#, c-format
msgid "%s: %s: unexpected reloc %u in object file\n"
msgstr ""
-#: i386.cc:765 i386.cc:784
+#: i386.cc:763 i386.cc:783
#, c-format
msgid "%s: %s: unsupported reloc %u against local symbol\n"
msgstr ""
-#: i386.cc:906 i386.cc:927
+#: i386.cc:912 i386.cc:933
#, c-format
msgid "%s: %s: unsupported reloc %u against global symbol %s\n"
msgstr ""
-#: i386.cc:950
+#: i386.cc:956
#, c-format
msgid "%s: %s: unsupported RELA reloc section\n"
msgstr ""
-#: i386.cc:1041
+#: i386.cc:1046
#, c-format
msgid "%s: %s: missing expected TLS relocation\n"
msgstr ""
-#: i386.cc:1168 i386.cc:1245 i386.cc:1256
+#: i386.cc:1170 i386.cc:1247 i386.cc:1258
#, c-format
msgid "%s: %s: unsupported reloc %u\n"
msgstr ""
-#: i386.cc:1195
+#: i386.cc:1197
#, c-format
msgid "%s: %s: TLS reloc but no TLS segment\n"
msgstr ""
-#: i386.cc:1230
+#: i386.cc:1232
#, c-format
msgid "%s: %s: unsupported reloc type %u\n"
msgstr ""
-#: i386.cc:1439
+#: i386.cc:1441
#, c-format
msgid "%s: %s: TLS relocation out of range\n"
msgstr ""
-#: i386.cc:1457
+#: i386.cc:1459
#, c-format
msgid "%s: %s: TLS relocation against invalid instruction\n"
msgstr ""
@@ -376,7 +381,7 @@ msgstr ""
msgid "%s: %s: unsupported ELF file type %d\n"
msgstr ""
-#: object.cc:853 object.cc:906 object.cc:927
+#: object.cc:853 object.cc:906 object.cc:941
#, c-format
msgid "%s: %s: ELF file too short\n"
msgstr ""
@@ -411,6 +416,26 @@ msgstr ""
msgid "%s: %s: unsupported ELF data encoding %d\n"
msgstr ""
+#: object.cc:918
+#, c-format
+msgid "%s: %s: not configured to support 32-bit big-endian object\n"
+msgstr ""
+
+#: object.cc:931
+#, c-format
+msgid "%s: %s: not configured to support 32-bit little-endian object\n"
+msgstr ""
+
+#: object.cc:953
+#, c-format
+msgid "%s: %s: not configured to support 64-bit big-endian object\n"
+msgstr ""
+
+#: object.cc:966
+#, c-format
+msgid "%s: %s: not configured to support 64-bit little-endian object\n"
+msgstr ""
+
#: options.cc:115
#, c-format
msgid ""
@@ -418,141 +443,181 @@ msgid ""
"Options:\n"
msgstr ""
-#: options.cc:227
+#: options.cc:230
msgid "Search for library LIBNAME"
msgstr ""
-#: options.cc:228
-msgid "-lLIBNAME --library LIBNAME"
+#: options.cc:231
+msgid "-lLIBNAME, --library LIBNAME"
msgstr ""
-#: options.cc:230
+#: options.cc:233
msgid "Start a library search group"
msgstr ""
-#: options.cc:232
+#: options.cc:235
msgid "End a library search group"
msgstr ""
-#: options.cc:234
+#: options.cc:237
+msgid "Export all dynamic symbols"
+msgstr ""
+
+#: options.cc:239
msgid "Set dynamic linker path"
msgstr ""
-#: options.cc:235
+#: options.cc:240
msgid "-I PROGRAM, --dynamic-linker PROGRAM"
msgstr ""
-#: options.cc:237
+#: options.cc:242
msgid "Add directory to search path"
msgstr ""
-#: options.cc:238
+#: options.cc:243
msgid "-L DIR, --library-path DIR"
msgstr ""
-#: options.cc:240
+#: options.cc:245
msgid "Ignored for compatibility"
msgstr ""
-#: options.cc:242
+#: options.cc:247
+msgid "Optimize output file size"
+msgstr ""
+
+#: options.cc:248
+msgid "-O level"
+msgstr ""
+
+#: options.cc:250
msgid "Set output file name"
msgstr ""
-#: options.cc:243
+#: options.cc:251
msgid "-o FILE, --output FILE"
msgstr ""
-#: options.cc:245
+#: options.cc:253
msgid "Generate relocatable output"
msgstr ""
-#: options.cc:247
+#: options.cc:255
+msgid "Add DIR to runtime search path"
+msgstr ""
+
+#: options.cc:256
+msgid "-R DIR, -rpath DIR"
+msgstr ""
+
+#: options.cc:258
+msgid "Create exception frame header"
+msgstr ""
+
+#: options.cc:261
+msgid "Add DIR to link time shared library search path"
+msgstr ""
+
+#: options.cc:262
+msgid "--rpath-link DIR"
+msgstr ""
+
+#: options.cc:264
msgid "Generate shared library"
msgstr ""
-#: options.cc:249
+#: options.cc:266
msgid "Do not link against shared libraries"
msgstr ""
-#: options.cc:252
-msgid "Only set DT_NEEDED for following dynamic libs if used"
+#: options.cc:269
+msgid "Only set DT_NEEDED for dynamic libs if used"
msgstr ""
-#: options.cc:255
-msgid "Always DT_NEEDED for following dynamic libs (default)"
+#: options.cc:272
+msgid "Always DT_NEEDED for dynamic libs (default)"
msgstr ""
-#: options.cc:257
+#: options.cc:275
+msgid "Include all archive contents"
+msgstr ""
+
+#: options.cc:279
+msgid "Include only needed archive contents"
+msgstr ""
+
+#: options.cc:282
msgid "Report usage information"
msgstr ""
-#: options.cc:393 options.cc:444 options.cc:523
+#: options.cc:425 options.cc:476 options.cc:555
msgid "missing argument"
msgstr ""
-#: options.cc:406 options.cc:453
+#: options.cc:438 options.cc:485
msgid "unknown option"
msgstr ""
-#: options.cc:461
+#: options.cc:493
#, c-format
msgid "%s: missing group end"
msgstr ""
-#: options.cc:536
+#: options.cc:568
msgid "may not nest groups"
msgstr ""
-#: options.cc:546
+#: options.cc:578
msgid "group end without group start"
msgstr ""
-#: options.cc:556
+#: options.cc:588
#, c-format
msgid "%s: use the --help option for usage information\n"
msgstr ""
-#: options.cc:565 script.cc:1133
+#: options.cc:597 script.cc:1133
#, c-format
msgid "%s: %s: %s\n"
msgstr ""
-#: options.cc:574
+#: options.cc:606
#, c-format
msgid "%s: -%c: %s\n"
msgstr ""
-#: output.cc:903
+#: output.cc:901
#, c-format
msgid "%s: %s: invalid alignment %lu for section \"%s\"\n"
msgstr ""
-#: output.cc:1519
+#: output.cc:1550
#, c-format
msgid "%s: %s: open: %s\n"
msgstr ""
-#: output.cc:1528
+#: output.cc:1559
#, c-format
msgid "%s: %s: lseek: %s\n"
msgstr ""
-#: output.cc:1535
+#: output.cc:1566
#, c-format
msgid "%s: %s: write: %s\n"
msgstr ""
-#: output.cc:1545
+#: output.cc:1576
#, c-format
msgid "%s: %s: mmap: %s\n"
msgstr ""
-#: output.cc:1559
+#: output.cc:1590
#, c-format
msgid "%s: %s: munmap: %s\n"
msgstr ""
-#: output.cc:1567
+#: output.cc:1598
#, c-format
msgid "%s: %s: close: %s\n"
msgstr ""
@@ -562,13 +627,13 @@ msgstr ""
msgid "%s: %s: ordinary object found in input group\n"
msgstr ""
-#: readsyms.cc:136
+#: readsyms.cc:134
#, c-format
msgid "%s: %s: file is empty\n"
msgstr ""
#. Here we have to handle any other input file types we need.
-#: readsyms.cc:149
+#: readsyms.cc:147
#, c-format
msgid "%s: %s: not an object or archive\n"
msgstr ""
@@ -593,52 +658,52 @@ msgstr ""
msgid "%s: %s: reloc section %u size %lu uneven"
msgstr ""
-#: resolve.cc:147
+#: resolve.cc:117
#, c-format
msgid "%s: %s: invalid STB_LOCAL symbol %s in external symbols\n"
msgstr ""
-#: resolve.cc:153
+#: resolve.cc:123
#, c-format
msgid "%s: %s: unsupported symbol binding %d for symbol %s\n"
msgstr ""
-#: symtab.cc:450 symtab.cc:547
+#: symtab.cc:456 symtab.cc:553
#, c-format
msgid "%s: %s: mixing 32-bit and 64-bit ELF objects\n"
msgstr ""
-#: symtab.cc:467
+#: symtab.cc:473
#, c-format
msgid "%s: %s: bad global symbol name offset %u at %lu\n"
msgstr ""
-#: symtab.cc:554
+#: symtab.cc:560
#, c-format
msgid "%s: %s: too few symbol versions\n"
msgstr ""
-#: symtab.cc:574
+#: symtab.cc:580
#, c-format
msgid "%s: %s: bad symbol name offset %u at %lu\n"
msgstr ""
-#: symtab.cc:618
+#: symtab.cc:633
#, c-format
msgid "%s: %s: versym for symbol %zu out of range: %u\n"
msgstr ""
-#: symtab.cc:626
+#: symtab.cc:641
#, c-format
msgid "%s: %s: versym for symbol %zu has no name: %u\n"
msgstr ""
-#: symtab.cc:1106 symtab.cc:1278
+#: symtab.cc:1174 symtab.cc:1346
#, c-format
msgid "%s: %s: unsupported symbol section 0x%x\n"
msgstr ""
-#: symtab.cc:1471
+#: symtab.cc:1539
#, c-format
msgid "%s: %s: warning: %s\n"
msgstr ""
diff --git a/gold/readsyms.cc b/gold/readsyms.cc
index 86828fc..5ac58bc 100644
--- a/gold/readsyms.cc
+++ b/gold/readsyms.cc
@@ -97,8 +97,7 @@ Read_symbols::run(Workqueue* workqueue)
Read_symbols_data* sd = new Read_symbols_data;
obj->read_symbols(sd);
- workqueue->queue_front(new Add_symbols(this->options_,
- this->input_objects_,
+ workqueue->queue_front(new Add_symbols(this->input_objects_,
this->symtab_, this->layout_,
obj, sd,
this->this_blocker_,
@@ -119,8 +118,7 @@ Read_symbols::run(Workqueue* workqueue)
Archive* arch = new Archive(this->input_argument_->file().name(),
input_file);
arch->setup();
- workqueue->queue(new Add_archive_symbols(this->options_,
- this->symtab_,
+ workqueue->queue(new Add_archive_symbols(this->symtab_,
this->layout_,
this->input_objects_,
arch,
@@ -182,8 +180,7 @@ Read_symbols::do_group(Workqueue* workqueue)
}
const int saw_undefined = this->symtab_->saw_undefined();
- workqueue->queue(new Finish_group(this->options_,
- this->input_objects_,
+ workqueue->queue(new Finish_group(this->input_objects_,
this->symtab_,
this->layout_,
input_group,
@@ -247,8 +244,7 @@ Add_symbols::run(Workqueue*)
}
else
{
- this->object_->layout(this->options_, this->symtab_, this->layout_,
- this->sd_);
+ this->object_->layout(this->symtab_, this->layout_, this->sd_);
this->object_->add_symbols(this->symtab_, this->sd_);
}
delete this->sd_;
@@ -297,7 +293,7 @@ Finish_group::run(Workqueue*)
{
Task_lock_obj<Archive> tl(**p);
- (*p)->add_symbols(this->options_, this->symtab_, this->layout_,
+ (*p)->add_symbols(this->symtab_, this->layout_,
this->input_objects_);
}
}
diff --git a/gold/readsyms.h b/gold/readsyms.h
index d5ada61..606b6e0 100644
--- a/gold/readsyms.h
+++ b/gold/readsyms.h
@@ -83,12 +83,12 @@ class Add_symbols : public Task
// THIS_BLOCKER is used to prevent this task from running before the
// one for the previous input file. NEXT_BLOCKER is used to prevent
// the next task from running.
- Add_symbols(const General_options& options, Input_objects* input_objects,
- Symbol_table* symtab, Layout* layout, Object* object,
+ Add_symbols(Input_objects* input_objects, Symbol_table* symtab,
+ Layout* layout, Object* object,
Read_symbols_data* sd, Task_token* this_blocker,
Task_token* next_blocker)
- : options_(options), input_objects_(input_objects), symtab_(symtab),
- layout_(layout), object_(object), sd_(sd), this_blocker_(this_blocker),
+ : input_objects_(input_objects), symtab_(symtab), layout_(layout),
+ object_(object), sd_(sd), this_blocker_(this_blocker),
next_blocker_(next_blocker)
{ }
@@ -108,7 +108,6 @@ class Add_symbols : public Task
private:
class Add_symbols_locker;
- const General_options& options_;
Input_objects* input_objects_;
Symbol_table* symtab_;
Layout* layout_;
@@ -155,11 +154,11 @@ class Input_group
class Finish_group : public Task
{
public:
- Finish_group(const General_options& options, Input_objects* input_objects,
- Symbol_table* symtab, Layout* layout, Input_group* input_group,
+ Finish_group(Input_objects* input_objects, Symbol_table* symtab,
+ Layout* layout, Input_group* input_group,
int saw_undefined, Task_token* this_blocker,
Task_token* next_blocker)
- : options_(options), input_objects_(input_objects), symtab_(symtab),
+ : input_objects_(input_objects), symtab_(symtab),
layout_(layout), input_group_(input_group),
saw_undefined_(saw_undefined), this_blocker_(this_blocker),
next_blocker_(next_blocker)
@@ -179,7 +178,6 @@ class Finish_group : public Task
run(Workqueue*);
private:
- const General_options& options_;
Input_objects* input_objects_;
Symbol_table* symtab_;
Layout* layout_;
diff --git a/gold/symtab.h b/gold/symtab.h
index 534ee0d..31a656e 100644
--- a/gold/symtab.h
+++ b/gold/symtab.h
@@ -8,6 +8,7 @@
#include <vector>
#include "elfcpp.h"
+#include "parameters.h"
#include "stringpool.h"
#include "object.h"
@@ -305,9 +306,9 @@ class Symbol
// Return true if the final value of this symbol is known at link
// time.
bool
- final_value_is_known(const General_options* options) const
+ final_value_is_known() const
{
- if (options->is_shared())
+ if (parameters->output_is_shared())
return false;
return this->source_ != FROM_OBJECT || !this->object()->is_dynamic();
}
diff --git a/gold/target.h b/gold/target.h
index 06c7c3d..17cd40b 100644
--- a/gold/target.h
+++ b/gold/target.h
@@ -91,8 +91,8 @@ class Target
// This is called to tell the target to complete any sections it is
// handling. After this all sections must have their final size.
void
- finalize_sections(const General_options* options, Layout* layout)
- { return this->do_finalize_sections(options, layout); }
+ finalize_sections(Layout* layout)
+ { return this->do_finalize_sections(layout); }
// Return a string to use to fill out a code section. This is
// basically one or more NOPS which must fill out the specified
@@ -135,7 +135,7 @@ class Target
// Virtual function which may be implemented by the child class.
virtual void
- do_finalize_sections(const General_options*, Layout*)
+ do_finalize_sections(Layout*)
{ }
// Virtual function which must be implemented by the child class if