gcc 3.2.2 and 4.1.0 portability hacks.
This commit is contained in:
parent
14b3174058
commit
91da9340cc
5 changed files with 135 additions and 103 deletions
165
gold/dynobj.cc
165
gold/dynobj.cc
|
@ -1050,7 +1050,8 @@ Dynobj::sized_create_gnu_hash_table(
|
|||
|
||||
template<int size, bool big_endian>
|
||||
unsigned char*
|
||||
Verdef::write(const Stringpool* dynpool, bool is_last, unsigned char* pb) const
|
||||
Verdef::write(const Stringpool* dynpool, bool is_last, unsigned char* pb
|
||||
ACCEPT_SIZE_ENDIAN) const
|
||||
{
|
||||
const int verdef_size = elfcpp::Elf_sizes<size>::verdef_size;
|
||||
const int verdaux_size = elfcpp::Elf_sizes<size>::verdaux_size;
|
||||
|
@ -1129,7 +1130,7 @@ Verneed::finalize(unsigned int index)
|
|||
template<int size, bool big_endian>
|
||||
unsigned char*
|
||||
Verneed::write(const Stringpool* dynpool, bool is_last,
|
||||
unsigned char* pb) const
|
||||
unsigned char* pb ACCEPT_SIZE_ENDIAN) const
|
||||
{
|
||||
const int verneed_size = elfcpp::Elf_sizes<size>::verneed_size;
|
||||
const int vernaux_size = elfcpp::Elf_sizes<size>::vernaux_size;
|
||||
|
@ -1367,12 +1368,9 @@ Versions::version_index(const Stringpool* dynpool, const Symbol* sym) const
|
|||
const char* version = dynpool->find(sym->version(), &version_key);
|
||||
gold_assert(version != NULL);
|
||||
|
||||
Version_table::const_iterator p;
|
||||
Key k;
|
||||
if (!sym->is_from_dynobj())
|
||||
{
|
||||
Key k(version_key, 0);
|
||||
p = this->version_table_.find(k);
|
||||
}
|
||||
k = Key(version_key, 0);
|
||||
else
|
||||
{
|
||||
Object* object = sym->object();
|
||||
|
@ -1383,10 +1381,10 @@ Versions::version_index(const Stringpool* dynpool, const Symbol* sym) const
|
|||
const char* filename = dynpool->find(dynobj->soname(), &filename_key);
|
||||
gold_assert(filename != NULL);
|
||||
|
||||
Key k(version_key, filename_key);
|
||||
p = this->version_table_.find(k);
|
||||
k = Key(version_key, filename_key);
|
||||
}
|
||||
|
||||
Version_table::const_iterator p = this->version_table_.find(k);
|
||||
gold_assert(p != this->version_table_.end());
|
||||
|
||||
return p->second->index();
|
||||
|
@ -1401,7 +1399,8 @@ Versions::symbol_section_contents(const Stringpool* dynpool,
|
|||
unsigned int local_symcount,
|
||||
const std::vector<Symbol*>& syms,
|
||||
unsigned char** pp,
|
||||
unsigned int* psize) const
|
||||
unsigned int* psize
|
||||
ACCEPT_SIZE_ENDIAN) const
|
||||
{
|
||||
gold_assert(this->is_finalized_);
|
||||
|
||||
|
@ -1437,7 +1436,8 @@ template<int size, bool big_endian>
|
|||
void
|
||||
Versions::def_section_contents(const Stringpool* dynpool,
|
||||
unsigned char** pp, unsigned int* psize,
|
||||
unsigned int* pentries) const
|
||||
unsigned int* pentries
|
||||
ACCEPT_SIZE_ENDIAN) const
|
||||
{
|
||||
gold_assert(this->is_finalized_);
|
||||
gold_assert(!this->defs_.empty());
|
||||
|
@ -1462,9 +1462,9 @@ Versions::def_section_contents(const Stringpool* dynpool,
|
|||
for (p = this->defs_.begin(), i = 0;
|
||||
p != this->defs_.end();
|
||||
++p, ++i)
|
||||
pb = (*p)->write<size, big_endian>(dynpool,
|
||||
i + 1 >= this->defs_.size(),
|
||||
pb);
|
||||
pb = (*p)->write SELECT_SIZE_ENDIAN_NAME(size, big_endian)(
|
||||
dynpool, i + 1 >= this->defs_.size(), pb
|
||||
SELECT_SIZE_ENDIAN(size, big_endian));
|
||||
|
||||
gold_assert(static_cast<unsigned int>(pb - pbuf) == sz);
|
||||
|
||||
|
@ -1480,7 +1480,8 @@ template<int size, bool big_endian>
|
|||
void
|
||||
Versions::need_section_contents(const Stringpool* dynpool,
|
||||
unsigned char** pp, unsigned int *psize,
|
||||
unsigned int *pentries) const
|
||||
unsigned int *pentries
|
||||
ACCEPT_SIZE_ENDIAN) const
|
||||
{
|
||||
gold_assert(this->is_finalized_);
|
||||
gold_assert(!this->needs_.empty());
|
||||
|
@ -1505,9 +1506,9 @@ Versions::need_section_contents(const Stringpool* dynpool,
|
|||
for (p = this->needs_.begin(), i = 0;
|
||||
p != this->needs_.end();
|
||||
++p, ++i)
|
||||
pb = (*p)->write<size, big_endian>(dynpool,
|
||||
i + 1 >= this->needs_.size(),
|
||||
pb);
|
||||
pb = (*p)->write SELECT_SIZE_ENDIAN_NAME(size, big_endian)(
|
||||
dynpool, i + 1 >= this->needs_.size(), pb
|
||||
SELECT_SIZE_ENDIAN(size, big_endian));
|
||||
|
||||
gold_assert(static_cast<unsigned int>(pb - pbuf) == sz);
|
||||
|
||||
|
@ -1533,90 +1534,114 @@ class Sized_dynobj<64, true>;
|
|||
|
||||
template
|
||||
void
|
||||
Versions::symbol_section_contents<32, false>(const Stringpool*,
|
||||
unsigned int,
|
||||
const std::vector<Symbol*>&,
|
||||
unsigned char**,
|
||||
unsigned int*) const;
|
||||
Versions::symbol_section_contents<32, false>(
|
||||
const Stringpool*,
|
||||
unsigned int,
|
||||
const std::vector<Symbol*>&,
|
||||
unsigned char**,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::symbol_section_contents<32, true>(const Stringpool*,
|
||||
unsigned int,
|
||||
const std::vector<Symbol*>&,
|
||||
unsigned char**,
|
||||
unsigned int*) const;
|
||||
Versions::symbol_section_contents<32, true>(
|
||||
const Stringpool*,
|
||||
unsigned int,
|
||||
const std::vector<Symbol*>&,
|
||||
unsigned char**,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::symbol_section_contents<64, false>(const Stringpool*,
|
||||
unsigned int,
|
||||
const std::vector<Symbol*>&,
|
||||
unsigned char**,
|
||||
unsigned int*) const;
|
||||
Versions::symbol_section_contents<64, false>(
|
||||
const Stringpool*,
|
||||
unsigned int,
|
||||
const std::vector<Symbol*>&,
|
||||
unsigned char**,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::symbol_section_contents<64, true>(const Stringpool*,
|
||||
unsigned int,
|
||||
const std::vector<Symbol*>&,
|
||||
unsigned char**,
|
||||
unsigned int*) const;
|
||||
Versions::symbol_section_contents<64, true>(
|
||||
const Stringpool*,
|
||||
unsigned int,
|
||||
const std::vector<Symbol*>&,
|
||||
unsigned char**,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::def_section_contents<32, false>(const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*) const;
|
||||
Versions::def_section_contents<32, false>(
|
||||
const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::def_section_contents<32, true>(const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*) const;
|
||||
Versions::def_section_contents<32, true>(
|
||||
const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::def_section_contents<64, false>(const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*) const;
|
||||
Versions::def_section_contents<64, false>(
|
||||
const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::def_section_contents<64, true>(const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*) const;
|
||||
Versions::def_section_contents<64, true>(
|
||||
const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::need_section_contents<32, false>(const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*) const;
|
||||
Versions::need_section_contents<32, false>(
|
||||
const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::need_section_contents<32, true>(const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*) const;
|
||||
Versions::need_section_contents<32, true>(
|
||||
const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::need_section_contents<64, false>(const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*) const;
|
||||
Versions::need_section_contents<64, false>(
|
||||
const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const;
|
||||
|
||||
template
|
||||
void
|
||||
Versions::need_section_contents<64, true>(const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*) const;
|
||||
Versions::need_section_contents<64, true>(
|
||||
const Stringpool*,
|
||||
unsigned char**,
|
||||
unsigned int*,
|
||||
unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const;
|
||||
|
||||
} // End namespace gold.
|
||||
|
|
|
@ -274,7 +274,8 @@ class Verdef : public Version_base
|
|||
// Write contents to buffer.
|
||||
template<int size, bool big_endian>
|
||||
unsigned char*
|
||||
write(const Stringpool*, bool is_last, unsigned char*) const;
|
||||
write(const Stringpool*, bool is_last, unsigned char*
|
||||
ACCEPT_SIZE_ENDIAN) const;
|
||||
|
||||
private:
|
||||
Verdef(const Verdef&);
|
||||
|
@ -359,7 +360,8 @@ class Verneed
|
|||
// Write contents to buffer.
|
||||
template<int size, bool big_endian>
|
||||
unsigned char*
|
||||
write(const Stringpool*, bool is_last, unsigned char*) const;
|
||||
write(const Stringpool*, bool is_last, unsigned char*
|
||||
ACCEPT_SIZE_ENDIAN) const;
|
||||
|
||||
private:
|
||||
Verneed(const Verneed&);
|
||||
|
@ -416,21 +418,24 @@ class Versions
|
|||
void
|
||||
symbol_section_contents(const Stringpool*, unsigned int local_symcount,
|
||||
const std::vector<Symbol*>& syms,
|
||||
unsigned char**, unsigned int*) const;
|
||||
unsigned char**, unsigned int*
|
||||
ACCEPT_SIZE_ENDIAN) const;
|
||||
|
||||
// Build an allocated buffer holding the contents of the version
|
||||
// definition section (.gnu.version_d).
|
||||
template<int size, bool big_endian>
|
||||
void
|
||||
def_section_contents(const Stringpool*, unsigned char**,
|
||||
unsigned int* psize, unsigned int* pentries) const;
|
||||
unsigned int* psize, unsigned int* pentries
|
||||
ACCEPT_SIZE_ENDIAN) const;
|
||||
|
||||
// Build an allocated buffer holding the contents of the version
|
||||
// reference section (.gnu.version_r).
|
||||
template<int size, bool big_endian>
|
||||
void
|
||||
need_section_contents(const Stringpool*, unsigned char**,
|
||||
unsigned int* psize, unsigned int* pentries) const;
|
||||
unsigned int* psize, unsigned int* pentries
|
||||
ACCEPT_SIZE_ENDIAN) const;
|
||||
|
||||
private:
|
||||
// The type of the list of version definitions.
|
||||
|
|
|
@ -101,12 +101,14 @@ namespace gold
|
|||
#define SELECT_SIZE_ONLY(size)
|
||||
#define ACCEPT_SIZE
|
||||
#define ACCEPT_SIZE_ONLY
|
||||
#define ACCEPT_SIZE_EXPLICIT(size)
|
||||
|
||||
#define SELECT_SIZE_ENDIAN_NAME(size, big_endian) <size, big_endian>
|
||||
#define SELECT_SIZE_ENDIAN(size, big_endian)
|
||||
#define SELECT_SIZE_ENDIAN_ONLY(size, big_endian)
|
||||
#define ACCEPT_SIZE_ENDIAN
|
||||
#define ACCEPT_SIZE_ENDIAN_ONLY
|
||||
#define ACCEPT_SIZE_ENDIAN_EXPLICIT(size, big_endian)
|
||||
|
||||
#else // !defined(HAVE_MEMBER_TEMPLATE_SPECIFICATIONS)
|
||||
|
||||
|
@ -120,6 +122,7 @@ class Select_size_endian { };
|
|||
#define SELECT_SIZE_ONLY(size) Select_size<size>()
|
||||
#define ACCEPT_SIZE , Select_size<size>
|
||||
#define ACCEPT_SIZE_ONLY Select_size<size>
|
||||
#define ACCEPT_SIZE_EXPLICIT(size) , Select_size<size>
|
||||
|
||||
#define SELECT_SIZE_ENDIAN_NAME(size, big_endian)
|
||||
#define SELECT_SIZE_ENDIAN(size, big_endian) \
|
||||
|
@ -128,6 +131,8 @@ class Select_size_endian { };
|
|||
Select_size_endian<size, big_endian>()
|
||||
#define ACCEPT_SIZE_ENDIAN , Select_size_endian<size, big_endian>
|
||||
#define ACCEPT_SIZE_ENDIAN_ONLY Select_size_endian<size, big_endian>
|
||||
#define ACCEPT_SIZE_ENDIAN_EXPLICIT(size, big_endian) \
|
||||
, Select_size_endian<size, big_endian>
|
||||
|
||||
#endif // !defined(HAVE_MEMBER_TEMPLATE_SPECIFICATIONS)
|
||||
|
||||
|
|
|
@ -979,28 +979,24 @@ Layout::create_version_sections(const Target* target, const Versions* versions,
|
|||
if (target->get_size() == 32)
|
||||
{
|
||||
if (target->is_big_endian())
|
||||
this->sized_create_version_sections<32, true>(versions,
|
||||
local_symcount,
|
||||
dynamic_symbols,
|
||||
dynstr);
|
||||
this->sized_create_version_sections SELECT_SIZE_ENDIAN_NAME(32, true)(
|
||||
versions, local_symcount, dynamic_symbols, dynstr
|
||||
SELECT_SIZE_ENDIAN(32, true));
|
||||
else
|
||||
this->sized_create_version_sections<32, false>(versions,
|
||||
local_symcount,
|
||||
dynamic_symbols,
|
||||
dynstr);
|
||||
this->sized_create_version_sections SELECT_SIZE_ENDIAN_NAME(32, false)(
|
||||
versions, local_symcount, dynamic_symbols, dynstr
|
||||
SELECT_SIZE_ENDIAN(32, false));
|
||||
}
|
||||
else if (target->get_size() == 64)
|
||||
{
|
||||
if (target->is_big_endian())
|
||||
this->sized_create_version_sections<64, true>(versions,
|
||||
local_symcount,
|
||||
dynamic_symbols,
|
||||
dynstr);
|
||||
this->sized_create_version_sections SELECT_SIZE_ENDIAN_NAME(64, true)(
|
||||
versions, local_symcount, dynamic_symbols, dynstr
|
||||
SELECT_SIZE_ENDIAN(64, true));
|
||||
else
|
||||
this->sized_create_version_sections<64, false>(versions,
|
||||
local_symcount,
|
||||
dynamic_symbols,
|
||||
dynstr);
|
||||
this->sized_create_version_sections SELECT_SIZE_ENDIAN_NAME(64, false)(
|
||||
versions, local_symcount, dynamic_symbols, dynstr
|
||||
SELECT_SIZE_ENDIAN(64, false));
|
||||
}
|
||||
else
|
||||
gold_unreachable();
|
||||
|
@ -1014,7 +1010,8 @@ Layout::sized_create_version_sections(
|
|||
const Versions* versions,
|
||||
unsigned int local_symcount,
|
||||
const std::vector<Symbol*>& dynamic_symbols,
|
||||
const Output_section* dynstr)
|
||||
const Output_section* dynstr
|
||||
ACCEPT_SIZE_ENDIAN)
|
||||
{
|
||||
const char* vname = this->namepool_.add(".gnu.version", NULL);
|
||||
Output_section* vsec = this->make_output_section(vname,
|
||||
|
@ -1023,10 +1020,9 @@ Layout::sized_create_version_sections(
|
|||
|
||||
unsigned char* vbuf;
|
||||
unsigned int vsize;
|
||||
versions->symbol_section_contents<size, big_endian>(&this->dynpool_,
|
||||
local_symcount,
|
||||
dynamic_symbols,
|
||||
&vbuf, &vsize);
|
||||
versions->symbol_section_contents SELECT_SIZE_ENDIAN_NAME(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);
|
||||
|
||||
|
@ -1047,9 +1043,9 @@ Layout::sized_create_version_sections(
|
|||
unsigned char* vdbuf;
|
||||
unsigned int vdsize;
|
||||
unsigned int vdentries;
|
||||
versions->def_section_contents<size, big_endian>(&this->dynpool_,
|
||||
&vdbuf, &vdsize,
|
||||
&vdentries);
|
||||
versions->def_section_contents SELECT_SIZE_ENDIAN_NAME(size, big_endian)(
|
||||
&this->dynpool_, &vdbuf, &vdsize, &vdentries
|
||||
SELECT_SIZE_ENDIAN(size, big_endian));
|
||||
|
||||
Output_section_data* vddata = new Output_data_const_buffer(vdbuf,
|
||||
vdsize,
|
||||
|
@ -1073,9 +1069,9 @@ Layout::sized_create_version_sections(
|
|||
unsigned char* vnbuf;
|
||||
unsigned int vnsize;
|
||||
unsigned int vnentries;
|
||||
versions->need_section_contents<size, big_endian>(&this->dynpool_,
|
||||
&vnbuf, &vnsize,
|
||||
&vnentries);
|
||||
versions->need_section_contents SELECT_SIZE_ENDIAN_NAME(size, big_endian)
|
||||
(&this->dynpool_, &vnbuf, &vnsize, &vnentries
|
||||
SELECT_SIZE_ENDIAN(size, big_endian));
|
||||
|
||||
Output_section_data* vndata = new Output_data_const_buffer(vnbuf,
|
||||
vnsize,
|
||||
|
|
|
@ -227,7 +227,8 @@ class Layout
|
|||
sized_create_version_sections(const Versions* versions,
|
||||
unsigned int local_symcount,
|
||||
const std::vector<Symbol*>& dynamic_symbols,
|
||||
const Output_section* dynstr);
|
||||
const Output_section* dynstr
|
||||
ACCEPT_SIZE_ENDIAN);
|
||||
|
||||
// Return whether to include this section in the link.
|
||||
template<int size, bool big_endian>
|
||||
|
|
Loading…
Reference in a new issue