|
LLVM 24.0.0git
|
#include "llvm/BinaryFormat/MachO.h"#include "llvm/Object/ELFObjectFile.h"#include "llvm/Object/MachO.h"#include "llvm/Object/MachOUniversal.h"#include "llvm/Object/ObjectFile.h"#include "llvm/Support/DataExtractor.h"#include "llvm/Support/raw_ostream.h"#include "llvm/DebugInfo/GSYM/GsymCreator.h"#include "llvm/DebugInfo/GSYM/ObjectFileTransformer.h"#include "llvm/DebugInfo/GSYM/OutputAggregator.h"Go to the source code of this file.
Functions | |
| static std::vector< uint8_t > | getUUID (const object::ObjectFile &Obj) |
| static uint64_t | addMachOSymbolStubs (const object::MachOObjectFile &MachO, OutputAggregator &Out, GsymCreator &Gsym) |
| Create function information entries for Mach-O symbol stubs. | |
Variables | |
| constexpr uint32_t | NT_GNU_BUILD_ID_TAG = 0x03 |
|
static |
Create function information entries for Mach-O symbol stubs.
Symbol stubs are small chunks of code, all with the same fixed size, that resolves a function pointer on first call and then jumps to the resolved function on subsequent calls for functions that live in another shared library. The stubs are stored in sections whose type is S_SYMBOL_STUBS and the size of a single stub is stored in the "reserved2" field of the section header. These stubs have no entries in the symbol table of their own, so they end up being attributed to whatever function precedes them unless they are synthesized here.
The name of the function a stub jumps to is found using the indirect symbol table from the LC_DYSYMTAB load command. The "reserved1" field of the section header contains the index of the indirect symbol table entry that describes the first stub in the section, and each subsequent stub is described by the entry that follows. Each indirect symbol table entry is an index into the symbol table where the matching undefined (N_UNDF) symbol supplies the name to use for the stub. Each name gets a "symbol stub for: " prefix prepended to it so that symbolication makes it clear that the address is the stub for a function and not the function itself.
Definition at line 93 of file ObjectFileTransformer.cpp.
References llvm::gsym::GsymCreator::addFunctionInfo(), llvm::consumeError(), llvm::MachO::section::flags, llvm::MachO::section_64::flags, llvm::gsym::FunctionInfo, llvm::object::SymbolRef::getName(), llvm::gsym::GsymCreator::getNumFunctionInfos(), llvm::object::BasicSymbolRef::getRawDataRefImpl(), llvm::MachO::INDIRECT_SYMBOL_ABS, llvm::MachO::INDIRECT_SYMBOL_LOCAL, llvm::gsym::GsymCreator::insertString(), llvm::gsym::GsymCreator::IsValidTextAddress(), llvm::logAllUnhandledErrors(), llvm::MachO::N_TYPE, llvm::MachO::N_UNDF, llvm::MachO::dysymtab_command::nindirectsyms, llvm::MachO::section::reserved1, llvm::MachO::section_64::reserved1, llvm::MachO::section::reserved2, llvm::MachO::section_64::reserved2, llvm::MachO::S_SYMBOL_STUBS, llvm::MachO::SECTION_TYPE, and uint64_t.
Referenced by llvm::gsym::ObjectFileTransformer::convert().
|
static |
Definition at line 26 of file ObjectFileTransformer.cpp.
References llvm::alignTo(), llvm::consumeError(), llvm::ArrayRef< T >::data(), llvm::StringRef::data(), Decoder, llvm::dyn_cast(), E(), llvm::ArrayRef< T >::empty(), llvm::StringRef::empty(), llvm::isa(), llvm::XCOFF::NameSize, NT_GNU_BUILD_ID_TAG, llvm::Offset, llvm::ArrayRef< T >::size(), llvm::StringRef::size(), llvm::Expected< T >::takeError(), and uint64_t.
Referenced by llvm::gsym::ObjectFileTransformer::convert().
|
constexpr |
Definition at line 24 of file ObjectFileTransformer.cpp.
Referenced by getUUID().