diff options
author | Stephen Wilson <wilsons@start.ca> | 2011-03-30 16:07:05 +0000 |
---|---|---|
committer | Stephen Wilson <wilsons@start.ca> | 2011-03-30 16:07:05 +0000 |
commit | 499b40e8a7159b5099a7b7f660782cc466ad13cf (patch) | |
tree | b8f74886991279135d3745d33fccb8a7fca68f2e /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h | |
parent | e746dbf83b60a6c9d4a295d8a33803f76652845c (diff) | |
download | bcm5719-llvm-499b40e8a7159b5099a7b7f660782cc466ad13cf.tar.gz bcm5719-llvm-499b40e8a7159b5099a7b7f660782cc466ad13cf.zip |
elf: synthesize symbols for PLT entries
When populating symbol tables ObjectFileELF now generates a set of synthetic
trampoline symbols. These new symbols correspond to entries in the program
linkage table and have a (possibly mangled) name identifying the corresponding
symbol in some DSO. These symbols will be used by the DynamicLoader loader
plugin on Linux to provide thread plans when execution flows from one DSO to
another.
llvm-svn: 128550
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index 2ac4a63cbea..f442ea218ab 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -120,6 +120,10 @@ private: typedef SectionHeaderColl::iterator SectionHeaderCollIter; typedef SectionHeaderColl::const_iterator SectionHeaderCollConstIter; + typedef std::vector<elf::ELFDynamic> DynamicSymbolColl; + typedef DynamicSymbolColl::iterator DynamicSymbolCollIter; + typedef DynamicSymbolColl::const_iterator DynamicSymbolCollConstIter; + /// Version of this reader common to all plugins based on this class. static const uint32_t m_plugin_version = 1; @@ -132,6 +136,9 @@ private: /// Collection of section headers. SectionHeaderColl m_section_headers; + /// Collection of symbols from the dynamic table. + DynamicSymbolColl m_dynamic_symbols; + /// List of sections present in this ELF object file. mutable std::auto_ptr<lldb_private::SectionList> m_sections_ap; @@ -147,7 +154,7 @@ private: /// Cached value of the entry point for this module. lldb_private::Address m_entry_point_address; - + /// Returns a 1 based index of the given section header. unsigned SectionIndex(const SectionHeaderCollIter &I); @@ -175,13 +182,29 @@ private: size_t ParseDependentModules(); + /// Parses the dynamic symbol table and populates m_dynamic_symbols. The + /// vector retains the order as found in the object file. Returns the + /// number of dynamic symbols parsed. + size_t + ParseDynamicSymbols(); + /// Populates m_symtab_ap will all non-dynamic linker symbols. This method /// will parse the symbols only once. Returns the number of symbols parsed. - void + unsigned ParseSymbolTable(lldb_private::Symtab *symbol_table, - const elf::ELFSectionHeader &symtab_section, + lldb::user_id_t start_id, + const elf::ELFSectionHeader *symtab_section, lldb::user_id_t symtab_id); + /// Scans the relocation entries and adds a set of artificial symbols to the + /// given symbol table for each PLT slot. Returns the number of symbols + /// added. + unsigned + ParseTrampolineSymbols(lldb_private::Symtab *symbol_table, + lldb::user_id_t start_id, + const elf::ELFSectionHeader *rela_hdr, + lldb::user_id_t section_id); + /// Loads the section name string table into m_shstr_data. Returns the /// number of bytes constituting the table. size_t @@ -194,6 +217,14 @@ private: lldb::user_id_t GetSectionIndexByName(const char *name); + // Returns the ID of the first section that has the given type. + lldb::user_id_t + GetSectionIndexByType(unsigned type); + + /// Returns the section header with the given id or NULL. + const elf::ELFSectionHeader * + GetSectionHeaderByIndex(lldb::user_id_t id); + /// @name ELF header dump routines //@{ static void @@ -246,6 +277,14 @@ private: void DumpDependentModules(lldb_private::Stream *s); + const elf::ELFDynamic * + FindDynamicSymbol(unsigned tag); + + lldb_private::Section * + PLTSection(); + + unsigned + PLTRelocationType(); }; #endif // #ifndef liblldb_ObjectFileELF_h_ |