aboutsummaryrefslogtreecommitdiff
path: root/gold/symtab.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2016-12-22 14:06:24 -0800
committerCary Coutant <ccoutant@gmail.com>2016-12-22 16:00:06 -0800
commitc4d5a76223f74930add9014f2a77339eb80b737c (patch)
tree0d2d2c9a9883fd35adf73ee40f18ee8c3268e9d3 /gold/symtab.h
parent40d7d93ff412f4c34cde3daa04890d5cd2e0d9c9 (diff)
downloadgdb-c4d5a76223f74930add9014f2a77339eb80b737c.zip
gdb-c4d5a76223f74930add9014f2a77339eb80b737c.tar.gz
gdb-c4d5a76223f74930add9014f2a77339eb80b737c.tar.bz2
Fix placement of forced local symbols in the dynamic symbol table.
Gold was not placing forced-local symbols (e.g., hidden visibility) at the front of the dynamic symbol table, or including them in the count of local symbols recorded in the .dynsym section's sh_info field. gold/ * layout.cc (Layout::finalize): Track count of forced-local symbols in .dynsym. (Layout::create_symtab_sections): Add local_dynamic_count parameter; use that instead of sh_info value. (Layout::create_dynamic_symtab): Add pforced_local_dynamic_count parameter; pass it to Symtab::set_dynsym_indexes(). Include forced locals in sh_info value. Pass index of first real global to Dynobj::create_gnu_hash_table() and Dynobj::create_elf_hash_table(). * layout.h (Layout::create_symtab_sections): Add local_dynamic_count parameter. (Layout::create_dynamic_symtab): Add pforced_local_dynamic_count parameter. * symtab.cc (Symbol_table::set_dynsym_indexes): Add pforced_local_count parameter. Process forced-local symbols first and return the count. (Symbol_table::finalize): Update comments. * symtab.h (Symbol_table::set_dynsym_indexes): Add pforced_local_count parameter. (Symbol_table::first_dynamic_global_index_): Update comment. (Symbol_table::dynamic_count_): Update comment. * testsuite/Makefile.am (ifuncmod1.sh): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/ifuncmod1.sh: New shell script.
Diffstat (limited to 'gold/symtab.h')
-rw-r--r--gold/symtab.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/gold/symtab.h b/gold/symtab.h
index d0be59f..b1ab971 100644
--- a/gold/symtab.h
+++ b/gold/symtab.h
@@ -1574,12 +1574,13 @@ class Symbol_table
get_copy_source(const Symbol* sym) const;
// Set the dynamic symbol indexes. INDEX is the index of the first
- // global dynamic symbol. Pointers to the symbols are stored into
+ // global dynamic symbol. Return the count of forced-local symbols in
+ // *PFORCED_LOCAL_COUNT. Pointers to the symbols are stored into
// the vector. The names are stored into the Stringpool. This
// returns an updated dynamic symbol index.
unsigned int
- set_dynsym_indexes(unsigned int index, std::vector<Symbol*>*,
- Stringpool*, Versions*);
+ set_dynsym_indexes(unsigned int index, unsigned int* pforced_local_count,
+ 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,
@@ -1928,9 +1929,11 @@ class Symbol_table
unsigned int output_count_;
// The file offset of the global dynamic symbols, or 0 if none.
off_t dynamic_offset_;
- // The index of the first global dynamic symbol.
+ // The index of the first global dynamic symbol (including
+ // forced-local symbols).
unsigned int first_dynamic_global_index_;
- // The number of global dynamic symbols, or 0 if none.
+ // The number of global dynamic symbols (including forced-local symbols),
+ // or 0 if none.
unsigned int dynamic_count_;
// The symbol hash table.
Symbol_table_type table_;