Don't try to find version definition index when creating an executable.
This commit is contained in:
parent
7c9a538008
commit
31365f57ae
|
@ -1366,7 +1366,8 @@ Versions::finalize(const Target* target, Symbol_table* symtab,
|
||||||
// pointers.
|
// pointers.
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
Versions::version_index(const Stringpool* dynpool, const Symbol* sym) const
|
Versions::version_index(const General_options* options,
|
||||||
|
const Stringpool* dynpool, const Symbol* sym) const
|
||||||
{
|
{
|
||||||
Stringpool::Key version_key;
|
Stringpool::Key version_key;
|
||||||
const char* version = dynpool->find(sym->version(), &version_key);
|
const char* version = dynpool->find(sym->version(), &version_key);
|
||||||
|
@ -1374,7 +1375,11 @@ Versions::version_index(const Stringpool* dynpool, const Symbol* sym) const
|
||||||
|
|
||||||
Key k;
|
Key k;
|
||||||
if (!sym->is_from_dynobj())
|
if (!sym->is_from_dynobj())
|
||||||
|
{
|
||||||
|
if (!options->is_shared())
|
||||||
|
return elfcpp::VER_NDX_GLOBAL;
|
||||||
k = Key(version_key, 0);
|
k = Key(version_key, 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Object* object = sym->object();
|
Object* object = sym->object();
|
||||||
|
@ -1399,7 +1404,8 @@ Versions::version_index(const Stringpool* dynpool, const Symbol* sym) const
|
||||||
|
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
void
|
void
|
||||||
Versions::symbol_section_contents(const Stringpool* dynpool,
|
Versions::symbol_section_contents(const General_options* options,
|
||||||
|
const Stringpool* dynpool,
|
||||||
unsigned int local_symcount,
|
unsigned int local_symcount,
|
||||||
const std::vector<Symbol*>& syms,
|
const std::vector<Symbol*>& syms,
|
||||||
unsigned char** pp,
|
unsigned char** pp,
|
||||||
|
@ -1424,7 +1430,7 @@ Versions::symbol_section_contents(const Stringpool* dynpool,
|
||||||
if (version == NULL)
|
if (version == NULL)
|
||||||
version_index = elfcpp::VER_NDX_GLOBAL;
|
version_index = elfcpp::VER_NDX_GLOBAL;
|
||||||
else
|
else
|
||||||
version_index = this->version_index(dynpool, *p);
|
version_index = this->version_index(options, dynpool, *p);
|
||||||
elfcpp::Swap<16, big_endian>::writeval(pbuf + (*p)->dynsym_index() * 2,
|
elfcpp::Swap<16, big_endian>::writeval(pbuf + (*p)->dynsym_index() * 2,
|
||||||
version_index);
|
version_index);
|
||||||
}
|
}
|
||||||
|
@ -1548,6 +1554,7 @@ class Sized_dynobj<64, true>;
|
||||||
template
|
template
|
||||||
void
|
void
|
||||||
Versions::symbol_section_contents<32, false>(
|
Versions::symbol_section_contents<32, false>(
|
||||||
|
const General_options*,
|
||||||
const Stringpool*,
|
const Stringpool*,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
const std::vector<Symbol*>&,
|
const std::vector<Symbol*>&,
|
||||||
|
@ -1560,6 +1567,7 @@ Versions::symbol_section_contents<32, false>(
|
||||||
template
|
template
|
||||||
void
|
void
|
||||||
Versions::symbol_section_contents<32, true>(
|
Versions::symbol_section_contents<32, true>(
|
||||||
|
const General_options*,
|
||||||
const Stringpool*,
|
const Stringpool*,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
const std::vector<Symbol*>&,
|
const std::vector<Symbol*>&,
|
||||||
|
@ -1572,6 +1580,7 @@ Versions::symbol_section_contents<32, true>(
|
||||||
template
|
template
|
||||||
void
|
void
|
||||||
Versions::symbol_section_contents<64, false>(
|
Versions::symbol_section_contents<64, false>(
|
||||||
|
const General_options*,
|
||||||
const Stringpool*,
|
const Stringpool*,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
const std::vector<Symbol*>&,
|
const std::vector<Symbol*>&,
|
||||||
|
@ -1584,6 +1593,7 @@ Versions::symbol_section_contents<64, false>(
|
||||||
template
|
template
|
||||||
void
|
void
|
||||||
Versions::symbol_section_contents<64, true>(
|
Versions::symbol_section_contents<64, true>(
|
||||||
|
const General_options*,
|
||||||
const Stringpool*,
|
const Stringpool*,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
const std::vector<Symbol*>&,
|
const std::vector<Symbol*>&,
|
||||||
|
|
|
@ -415,7 +415,8 @@ class Versions
|
||||||
// version section (.gnu.version).
|
// version section (.gnu.version).
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
void
|
void
|
||||||
symbol_section_contents(const Stringpool*, unsigned int local_symcount,
|
symbol_section_contents(const General_options*, const Stringpool*,
|
||||||
|
unsigned int local_symcount,
|
||||||
const std::vector<Symbol*>& syms,
|
const std::vector<Symbol*>& syms,
|
||||||
unsigned char**, unsigned int*
|
unsigned char**, unsigned int*
|
||||||
ACCEPT_SIZE_ENDIAN) const;
|
ACCEPT_SIZE_ENDIAN) const;
|
||||||
|
@ -455,7 +456,8 @@ class Versions
|
||||||
|
|
||||||
// Return the version index to use for SYM.
|
// Return the version index to use for SYM.
|
||||||
unsigned int
|
unsigned int
|
||||||
version_index(const Stringpool*, const Symbol* sym) const;
|
version_index(const General_options*, const Stringpool*,
|
||||||
|
const Symbol* sym) const;
|
||||||
|
|
||||||
// We keep a hash table mapping canonicalized name/version pairs to
|
// We keep a hash table mapping canonicalized name/version pairs to
|
||||||
// a version base.
|
// a version base.
|
||||||
|
|
|
@ -1056,8 +1056,8 @@ Layout::sized_create_version_sections(
|
||||||
unsigned char* vbuf;
|
unsigned char* vbuf;
|
||||||
unsigned int vsize;
|
unsigned int vsize;
|
||||||
versions->symbol_section_contents SELECT_SIZE_ENDIAN_NAME(size, big_endian)(
|
versions->symbol_section_contents SELECT_SIZE_ENDIAN_NAME(size, big_endian)(
|
||||||
&this->dynpool_, local_symcount, dynamic_symbols, &vbuf, &vsize
|
&this->options_, &this->dynpool_, local_symcount, dynamic_symbols,
|
||||||
SELECT_SIZE_ENDIAN(size, big_endian));
|
&vbuf, &vsize SELECT_SIZE_ENDIAN(size, big_endian));
|
||||||
|
|
||||||
Output_section_data* vdata = new Output_data_const_buffer(vbuf, vsize, 2);
|
Output_section_data* vdata = new Output_data_const_buffer(vbuf, vsize, 2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue