Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // symtab.h -- the gold symbol table -*- C++ -*- | 1 // symtab.h -- the gold symbol table -*- C++ -*- |
| 2 | 2 |
| 3 // Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | 3 // Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
| 4 // Written by Ian Lance Taylor <iant@google.com>. | 4 // Written by Ian Lance Taylor <iant@google.com>. |
| 5 | 5 |
| 6 // This file is part of gold. | 6 // This file is part of gold. |
| 7 | 7 |
| 8 // This program is free software; you can redistribute it and/or modify | 8 // This program is free software; you can redistribute it and/or modify |
| 9 // it under the terms of the GNU General Public License as published by | 9 // it under the terms of the GNU General Public License as published by |
| 10 // the Free Software Foundation; either version 3 of the License, or | 10 // the Free Software Foundation; either version 3 of the License, or |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 // Return TRUE if a weak undef was resolved by a dynamic def. | 248 // Return TRUE if a weak undef was resolved by a dynamic def. |
| 249 inline bool | 249 inline bool |
| 250 is_undef_binding_weak() const | 250 is_undef_binding_weak() const |
| 251 { return this->undef_binding_weak_; } | 251 { return this->undef_binding_weak_; } |
| 252 | 252 |
| 253 // Return the non-visibility part of the st_other field. | 253 // Return the non-visibility part of the st_other field. |
| 254 unsigned char | 254 unsigned char |
| 255 nonvis() const | 255 nonvis() const |
| 256 { return this->nonvis_; } | 256 { return this->nonvis_; } |
| 257 | 257 |
| 258 // Set the non-visibility part of the st_other field. | |
| 259 void | |
| 260 set_nonvis(unsigned int nonvis) | |
| 261 { this->nonvis_ = nonvis; } | |
| 262 | |
| 258 // Return whether this symbol is a forwarder. This will never be | 263 // Return whether this symbol is a forwarder. This will never be |
| 259 // true of a symbol found in the hash table, but may be true of | 264 // true of a symbol found in the hash table, but may be true of |
| 260 // symbol pointers attached to object files. | 265 // symbol pointers attached to object files. |
| 261 bool | 266 bool |
| 262 is_forwarder() const | 267 is_forwarder() const |
| 263 { return this->is_forwarder_; } | 268 { return this->is_forwarder_; } |
| 264 | 269 |
| 265 // Mark this symbol as a forwarder. | 270 // Mark this symbol as a forwarder. |
| 266 void | 271 void |
| 267 set_forwarder() | 272 set_forwarder() |
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1558 | 1563 |
| 1559 // Dump statistical information to stderr. | 1564 // Dump statistical information to stderr. |
| 1560 void | 1565 void |
| 1561 print_stats() const; | 1566 print_stats() const; |
| 1562 | 1567 |
| 1563 // Return the version script information. | 1568 // Return the version script information. |
| 1564 const Version_script_info& | 1569 const Version_script_info& |
| 1565 version_script() const | 1570 version_script() const |
| 1566 { return version_script_; } | 1571 { return version_script_; } |
| 1567 | 1572 |
| 1573 // Return index of the first global symbol with .got entry. | |
| 1574 unsigned int | |
| 1575 global_got_index() const | |
| 1576 { return this->global_got_index_; } | |
| 1577 | |
| 1568 private: | 1578 private: |
| 1569 Symbol_table(const Symbol_table&); | 1579 Symbol_table(const Symbol_table&); |
| 1570 Symbol_table& operator=(const Symbol_table&); | 1580 Symbol_table& operator=(const Symbol_table&); |
| 1571 | 1581 |
| 1572 // The type of the list of common symbols. | 1582 // The type of the list of common symbols. |
| 1573 typedef std::vector<Symbol*> Commons_type; | 1583 typedef std::vector<Symbol*> Commons_type; |
| 1574 | 1584 |
| 1575 // The type of the symbol hash table. | 1585 // The type of the symbol hash table. |
| 1576 | 1586 |
| 1577 typedef std::pair<Stringpool::Key, Stringpool::Key> Symbol_table_key; | 1587 typedef std::pair<Stringpool::Key, Stringpool::Key> Symbol_table_key; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1880 // When we emit a COPY reloc for a symbol, we define it in an | 1890 // When we emit a COPY reloc for a symbol, we define it in an |
| 1881 // Output_data. When it's time to emit version information for it, | 1891 // Output_data. When it's time to emit version information for it, |
| 1882 // we need to know the dynamic object in which we found the original | 1892 // we need to know the dynamic object in which we found the original |
| 1883 // definition. This maps symbols with COPY relocs to the dynamic | 1893 // definition. This maps symbols with COPY relocs to the dynamic |
| 1884 // object where they were defined. | 1894 // object where they were defined. |
| 1885 Copied_symbol_dynobjs copied_symbol_dynobjs_; | 1895 Copied_symbol_dynobjs copied_symbol_dynobjs_; |
| 1886 // Information parsed from the version script, if any. | 1896 // Information parsed from the version script, if any. |
| 1887 const Version_script_info& version_script_; | 1897 const Version_script_info& version_script_; |
| 1888 Garbage_collection* gc_; | 1898 Garbage_collection* gc_; |
| 1889 Icf* icf_; | 1899 Icf* icf_; |
| 1900 // The dynamic symbol table is divided into local and global parts. | |
| 1901 // The global part of the dynamic symbol table is further divided into | |
| 1902 // two parts: symbols that do not have GOT entries associated with them | |
| 1903 // and symbols that do have GOT entries associated with them. This is | |
| 1904 // index of the first global symbol that has .got entry. | |
| 1905 unsigned int global_got_index_; | |
|
robertm
2012/05/11 21:50:50
it might be nice to also explain here why this was
| |
| 1890 }; | 1906 }; |
| 1891 | 1907 |
| 1892 // We inline get_sized_symbol for efficiency. | 1908 // We inline get_sized_symbol for efficiency. |
| 1893 | 1909 |
| 1894 template<int size> | 1910 template<int size> |
| 1895 Sized_symbol<size>* | 1911 Sized_symbol<size>* |
| 1896 Symbol_table::get_sized_symbol(Symbol* sym) const | 1912 Symbol_table::get_sized_symbol(Symbol* sym) const |
| 1897 { | 1913 { |
| 1898 gold_assert(size == parameters->target().get_size()); | 1914 gold_assert(size == parameters->target().get_size()); |
| 1899 return static_cast<Sized_symbol<size>*>(sym); | 1915 return static_cast<Sized_symbol<size>*>(sym); |
| 1900 } | 1916 } |
| 1901 | 1917 |
| 1902 template<int size> | 1918 template<int size> |
| 1903 const Sized_symbol<size>* | 1919 const Sized_symbol<size>* |
| 1904 Symbol_table::get_sized_symbol(const Symbol* sym) const | 1920 Symbol_table::get_sized_symbol(const Symbol* sym) const |
| 1905 { | 1921 { |
| 1906 gold_assert(size == parameters->target().get_size()); | 1922 gold_assert(size == parameters->target().get_size()); |
| 1907 return static_cast<const Sized_symbol<size>*>(sym); | 1923 return static_cast<const Sized_symbol<size>*>(sym); |
| 1908 } | 1924 } |
| 1909 | 1925 |
| 1910 } // End namespace gold. | 1926 } // End namespace gold. |
| 1911 | 1927 |
| 1912 #endif // !defined(GOLD_SYMTAB_H) | 1928 #endif // !defined(GOLD_SYMTAB_H) |
| OLD | NEW |