Skip to content

Commit 47cfe8f

Browse files
committed
[ELF] Fix variable names in comments after VariableName -> variableName change
Also fix some typos. llvm-svn: 366181
1 parent 1ffceaa commit 47cfe8f

25 files changed

+104
-106
lines changed

lld/ELF/AArch64ErrataFix.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ void lld::elf::Patch843419Section::writeTo(uint8_t *buf) {
413413
write32le(buf, read32le(patchee->data().begin() + patcheeOffset));
414414

415415
// Apply any relocation transferred from the original PatcheeSection.
416-
// For a SyntheticSection Buf already has OutSecOff added, but relocateAlloc
417-
// also adds OutSecOff so we need to subtract to avoid double counting.
416+
// For a SyntheticSection Buf already has outSecOff added, but relocateAlloc
417+
// also adds outSecOff so we need to subtract to avoid double counting.
418418
this->relocateAlloc(buf - outSecOff, buf - outSecOff + getSize());
419419

420420
// Return address is the next instruction after the one we have just copied.
@@ -427,7 +427,7 @@ void AArch64Err843419Patcher::init() {
427427
// The AArch64 ABI permits data in executable sections. We must avoid scanning
428428
// this data as if it were instructions to avoid false matches. We use the
429429
// mapping symbols in the InputObjects to identify this data, caching the
430-
// results in SectionMap so we don't have to recalculate it each pass.
430+
// results in sectionMap so we don't have to recalculate it each pass.
431431

432432
// The ABI Section 4.5.4 Mapping symbols; defines local symbols that describe
433433
// half open intervals [Symbol Value, Next Symbol Value) of code and data
@@ -489,7 +489,7 @@ void AArch64Err843419Patcher::insertPatches(
489489
uint64_t patchUpperBound = prevIsecLimit + target->getThunkSectionSpacing();
490490
uint64_t outSecAddr = isd.sections.front()->getParent()->addr;
491491

492-
// Set the OutSecOff of patches to the place where we want to insert them.
492+
// Set the outSecOff of patches to the place where we want to insert them.
493493
// We use a similar strategy to Thunk placement. Place patches roughly
494494
// every multiple of maximum branch range.
495495
auto patchIt = patches.begin();
@@ -511,10 +511,10 @@ void AArch64Err843419Patcher::insertPatches(
511511
(*patchIt)->outSecOff = isecLimit;
512512
}
513513

514-
// merge all patch sections. We use the OutSecOff assigned above to
514+
// merge all patch sections. We use the outSecOff assigned above to
515515
// determine the insertion point. This is ok as we only merge into an
516516
// InputSectionDescription once per pass, and at the end of the pass
517-
// assignAddresses() will recalculate all the OutSecOff values.
517+
// assignAddresses() will recalculate all the outSecOff values.
518518
std::vector<InputSection *> tmp;
519519
tmp.reserve(isd.sections.size() + patches.size());
520520
auto mergeCmp = [](const InputSection *a, const InputSection *b) {
@@ -530,8 +530,8 @@ void AArch64Err843419Patcher::insertPatches(
530530
isd.sections = std::move(tmp);
531531
}
532532

533-
// Given an erratum sequence that starts at address AdrpAddr, with an
534-
// instruction that we need to patch at PatcheeOffset from the start of
533+
// Given an erratum sequence that starts at address adrpAddr, with an
534+
// instruction that we need to patch at patcheeOffset from the start of
535535
// InputSection IS, create a Patch843419 Section and add it to the
536536
// Patches that we need to insert.
537537
static void implementPatch(uint64_t adrpAddr, uint64_t patcheeOffset,
@@ -587,10 +587,10 @@ AArch64Err843419Patcher::patchInputSectionDescription(
587587
// LLD doesn't use the erratum sequence in SyntheticSections.
588588
if (isa<SyntheticSection>(isec))
589589
continue;
590-
// Use SectionMap to make sure we only scan code and not inline data.
590+
// Use sectionMap to make sure we only scan code and not inline data.
591591
// We have already sorted MapSyms in ascending order and removed consecutive
592592
// mapping symbols of the same type. Our range of executable instructions to
593-
// scan is therefore [CodeSym->Value, DataSym->Value) or [CodeSym->Value,
593+
// scan is therefore [codeSym->value, dataSym->value) or [codeSym->value,
594594
// section size).
595595
std::vector<const Defined *> &mapSyms = sectionMap[isec];
596596

lld/ELF/AArch64ErrataFix.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class AArch64Err843419Patcher {
3636

3737
void init();
3838

39-
// A cache of the mapping symbols defined by the InputSecion sorted in order
39+
// A cache of the mapping symbols defined by the InputSection sorted in order
4040
// of ascending value with redundant symbols removed. These describe
4141
// the ranges of code and data in an executable InputSection.
4242
std::map<InputSection *, std::vector<const Defined *>> sectionMap;

lld/ELF/Arch/AArch64.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ void AArch64BtiPac::writePltHeader(uint8_t *buf) const {
517517
uint64_t plt = in.plt->getVA();
518518

519519
if (btiHeader) {
520-
// PltHeader is called indirectly by Plt[N]. Prefix PltData with a BTI C
520+
// PltHeader is called indirectly by plt[N]. Prefix pltData with a BTI C
521521
// instruction.
522522
memcpy(buf, btiData, sizeof(btiData));
523523
buf += sizeof(btiData);
@@ -538,7 +538,7 @@ void AArch64BtiPac::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr,
538538
uint64_t pltEntryAddr, int32_t index,
539539
unsigned relOff) const {
540540
// The PLT entry is of the form:
541-
// [BtiData] AddrInst (PacBr | StdBr) [NopData]
541+
// [btiData] addrInst (pacBr | stdBr) [nopData]
542542
const uint8_t btiData[] = { 0x5f, 0x24, 0x03, 0xd5 }; // bti c
543543
const uint8_t addrInst[] = {
544544
0x10, 0x00, 0x00, 0x90, // adrp x16, Page(&(.plt.got[n]))

lld/ELF/Arch/ARM.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,13 @@ bool ARM::needsThunk(RelExpr expr, RelType type, const InputFile *file,
299299

300300
uint32_t ARM::getThunkSectionSpacing() const {
301301
// The placing of pre-created ThunkSections is controlled by the value
302-
// ThunkSectionSpacing returned by getThunkSectionSpacing(). The aim is to
302+
// thunkSectionSpacing returned by getThunkSectionSpacing(). The aim is to
303303
// place the ThunkSection such that all branches from the InputSections
304304
// prior to the ThunkSection can reach a Thunk placed at the end of the
305305
// ThunkSection. Graphically:
306-
// | up to ThunkSectionSpacing .text input sections |
306+
// | up to thunkSectionSpacing .text input sections |
307307
// | ThunkSection |
308-
// | up to ThunkSectionSpacing .text input sections |
308+
// | up to thunkSectionSpacing .text input sections |
309309
// | ThunkSection |
310310

311311
// Pre-created ThunkSections are spaced roughly 16MiB apart on ARMv7. This
@@ -316,14 +316,14 @@ uint32_t ARM::getThunkSectionSpacing() const {
316316
// Thumb B<cc>.W range +/- 1MiB
317317
// If a branch cannot reach a pre-created ThunkSection a new one will be
318318
// created so we can handle the rare cases of a Thumb 2 conditional branch.
319-
// We intentionally use a lower size for ThunkSectionSpacing than the maximum
319+
// We intentionally use a lower size for thunkSectionSpacing than the maximum
320320
// branch range so the end of the ThunkSection is more likely to be within
321321
// range of the branch instruction that is furthest away. The value we shorten
322-
// ThunkSectionSpacing by is set conservatively to allow us to create 16,384
322+
// thunkSectionSpacing by is set conservatively to allow us to create 16,384
323323
// 12 byte Thunks at any offset in a ThunkSection without risk of a branch to
324324
// one of the Thunks going out of range.
325325

326-
// On Arm the ThunkSectionSpacing depends on the range of the Thumb Branch
326+
// On Arm the thunkSectionSpacing depends on the range of the Thumb Branch
327327
// range. On earlier Architectures such as ARMv4, ARMv5 and ARMv6 (except
328328
// ARMv6T2) the range is +/- 4MiB.
329329

lld/ELF/Arch/RISCV.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void RISCV::writePltHeader(uint8_t *buf) const {
144144
// 1: auipc t2, %pcrel_hi(.got.plt)
145145
// sub t1, t1, t3
146146
// l[wd] t3, %pcrel_lo(1b)(t2); t3 = _dl_runtime_resolve
147-
// addi t1, t1, -PltHeaderSize-12; t1 = &.plt[i] - &.plt[0]
147+
// addi t1, t1, -pltHeaderSize-12; t1 = &.plt[i] - &.plt[0]
148148
// addi t0, t2, %pcrel_lo(1b)
149149
// srli t1, t1, (rv64?1:2); t1 = &.got.plt[i] - &.got.plt[0]
150150
// l[wd] t0, Wordsize(t0); t0 = link_map

lld/ELF/CallGraphSort.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void CallGraphSort::groupClusters() {
177177
});
178178

179179
for (int si : sortedSecs) {
180-
// Clusters[SI] is the same as SecToClusters[SI] here because it has not
180+
// clusters[si] is the same as secToClusters[si] here because it has not
181181
// been merged into another cluster yet.
182182
Cluster &c = clusters[si];
183183

@@ -233,8 +233,8 @@ DenseMap<const InputSectionBase *, int> CallGraphSort::run() {
233233
return orderMap;
234234
}
235235

236-
// Print the symbols ordered by C3, in the order of increasing CurOrder
237-
// Instead of sorting all the OrderMap, just repeat the loops above.
236+
// Print the symbols ordered by C3, in the order of increasing curOrder
237+
// Instead of sorting all the orderMap, just repeat the loops above.
238238
for (const Cluster &c : clusters)
239239
for (int secIndex : c.sections)
240240
// Search all the symbols in the file of the section

lld/ELF/Config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ struct Configuration {
249249
// True if the target is little-endian. False if big-endian.
250250
bool isLE;
251251

252-
// endianness::little if IsLE is true. endianness::big otherwise.
252+
// endianness::little if isLE is true. endianness::big otherwise.
253253
llvm::support::endianness endianness;
254254

255255
// True if the target is the little-endian MIPS64.

lld/ELF/Driver.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -1255,15 +1255,15 @@ static uint64_t getCommonPageSize(opt::InputArgList &args) {
12551255
warn("-z common-page-size set, but paging disabled by omagic or nmagic");
12561256
return 1;
12571257
}
1258-
// CommonPageSize can't be larger than MaxPageSize.
1258+
// commonPageSize can't be larger than maxPageSize.
12591259
if (val > config->maxPageSize)
12601260
val = config->maxPageSize;
12611261
return val;
12621262
}
12631263

12641264
// Parses -image-base option.
12651265
static Optional<uint64_t> getImageBase(opt::InputArgList &args) {
1266-
// Because we are using "Config->MaxPageSize" here, this function has to be
1266+
// Because we are using "Config->maxPageSize" here, this function has to be
12671267
// called after the variable is initialized.
12681268
auto *arg = args.getLastArg(OPT_image_base);
12691269
if (!arg)
@@ -1406,8 +1406,8 @@ static void demoteSharedSymbols() {
14061406
});
14071407
}
14081408

1409-
// The section referred to by S is considered address-significant. Set the
1410-
// KeepUnique flag on the section if appropriate.
1409+
// The section referred to by `s` is considered address-significant. Set the
1410+
// keepUnique flag on the section if appropriate.
14111411
static void markAddrsig(Symbol *s) {
14121412
if (auto *d = dyn_cast_or_null<Defined>(s))
14131413
if (d->section)
@@ -1772,7 +1772,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
17721772
if (args.hasArg(OPT_exclude_libs))
17731773
excludeLibs(args);
17741774

1775-
// Create ElfHeader early. We need a dummy section in
1775+
// Create elfHeader early. We need a dummy section in
17761776
// addReservedSymbols to mark the created symbols as not absolute.
17771777
Out::elfHeader = make<OutputSection>("", 0, SHF_ALLOC);
17781778
Out::elfHeader->size = sizeof(typename ELFT::Ehdr);
@@ -1854,14 +1854,14 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
18541854
target = getTarget();
18551855

18561856
config->eflags = target->calcEFlags();
1857-
// MaxPageSize (sometimes called abi page size) is the maximum page size that
1857+
// maxPageSize (sometimes called abi page size) is the maximum page size that
18581858
// the output can be run on. For example if the OS can use 4k or 64k page
1859-
// sizes then MaxPageSize must be 64 for the output to be useable on both.
1859+
// sizes then maxPageSize must be 64k for the output to be useable on both.
18601860
// All important alignment decisions must use this value.
18611861
config->maxPageSize = getMaxPageSize(args);
1862-
// CommonPageSize is the most common page size that the output will be run on.
1862+
// commonPageSize is the most common page size that the output will be run on.
18631863
// For example if an OS can use 4k or 64k page sizes and 4k is more common
1864-
// than 64k then CommonPageSize is set to 4k. CommonPageSize can be used for
1864+
// than 64k then commonPageSize is set to 4k. commonPageSize can be used for
18651865
// optimizations such as DATA_SEGMENT_ALIGN in linker scripts. LLD's use of it
18661866
// is limited to writing trap instructions on the last executable segment.
18671867
config->commonPageSize = getCommonPageSize(args);

lld/ELF/InputFiles.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static std::string getSrcMsgAux(ObjFile<ELFT> &file, const Symbol &sym,
229229
file.getVariableLoc(sym.getName()))
230230
return createFileLineMsg(fileLine->first, fileLine->second);
231231

232-
// File.SourceFile contains STT_FILE symbol, and that is a last resort.
232+
// File.sourceFile contains STT_FILE symbol, and that is a last resort.
233233
return file.sourceFile;
234234
}
235235

@@ -269,7 +269,7 @@ template <class ELFT> void ObjFile<ELFT>::initializeDwarf() {
269269
continue;
270270
lineTables.push_back(lt);
271271

272-
// Loop over variable records and insert them to VariableLoc.
272+
// Loop over variable records and insert them to variableLoc.
273273
for (const auto &entry : cu->dies()) {
274274
DWARFDie die(cu.get(), &entry);
275275
// Skip all tags that are not variables.
@@ -290,7 +290,7 @@ template <class ELFT> void ObjFile<ELFT>::initializeDwarf() {
290290
// Get the line number on which the variable is declared.
291291
unsigned line = dwarf::toUnsigned(die.find(dwarf::DW_AT_decl_line), 0);
292292

293-
// Here we want to take the variable name to add it into VariableLoc.
293+
// Here we want to take the variable name to add it into variableLoc.
294294
// Variable can have regular and linkage name associated. At first, we try
295295
// to get linkage name as it can be different, for example when we have
296296
// two variables in different namespaces of the same object. Use common
@@ -450,7 +450,7 @@ template <class ELFT> ArrayRef<Symbol *> ObjFile<ELFT>::getGlobalSymbols() {
450450
}
451451

452452
template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) {
453-
// Read a section table. JustSymbols is usually false.
453+
// Read a section table. justSymbols is usually false.
454454
if (this->justSymbols)
455455
initializeJustSymbols();
456456
else
@@ -1178,7 +1178,7 @@ static std::vector<const void *> parseVerdefs(const uint8_t *base,
11781178
// We cannot determine the largest verdef identifier without inspecting
11791179
// every Elf_Verdef, but both bfd and gold assign verdef identifiers
11801180
// sequentially starting from 1, so we predict that the largest identifier
1181-
// will be VerdefCount.
1181+
// will be verdefCount.
11821182
unsigned verdefCount = sec->sh_info;
11831183
std::vector<const void *> verdefs(verdefCount + 1);
11841184

@@ -1262,7 +1262,7 @@ template <class ELFT> void SharedFile::parse() {
12621262
return;
12631263
}
12641264

1265-
// Search for a DT_SONAME tag to initialize this->SoName.
1265+
// Search for a DT_SONAME tag to initialize this->soName.
12661266
for (const Elf_Dyn &dyn : dynamicTags) {
12671267
if (dyn.d_tag == DT_NEEDED) {
12681268
uint64_t val = dyn.getVal();

lld/ELF/InputFiles.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class InputFile {
117117
// True if this is an argument for --just-symbols. Usually false.
118118
bool justSymbols = false;
119119

120-
// OutSecOff of .got2 in the current file. This is used by PPC32 -fPIC/-fPIE
120+
// outSecOff of .got2 in the current file. This is used by PPC32 -fPIC/-fPIE
121121
// to compute offsets in PLT call stubs.
122122
uint32_t ppc32Got2OutSecOff = 0;
123123

@@ -132,7 +132,7 @@ class InputFile {
132132
// [.got, .got + 0xFFFC].
133133
bool ppc64SmallCodeModelTocRelocs = false;
134134

135-
// GroupId is used for --warn-backrefs which is an optional error
135+
// groupId is used for --warn-backrefs which is an optional error
136136
// checking feature. All files within the same --{start,end}-group or
137137
// --{start,end}-lib get the same group ID. Otherwise, each file gets a new
138138
// group ID. For more info, see checkDependency() in SymbolTable.cpp.

lld/ELF/InputSection.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ OutputSection *SectionBase::getOutputSection() {
206206
return sec ? sec->getParent() : nullptr;
207207
}
208208

209-
// When a section is compressed, `RawData` consists with a header followed
209+
// When a section is compressed, `rawData` consists with a header followed
210210
// by zlib-compressed data. This function parses a header to initialize
211-
// `UncompressedSize` member and remove the header from `RawData`.
211+
// `uncompressedSize` member and remove the header from `rawData`.
212212
void InputSectionBase::parseCompressedHeader() {
213213
using Chdr64 = typename ELF64LE::Chdr;
214214
using Chdr32 = typename ELF32LE::Chdr;
@@ -306,7 +306,7 @@ std::string InputSectionBase::getLocation(uint64_t offset) {
306306
return info->FileName + ":" + std::to_string(info->Line) + ":(" +
307307
secAndOffset + ")";
308308

309-
// File->SourceFile contains STT_FILE symbol that contains a
309+
// File->sourceFile contains STT_FILE symbol that contains a
310310
// source file name. If it's missing, we use an object file name.
311311
std::string srcFile = getFile<ELFT>()->sourceFile;
312312
if (srcFile.empty())

lld/ELF/InputSection.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ class InputSectionBase : public SectionBase {
219219

220220
mutable ArrayRef<uint8_t> rawData;
221221

222-
// This field stores the uncompressed size of the compressed data in RawData,
223-
// or -1 if RawData is not compressed (either because the section wasn't
222+
// This field stores the uncompressed size of the compressed data in rawData,
223+
// or -1 if rawData is not compressed (either because the section wasn't
224224
// compressed in the first place, or because we ended up uncompressing it).
225225
// Since the feature is not used often, this is usually -1.
226226
mutable int64_t uncompressedSize = -1;

lld/ELF/LTO.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ static lto::Config createConfig() {
124124
}
125125

126126
BitcodeCompiler::BitcodeCompiler() {
127-
// Initialize IndexFile.
127+
// Initialize indexFile.
128128
if (!config->thinLTOIndexOnlyArg.empty())
129129
indexFile = openFile(config->thinLTOIndexOnlyArg);
130130

131-
// Initialize LTOObj.
131+
// Initialize ltoObj.
132132
lto::ThinBackend backend;
133133
if (config->thinLTOIndexOnly) {
134134
auto onIndexWrite = [&](StringRef s) { thinIndices.erase(s); };
@@ -142,7 +142,7 @@ BitcodeCompiler::BitcodeCompiler() {
142142
ltoObj = llvm::make_unique<lto::LTO>(createConfig(), backend,
143143
config->ltoPartitions);
144144

145-
// Initialize UsedStartStop.
145+
// Initialize usedStartStop.
146146
symtab->forEachSymbol([&](Symbol *sym) {
147147
StringRef s = sym->getName();
148148
for (StringRef prefix : {"__start_", "__stop_"})

lld/ELF/LinkerScript.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void LinkerScript::expandMemoryRegions(uint64_t size) {
115115
if (ctx->memRegion)
116116
expandMemoryRegion(ctx->memRegion, size, ctx->memRegion->name,
117117
ctx->outSec->name);
118-
// Only expand the LMARegion if it is different from MemRegion.
118+
// Only expand the LMARegion if it is different from memRegion.
119119
if (ctx->lmaRegion && ctx->memRegion != ctx->lmaRegion)
120120
expandMemoryRegion(ctx->lmaRegion, size, ctx->lmaRegion->name,
121121
ctx->outSec->name);
@@ -1035,8 +1035,8 @@ static uint64_t getInitialDot() {
10351035
return config->imageBase ? *config->imageBase : 0;
10361036

10371037
uint64_t startAddr = UINT64_MAX;
1038-
// The Sections with -T<section> have been sorted in order of ascending
1039-
// address. We must lower StartAddr if the lowest -T<section address> as
1038+
// The sections with -T<section> have been sorted in order of ascending
1039+
// address. We must lower startAddr if the lowest -T<section address> as
10401040
// calls to setDot() must be monotonically increasing.
10411041
for (auto &kv : config->sectionStartMap)
10421042
startAddr = std::min(startAddr, kv.second);

0 commit comments

Comments
 (0)