forked from OSchip/llvm-project
[COFF] Rename variale references in comments after VariableName -> variableName change
llvm-svn: 366193
This commit is contained in:
parent
33fdf82dda
commit
2e2038b647
|
@ -31,10 +31,10 @@ namespace coff {
|
||||||
|
|
||||||
SectionChunk::SectionChunk(ObjFile *f, const coff_section *h)
|
SectionChunk::SectionChunk(ObjFile *f, const coff_section *h)
|
||||||
: Chunk(SectionKind), file(f), header(h), repl(this) {
|
: Chunk(SectionKind), file(f), header(h), repl(this) {
|
||||||
// Initialize Relocs.
|
// Initialize relocs.
|
||||||
setRelocs(file->getCOFFObj()->getRelocations(header));
|
setRelocs(file->getCOFFObj()->getRelocations(header));
|
||||||
|
|
||||||
// Initialize SectionName.
|
// Initialize sectionName.
|
||||||
StringRef sectionName;
|
StringRef sectionName;
|
||||||
if (Expected<StringRef> e = file->getCOFFObj()->getSectionName(header))
|
if (Expected<StringRef> e = file->getCOFFObj()->getSectionName(header))
|
||||||
sectionName = *e;
|
sectionName = *e;
|
||||||
|
@ -218,7 +218,7 @@ void applyArm64Addr(uint8_t *off, uint64_t s, uint64_t p, int shift) {
|
||||||
|
|
||||||
// Update the immediate field in a AARCH64 ldr, str, and add instruction.
|
// Update the immediate field in a AARCH64 ldr, str, and add instruction.
|
||||||
// Optionally limit the range of the written immediate by one or more bits
|
// Optionally limit the range of the written immediate by one or more bits
|
||||||
// (RangeLimit).
|
// (rangeLimit).
|
||||||
void applyArm64Imm(uint8_t *off, uint64_t imm, uint32_t rangeLimit) {
|
void applyArm64Imm(uint8_t *off, uint64_t imm, uint32_t rangeLimit) {
|
||||||
uint32_t orig = read32le(off);
|
uint32_t orig = read32le(off);
|
||||||
imm += (orig >> 10) & 0xFFF;
|
imm += (orig >> 10) & 0xFFF;
|
||||||
|
@ -561,7 +561,7 @@ void SectionChunk::getRuntimePseudoRelocs(
|
||||||
toString(file));
|
toString(file));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// SizeInBits is used to initialize the Flags field; currently no
|
// sizeInBits is used to initialize the Flags field; currently no
|
||||||
// other flags are defined.
|
// other flags are defined.
|
||||||
res.emplace_back(
|
res.emplace_back(
|
||||||
RuntimePseudoReloc(target, this, rel.VirtualAddress, sizeInBits));
|
RuntimePseudoReloc(target, this, rel.VirtualAddress, sizeInBits));
|
||||||
|
|
|
@ -49,7 +49,7 @@ struct Export {
|
||||||
|
|
||||||
// If an export is a form of /export:foo=dllname.bar, that means
|
// If an export is a form of /export:foo=dllname.bar, that means
|
||||||
// that foo should be exported as an alias to bar in the DLL.
|
// that foo should be exported as an alias to bar in the DLL.
|
||||||
// ForwardTo is set to "dllname.bar" part. Usually empty.
|
// forwardTo is set to "dllname.bar" part. Usually empty.
|
||||||
StringRef forwardTo;
|
StringRef forwardTo;
|
||||||
StringChunk *forwardChunk = nullptr;
|
StringChunk *forwardChunk = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -567,7 +567,7 @@ void IdataContents::create() {
|
||||||
// Create .idata contents for each DLL.
|
// Create .idata contents for each DLL.
|
||||||
for (std::vector<DefinedImportData *> &syms : v) {
|
for (std::vector<DefinedImportData *> &syms : v) {
|
||||||
// Create lookup and address tables. If they have external names,
|
// Create lookup and address tables. If they have external names,
|
||||||
// we need to create HintName chunks to store the names.
|
// we need to create hintName chunks to store the names.
|
||||||
// If they don't (if they are import-by-ordinals), we store only
|
// If they don't (if they are import-by-ordinals), we store only
|
||||||
// ordinal values to the table.
|
// ordinal values to the table.
|
||||||
size_t base = lookups.size();
|
size_t base = lookups.size();
|
||||||
|
|
|
@ -936,7 +936,7 @@ static void findKeepUniqueSections() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// link.exe replaces each %foo% in AltPath with the contents of environment
|
// link.exe replaces each %foo% in altPath with the contents of environment
|
||||||
// variable foo, and adds the two magic env vars _PDB (expands to the basename
|
// variable foo, and adds the two magic env vars _PDB (expands to the basename
|
||||||
// of pdb's output path) and _EXT (expands to the extension of the output
|
// of pdb's output path) and _EXT (expands to the extension of the output
|
||||||
// binary).
|
// binary).
|
||||||
|
@ -952,9 +952,9 @@ static void parsePDBAltPath(StringRef altPath) {
|
||||||
binaryExtension = binaryExtension.substr(1); // %_EXT% does not include '.'.
|
binaryExtension = binaryExtension.substr(1); // %_EXT% does not include '.'.
|
||||||
|
|
||||||
// Invariant:
|
// Invariant:
|
||||||
// +--------- Cursor ('a...' might be the empty string).
|
// +--------- cursor ('a...' might be the empty string).
|
||||||
// | +----- FirstMark
|
// | +----- firstMark
|
||||||
// | | +- SecondMark
|
// | | +- secondMark
|
||||||
// v v v
|
// v v v
|
||||||
// a...%...%...
|
// a...%...%...
|
||||||
size_t cursor = 0;
|
size_t cursor = 0;
|
||||||
|
|
|
@ -345,7 +345,7 @@ public:
|
||||||
// so it is safe to remove the file immediately after this function
|
// so it is safe to remove the file immediately after this function
|
||||||
// is called (you cannot remove an opened file on Windows.)
|
// is called (you cannot remove an opened file on Windows.)
|
||||||
std::unique_ptr<MemoryBuffer> getMemoryBuffer() {
|
std::unique_ptr<MemoryBuffer> getMemoryBuffer() {
|
||||||
// IsVolatileSize=true forces MemoryBuffer to not use mmap().
|
// IsVolatile=true forces MemoryBuffer to not use mmap().
|
||||||
return CHECK(MemoryBuffer::getFile(path, /*FileSize=*/-1,
|
return CHECK(MemoryBuffer::getFile(path, /*FileSize=*/-1,
|
||||||
/*RequiresNullTerminator=*/false,
|
/*RequiresNullTerminator=*/false,
|
||||||
/*IsVolatile=*/true),
|
/*IsVolatile=*/true),
|
||||||
|
|
|
@ -556,8 +556,8 @@ Optional<Symbol *> ObjFile::createDefined(
|
||||||
// The second symbol entry has the name of the comdat symbol, called the
|
// The second symbol entry has the name of the comdat symbol, called the
|
||||||
// "comdat leader".
|
// "comdat leader".
|
||||||
// When this function is called for the first symbol entry of a comdat,
|
// When this function is called for the first symbol entry of a comdat,
|
||||||
// it sets ComdatDefs and returns None, and when it's called for the second
|
// it sets comdatDefs and returns None, and when it's called for the second
|
||||||
// symbol entry it reads ComdatDefs and then sets it back to nullptr.
|
// symbol entry it reads comdatDefs and then sets it back to nullptr.
|
||||||
|
|
||||||
// Handle comdat leader.
|
// Handle comdat leader.
|
||||||
if (const coff_aux_section_definition *def = comdatDefs[sectionNumber]) {
|
if (const coff_aux_section_definition *def = comdatDefs[sectionNumber]) {
|
||||||
|
@ -626,7 +626,7 @@ ArrayRef<uint8_t> ObjFile::getDebugSection(StringRef secName) {
|
||||||
// even if the TU was compiled with no debug info. At least two records are
|
// even if the TU was compiled with no debug info. At least two records are
|
||||||
// always there. S_OBJNAME stores a 32-bit signature, which is loaded into the
|
// always there. S_OBJNAME stores a 32-bit signature, which is loaded into the
|
||||||
// PCHSignature member. S_COMPILE3 stores compile-time cmd-line flags. This is
|
// PCHSignature member. S_COMPILE3 stores compile-time cmd-line flags. This is
|
||||||
// currently used to initialize the HotPatchable member.
|
// currently used to initialize the hotPatchable member.
|
||||||
void ObjFile::initializeFlags() {
|
void ObjFile::initializeFlags() {
|
||||||
ArrayRef<uint8_t> data = getDebugSection(".debug$S");
|
ArrayRef<uint8_t> data = getDebugSection(".debug$S");
|
||||||
if (data.empty())
|
if (data.empty())
|
||||||
|
@ -764,7 +764,7 @@ void ImportFile::parse() {
|
||||||
|
|
||||||
impSym = symtab->addImportData(impName, this);
|
impSym = symtab->addImportData(impName, this);
|
||||||
// If this was a duplicate, we logged an error but may continue;
|
// If this was a duplicate, we logged an error but may continue;
|
||||||
// in this case, ImpSym is nullptr.
|
// in this case, impSym is nullptr.
|
||||||
if (!impSym)
|
if (!impSym)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ public:
|
||||||
|
|
||||||
ArrayRef<uint8_t> getDebugSection(StringRef secName);
|
ArrayRef<uint8_t> getDebugSection(StringRef secName);
|
||||||
|
|
||||||
// Returns a Symbol object for the SymbolIndex'th symbol in the
|
// Returns a Symbol object for the symbolIndex'th symbol in the
|
||||||
// underlying object file.
|
// underlying object file.
|
||||||
Symbol *getSymbol(uint32_t symbolIndex) {
|
Symbol *getSymbol(uint32_t symbolIndex) {
|
||||||
return symbols[symbolIndex];
|
return symbols[symbolIndex];
|
||||||
|
|
|
@ -119,7 +119,7 @@ public:
|
||||||
///
|
///
|
||||||
/// If the object does not use a type server PDB (compiled with /Z7), we merge
|
/// If the object does not use a type server PDB (compiled with /Z7), we merge
|
||||||
/// all the type and item records from the .debug$S stream and fill in the
|
/// all the type and item records from the .debug$S stream and fill in the
|
||||||
/// caller-provided ObjectIndexMap.
|
/// caller-provided objectIndexMap.
|
||||||
Expected<const CVIndexMap &> mergeDebugT(ObjFile *file,
|
Expected<const CVIndexMap &> mergeDebugT(ObjFile *file,
|
||||||
CVIndexMap *objectIndexMap);
|
CVIndexMap *objectIndexMap);
|
||||||
|
|
||||||
|
@ -683,7 +683,7 @@ static void translateIdSymbols(MutableArrayRef<uint8_t> &recordData,
|
||||||
|
|
||||||
TypeIndex *ti =
|
TypeIndex *ti =
|
||||||
reinterpret_cast<TypeIndex *>(content.data() + refs[0].Offset);
|
reinterpret_cast<TypeIndex *>(content.data() + refs[0].Offset);
|
||||||
// `TI` is the index of a FuncIdRecord or MemberFuncIdRecord which lives in
|
// `ti` is the index of a FuncIdRecord or MemberFuncIdRecord which lives in
|
||||||
// the IPI stream, whose `FunctionType` member refers to the TPI stream.
|
// the IPI stream, whose `FunctionType` member refers to the TPI stream.
|
||||||
// Note that LF_FUNC_ID and LF_MEMFUNC_ID have the same record layout, and
|
// Note that LF_FUNC_ID and LF_MEMFUNC_ID have the same record layout, and
|
||||||
// in both cases we just need the second type index.
|
// in both cases we just need the second type index.
|
||||||
|
@ -1729,7 +1729,7 @@ static bool findLineTable(const SectionChunk *c, uint32_t addr,
|
||||||
if (dbgC->getSectionName() != ".debug$S")
|
if (dbgC->getSectionName() != ".debug$S")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Build a mapping of SECREL relocations in DbgC that refer to C.
|
// Build a mapping of SECREL relocations in dbgC that refer to `c`.
|
||||||
DenseMap<uint32_t, uint32_t> secrels;
|
DenseMap<uint32_t, uint32_t> secrels;
|
||||||
for (const coff_relocation &r : dbgC->getRelocs()) {
|
for (const coff_relocation &r : dbgC->getRelocs()) {
|
||||||
if (r.Type != secrelReloc)
|
if (r.Type != secrelReloc)
|
||||||
|
|
|
@ -192,7 +192,7 @@ bool SymbolTable::handleMinGWAutomaticImport(Symbol *sym, StringRef name) {
|
||||||
|
|
||||||
// Replace the reference directly to a variable with a reference
|
// Replace the reference directly to a variable with a reference
|
||||||
// to the import address table instead. This obviously isn't right,
|
// to the import address table instead. This obviously isn't right,
|
||||||
// but we mark the symbol as IsRuntimePseudoReloc, and a later pass
|
// but we mark the symbol as isRuntimePseudoReloc, and a later pass
|
||||||
// will add runtime pseudo relocations for every relocation against
|
// will add runtime pseudo relocations for every relocation against
|
||||||
// this Symbol. The runtime pseudo relocation framework expects the
|
// this Symbol. The runtime pseudo relocation framework expects the
|
||||||
// reference itself to point at the IAT entry.
|
// reference itself to point at the IAT entry.
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
private:
|
private:
|
||||||
/// Inserts symbol if not already present.
|
/// Inserts symbol if not already present.
|
||||||
std::pair<Symbol *, bool> insert(StringRef name);
|
std::pair<Symbol *, bool> insert(StringRef name);
|
||||||
/// Same as insert(Name), but also sets IsUsedInRegularObj.
|
/// Same as insert(Name), but also sets isUsedInRegularObj.
|
||||||
std::pair<Symbol *, bool> insert(StringRef name, InputFile *f);
|
std::pair<Symbol *, bool> insert(StringRef name, InputFile *f);
|
||||||
|
|
||||||
std::vector<Symbol *> getSymsWithPrefix(StringRef prefix);
|
std::vector<Symbol *> getSymsWithPrefix(StringRef prefix);
|
||||||
|
|
|
@ -335,7 +335,7 @@ void OutputSection::addContributingPartialSection(PartialSection *sec) {
|
||||||
} // namespace lld
|
} // namespace lld
|
||||||
|
|
||||||
// Check whether the target address S is in range from a relocation
|
// Check whether the target address S is in range from a relocation
|
||||||
// of type RelType at address P.
|
// of type relType at address P.
|
||||||
static bool isInRange(uint16_t relType, uint64_t s, uint64_t p, int margin) {
|
static bool isInRange(uint16_t relType, uint64_t s, uint64_t p, int margin) {
|
||||||
if (config->machine == ARMNT) {
|
if (config->machine == ARMNT) {
|
||||||
int64_t diff = AbsoluteDifference(s, p + 4) + margin;
|
int64_t diff = AbsoluteDifference(s, p + 4) + margin;
|
||||||
|
@ -427,7 +427,7 @@ static bool createThunks(OutputSection *os, int margin) {
|
||||||
|
|
||||||
// The estimate of the source address P should be pretty accurate,
|
// The estimate of the source address P should be pretty accurate,
|
||||||
// but we don't know whether the target Symbol address should be
|
// but we don't know whether the target Symbol address should be
|
||||||
// offset by ThunkSize or not (or by some of ThunksSize but not all of
|
// offset by thunksSize or not (or by some of thunksSize but not all of
|
||||||
// it), giving us some uncertainty once we have added one thunk.
|
// it), giving us some uncertainty once we have added one thunk.
|
||||||
uint64_t p = sc->getRVA() + rel.VirtualAddress + thunksSize;
|
uint64_t p = sc->getRVA() + rel.VirtualAddress + thunksSize;
|
||||||
|
|
||||||
|
@ -1626,7 +1626,7 @@ void Writer::markSymbolsForRVATable(ObjFile *file,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace the absolute table symbol with a synthetic symbol pointing to
|
// Replace the absolute table symbol with a synthetic symbol pointing to
|
||||||
// TableChunk so that we can emit base relocations for it and resolve section
|
// tableChunk so that we can emit base relocations for it and resolve section
|
||||||
// relative relocations.
|
// relative relocations.
|
||||||
void Writer::maybeAddRVATable(SymbolRVASet tableSymbols, StringRef tableSym,
|
void Writer::maybeAddRVATable(SymbolRVASet tableSymbols, StringRef tableSym,
|
||||||
StringRef countSym) {
|
StringRef countSym) {
|
||||||
|
|
Loading…
Reference in New Issue