diff options
author | Fangrui Song <maskray@google.com> | 2019-07-16 05:50:45 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-07-16 05:50:45 +0000 |
commit | 16ced9e2cd51a59d27c07b1be42a130605c10d5a (patch) | |
tree | 92f1a41b222d305cf39a9fa6d93d4a948fd8b3b0 | |
parent | ab48fc5ddcdca13212da491b2c1aaa9684ba4743 (diff) |
[ELF] Fix variable names in comments after VariableName -> variableName change
Also fix some typos.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@366181 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | ELF/AArch64ErrataFix.cpp | 20 | ||||
-rw-r--r-- | ELF/AArch64ErrataFix.h | 2 | ||||
-rw-r--r-- | ELF/Arch/AArch64.cpp | 4 | ||||
-rw-r--r-- | ELF/Arch/ARM.cpp | 12 | ||||
-rw-r--r-- | ELF/Arch/RISCV.cpp | 2 | ||||
-rw-r--r-- | ELF/CallGraphSort.cpp | 6 | ||||
-rw-r--r-- | ELF/Config.h | 2 | ||||
-rw-r--r-- | ELF/Driver.cpp | 18 | ||||
-rw-r--r-- | ELF/InputFiles.cpp | 12 | ||||
-rw-r--r-- | ELF/InputFiles.h | 4 | ||||
-rw-r--r-- | ELF/InputSection.cpp | 6 | ||||
-rw-r--r-- | ELF/InputSection.h | 4 | ||||
-rw-r--r-- | ELF/LTO.cpp | 6 | ||||
-rw-r--r-- | ELF/LinkerScript.cpp | 6 | ||||
-rw-r--r-- | ELF/Relocations.cpp | 24 | ||||
-rw-r--r-- | ELF/ScriptParser.h | 2 | ||||
-rw-r--r-- | ELF/SymbolTable.cpp | 4 | ||||
-rw-r--r-- | ELF/SyntheticSections.cpp | 36 | ||||
-rw-r--r-- | ELF/SyntheticSections.h | 8 | ||||
-rw-r--r-- | ELF/Target.h | 2 | ||||
-rw-r--r-- | ELF/Thunks.cpp | 4 | ||||
-rw-r--r-- | ELF/Writer.cpp | 8 | ||||
-rw-r--r-- | test/ELF/Inputs/gdb-index-multiple-cu-2.s | 2 | ||||
-rw-r--r-- | test/ELF/gdb-index-multiple-cu-2.s | 4 | ||||
-rw-r--r-- | test/ELF/gdb-index-multiple-cu.s | 12 |
25 files changed, 104 insertions, 106 deletions
diff --git a/ELF/AArch64ErrataFix.cpp b/ELF/AArch64ErrataFix.cpp index 7473ab61c..b2eda4dcb 100644 --- a/ELF/AArch64ErrataFix.cpp +++ b/ELF/AArch64ErrataFix.cpp @@ -413,8 +413,8 @@ void lld::elf::Patch843419Section::writeTo(uint8_t *buf) { write32le(buf, read32le(patchee->data().begin() + patcheeOffset)); // Apply any relocation transferred from the original PatcheeSection. - // For a SyntheticSection Buf already has OutSecOff added, but relocateAlloc - // also adds OutSecOff so we need to subtract to avoid double counting. + // For a SyntheticSection Buf already has outSecOff added, but relocateAlloc + // also adds outSecOff so we need to subtract to avoid double counting. this->relocateAlloc(buf - outSecOff, buf - outSecOff + getSize()); // Return address is the next instruction after the one we have just copied. @@ -427,7 +427,7 @@ void AArch64Err843419Patcher::init() { // The AArch64 ABI permits data in executable sections. We must avoid scanning // this data as if it were instructions to avoid false matches. We use the // mapping symbols in the InputObjects to identify this data, caching the - // results in SectionMap so we don't have to recalculate it each pass. + // results in sectionMap so we don't have to recalculate it each pass. // The ABI Section 4.5.4 Mapping symbols; defines local symbols that describe // half open intervals [Symbol Value, Next Symbol Value) of code and data @@ -489,7 +489,7 @@ void AArch64Err843419Patcher::insertPatches( uint64_t patchUpperBound = prevIsecLimit + target->getThunkSectionSpacing(); uint64_t outSecAddr = isd.sections.front()->getParent()->addr; - // Set the OutSecOff of patches to the place where we want to insert them. + // Set the outSecOff of patches to the place where we want to insert them. // We use a similar strategy to Thunk placement. Place patches roughly // every multiple of maximum branch range. auto patchIt = patches.begin(); @@ -511,10 +511,10 @@ void AArch64Err843419Patcher::insertPatches( (*patchIt)->outSecOff = isecLimit; } - // merge all patch sections. We use the OutSecOff assigned above to + // merge all patch sections. We use the outSecOff assigned above to // determine the insertion point. This is ok as we only merge into an // InputSectionDescription once per pass, and at the end of the pass - // assignAddresses() will recalculate all the OutSecOff values. + // assignAddresses() will recalculate all the outSecOff values. std::vector<InputSection *> tmp; tmp.reserve(isd.sections.size() + patches.size()); auto mergeCmp = [](const InputSection *a, const InputSection *b) { @@ -530,8 +530,8 @@ void AArch64Err843419Patcher::insertPatches( isd.sections = std::move(tmp); } -// Given an erratum sequence that starts at address AdrpAddr, with an -// instruction that we need to patch at PatcheeOffset from the start of +// Given an erratum sequence that starts at address adrpAddr, with an +// instruction that we need to patch at patcheeOffset from the start of // InputSection IS, create a Patch843419 Section and add it to the // Patches that we need to insert. static void implementPatch(uint64_t adrpAddr, uint64_t patcheeOffset, @@ -587,10 +587,10 @@ AArch64Err843419Patcher::patchInputSectionDescription( // LLD doesn't use the erratum sequence in SyntheticSections. if (isa<SyntheticSection>(isec)) continue; - // Use SectionMap to make sure we only scan code and not inline data. + // Use sectionMap to make sure we only scan code and not inline data. // We have already sorted MapSyms in ascending order and removed consecutive // mapping symbols of the same type. Our range of executable instructions to - // scan is therefore [CodeSym->Value, DataSym->Value) or [CodeSym->Value, + // scan is therefore [codeSym->value, dataSym->value) or [codeSym->value, // section size). std::vector<const Defined *> &mapSyms = sectionMap[isec]; diff --git a/ELF/AArch64ErrataFix.h b/ELF/AArch64ErrataFix.h index e4752e7bb..0548b5875 100644 --- a/ELF/AArch64ErrataFix.h +++ b/ELF/AArch64ErrataFix.h @@ -36,7 +36,7 @@ private: void init(); - // A cache of the mapping symbols defined by the InputSecion sorted in order + // A cache of the mapping symbols defined by the InputSection sorted in order // of ascending value with redundant symbols removed. These describe // the ranges of code and data in an executable InputSection. std::map<InputSection *, std::vector<const Defined *>> sectionMap; diff --git a/ELF/Arch/AArch64.cpp b/ELF/Arch/AArch64.cpp index 9b6599be3..4d4789702 100644 --- a/ELF/Arch/AArch64.cpp +++ b/ELF/Arch/AArch64.cpp @@ -517,7 +517,7 @@ void AArch64BtiPac::writePltHeader(uint8_t *buf) const { uint64_t plt = in.plt->getVA(); if (btiHeader) { - // PltHeader is called indirectly by Plt[N]. Prefix PltData with a BTI C + // PltHeader is called indirectly by plt[N]. Prefix pltData with a BTI C // instruction. memcpy(buf, btiData, sizeof(btiData)); buf += sizeof(btiData); @@ -538,7 +538,7 @@ void AArch64BtiPac::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, int32_t index, unsigned relOff) const { // The PLT entry is of the form: - // [BtiData] AddrInst (PacBr | StdBr) [NopData] + // [btiData] addrInst (pacBr | stdBr) [nopData] const uint8_t btiData[] = { 0x5f, 0x24, 0x03, 0xd5 }; // bti c const uint8_t addrInst[] = { 0x10, 0x00, 0x00, 0x90, // adrp x16, Page(&(.plt.got[n])) diff --git a/ELF/Arch/ARM.cpp b/ELF/Arch/ARM.cpp index b69974fc7..64adc33c0 100644 --- a/ELF/Arch/ARM.cpp +++ b/ELF/Arch/ARM.cpp @@ -299,13 +299,13 @@ bool ARM::needsThunk(RelExpr expr, RelType type, const InputFile *file, uint32_t ARM::getThunkSectionSpacing() const { // The placing of pre-created ThunkSections is controlled by the value - // ThunkSectionSpacing returned by getThunkSectionSpacing(). The aim is to + // thunkSectionSpacing returned by getThunkSectionSpacing(). The aim is to // place the ThunkSection such that all branches from the InputSections // prior to the ThunkSection can reach a Thunk placed at the end of the // ThunkSection. Graphically: - // | up to ThunkSectionSpacing .text input sections | + // | up to thunkSectionSpacing .text input sections | // | ThunkSection | - // | up to ThunkSectionSpacing .text input sections | + // | up to thunkSectionSpacing .text input sections | // | ThunkSection | // Pre-created ThunkSections are spaced roughly 16MiB apart on ARMv7. This @@ -316,14 +316,14 @@ uint32_t ARM::getThunkSectionSpacing() const { // Thumb B<cc>.W range +/- 1MiB // If a branch cannot reach a pre-created ThunkSection a new one will be // created so we can handle the rare cases of a Thumb 2 conditional branch. - // We intentionally use a lower size for ThunkSectionSpacing than the maximum + // We intentionally use a lower size for thunkSectionSpacing than the maximum // branch range so the end of the ThunkSection is more likely to be within // range of the branch instruction that is furthest away. The value we shorten - // ThunkSectionSpacing by is set conservatively to allow us to create 16,384 + // thunkSectionSpacing by is set conservatively to allow us to create 16,384 // 12 byte Thunks at any offset in a ThunkSection without risk of a branch to // one of the Thunks going out of range. - // On Arm the ThunkSectionSpacing depends on the range of the Thumb Branch + // On Arm the thunkSectionSpacing depends on the range of the Thumb Branch // range. On earlier Architectures such as ARMv4, ARMv5 and ARMv6 (except // ARMv6T2) the range is +/- 4MiB. diff --git a/ELF/Arch/RISCV.cpp b/ELF/Arch/RISCV.cpp index ddd9b9f7e..6f16ade57 100644 --- a/ELF/Arch/RISCV.cpp +++ b/ELF/Arch/RISCV.cpp @@ -144,7 +144,7 @@ void RISCV::writePltHeader(uint8_t *buf) const { // 1: auipc t2, %pcrel_hi(.got.plt) // sub t1, t1, t3 // l[wd] t3, %pcrel_lo(1b)(t2); t3 = _dl_runtime_resolve - // addi t1, t1, -PltHeaderSize-12; t1 = &.plt[i] - &.plt[0] + // addi t1, t1, -pltHeaderSize-12; t1 = &.plt[i] - &.plt[0] // addi t0, t2, %pcrel_lo(1b) // srli t1, t1, (rv64?1:2); t1 = &.got.plt[i] - &.got.plt[0] // l[wd] t0, Wordsize(t0); t0 = link_map diff --git a/ELF/CallGraphSort.cpp b/ELF/CallGraphSort.cpp index c9a62f69a..9aaadd481 100644 --- a/ELF/CallGraphSort.cpp +++ b/ELF/CallGraphSort.cpp @@ -177,7 +177,7 @@ void CallGraphSort::groupClusters() { }); for (int si : sortedSecs) { - // Clusters[SI] is the same as SecToClusters[SI] here because it has not + // clusters[si] is the same as secToClusters[si] here because it has not // been merged into another cluster yet. Cluster &c = clusters[si]; @@ -233,8 +233,8 @@ DenseMap<const InputSectionBase *, int> CallGraphSort::run() { return orderMap; } - // Print the symbols ordered by C3, in the order of increasing CurOrder - // Instead of sorting all the OrderMap, just repeat the loops above. + // Print the symbols ordered by C3, in the order of increasing curOrder + // Instead of sorting all the orderMap, just repeat the loops above. for (const Cluster &c : clusters) for (int secIndex : c.sections) // Search all the symbols in the file of the section diff --git a/ELF/Config.h b/ELF/Config.h index 54991c727..ff9d3dc09 100644 --- a/ELF/Config.h +++ b/ELF/Config.h @@ -249,7 +249,7 @@ struct Configuration { // True if the target is little-endian. False if big-endian. bool isLE; - // endianness::little if IsLE is true. endianness::big otherwise. + // endianness::little if isLE is true. endianness::big otherwise. llvm::support::endianness endianness; // True if the target is the little-endian MIPS64. diff --git a/ELF/Driver.cpp b/ELF/Driver.cpp index 17c5860a0..98551d2cb 100644 --- a/ELF/Driver.cpp +++ b/ELF/Driver.cpp @@ -1255,7 +1255,7 @@ static uint64_t getCommonPageSize(opt::InputArgList &args) { warn("-z common-page-size set, but paging disabled by omagic or nmagic"); return 1; } - // CommonPageSize can't be larger than MaxPageSize. + // commonPageSize can't be larger than maxPageSize. if (val > config->maxPageSize) val = config->maxPageSize; return val; @@ -1263,7 +1263,7 @@ static uint64_t getCommonPageSize(opt::InputArgList &args) { // Parses -image-base option. static Optional<uint64_t> getImageBase(opt::InputArgList &args) { - // Because we are using "Config->MaxPageSize" here, this function has to be + // Because we are using "Config->maxPageSize" here, this function has to be // called after the variable is initialized. auto *arg = args.getLastArg(OPT_image_base); if (!arg) @@ -1406,8 +1406,8 @@ static void demoteSharedSymbols() { }); } -// The section referred to by S is considered address-significant. Set the -// KeepUnique flag on the section if appropriate. +// The section referred to by `s` is considered address-significant. Set the +// keepUnique flag on the section if appropriate. static void markAddrsig(Symbol *s) { if (auto *d = dyn_cast_or_null<Defined>(s)) if (d->section) @@ -1772,7 +1772,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) { if (args.hasArg(OPT_exclude_libs)) excludeLibs(args); - // Create ElfHeader early. We need a dummy section in + // Create elfHeader early. We need a dummy section in // addReservedSymbols to mark the created symbols as not absolute. Out::elfHeader = make<OutputSection>("", 0, SHF_ALLOC); Out::elfHeader->size = sizeof(typename ELFT::Ehdr); @@ -1854,14 +1854,14 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) { target = getTarget(); config->eflags = target->calcEFlags(); - // MaxPageSize (sometimes called abi page size) is the maximum page size that + // maxPageSize (sometimes called abi page size) is the maximum page size that // the output can be run on. For example if the OS can use 4k or 64k page - // sizes then MaxPageSize must be 64 for the output to be useable on both. + // sizes then maxPageSize must be 64k for the output to be useable on both. // All important alignment decisions must use this value. config->maxPageSize = getMaxPageSize(args); - // CommonPageSize is the most common page size that the output will be run on. + // commonPageSize is the most common page size that the output will be run on. // For example if an OS can use 4k or 64k page sizes and 4k is more common - // than 64k then CommonPageSize is set to 4k. CommonPageSize can be used for + // than 64k then commonPageSize is set to 4k. commonPageSize can be used for // optimizations such as DATA_SEGMENT_ALIGN in linker scripts. LLD's use of it // is limited to writing trap instructions on the last executable segment. config->commonPageSize = getCommonPageSize(args); diff --git a/ELF/InputFiles.cpp b/ELF/InputFiles.cpp index fda2a544a..98b88283c 100644 --- a/ELF/InputFiles.cpp +++ b/ELF/InputFiles.cpp @@ -229,7 +229,7 @@ static std::string getSrcMsgAux(ObjFile<ELFT> &file, const Symbol &sym, file.getVariableLoc(sym.getName())) return createFileLineMsg(fileLine->first, fileLine->second); - // File.SourceFile contains STT_FILE symbol, and that is a last resort. + // File.sourceFile contains STT_FILE symbol, and that is a last resort. return file.sourceFile; } @@ -269,7 +269,7 @@ template <class ELFT> void ObjFile<ELFT>::initializeDwarf() { continue; lineTables.push_back(lt); - // Loop over variable records and insert them to VariableLoc. + // Loop over variable records and insert them to variableLoc. for (const auto &entry : cu->dies()) { DWARFDie die(cu.get(), &entry); // Skip all tags that are not variables. @@ -290,7 +290,7 @@ template <class ELFT> void ObjFile<ELFT>::initializeDwarf() { // Get the line number on which the variable is declared. unsigned line = dwarf::toUnsigned(die.find(dwarf::DW_AT_decl_line), 0); - // Here we want to take the variable name to add it into VariableLoc. + // Here we want to take the variable name to add it into variableLoc. // Variable can have regular and linkage name associated. At first, we try // to get linkage name as it can be different, for example when we have // two variables in different namespaces of the same object. Use common @@ -450,7 +450,7 @@ template <class ELFT> ArrayRef<Symbol *> ObjFile<ELFT>::getGlobalSymbols() { } template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) { - // Read a section table. JustSymbols is usually false. + // Read a section table. justSymbols is usually false. if (this->justSymbols) initializeJustSymbols(); else @@ -1178,7 +1178,7 @@ static std::vector<const void *> parseVerdefs(const uint8_t *base, // We cannot determine the largest verdef identifier without inspecting // every Elf_Verdef, but both bfd and gold assign verdef identifiers // sequentially starting from 1, so we predict that the largest identifier - // will be VerdefCount. + // will be verdefCount. unsigned verdefCount = sec->sh_info; std::vector<const void *> verdefs(verdefCount + 1); @@ -1262,7 +1262,7 @@ template <class ELFT> void SharedFile::parse() { return; } - // Search for a DT_SONAME tag to initialize this->SoName. + // Search for a DT_SONAME tag to initialize this->soName. for (const Elf_Dyn &dyn : dynamicTags) { if (dyn.d_tag == DT_NEEDED) { uint64_t val = dyn.getVal(); diff --git a/ELF/InputFiles.h b/ELF/InputFiles.h index 760f72fd1..5ccc3d402 100644 --- a/ELF/InputFiles.h +++ b/ELF/InputFiles.h @@ -117,7 +117,7 @@ public: // True if this is an argument for --just-symbols. Usually false. bool justSymbols = false; - // OutSecOff of .got2 in the current file. This is used by PPC32 -fPIC/-fPIE + // outSecOff of .got2 in the current file. This is used by PPC32 -fPIC/-fPIE // to compute offsets in PLT call stubs. uint32_t ppc32Got2OutSecOff = 0; @@ -132,7 +132,7 @@ public: // [.got, .got + 0xFFFC]. bool ppc64SmallCodeModelTocRelocs = false; - // GroupId is used for --warn-backrefs which is an optional error + // groupId is used for --warn-backrefs which is an optional error // checking feature. All files within the same --{start,end}-group or // --{start,end}-lib get the same group ID. Otherwise, each file gets a new // group ID. For more info, see checkDependency() in SymbolTable.cpp. diff --git a/ELF/InputSection.cpp b/ELF/InputSection.cpp index 1ca520c37..a024ac307 100644 --- a/ELF/InputSection.cpp +++ b/ELF/InputSection.cpp @@ -206,9 +206,9 @@ OutputSection *SectionBase::getOutputSection() { return sec ? sec->getParent() : nullptr; } -// When a section is compressed, `RawData` consists with a header followed +// When a section is compressed, `rawData` consists with a header followed // by zlib-compressed data. This function parses a header to initialize -// `UncompressedSize` member and remove the header from `RawData`. +// `uncompressedSize` member and remove the header from `rawData`. void InputSectionBase::parseCompressedHeader() { using Chdr64 = typename ELF64LE::Chdr; using Chdr32 = typename ELF32LE::Chdr; @@ -306,7 +306,7 @@ std::string InputSectionBase::getLocation(uint64_t offset) { return info->FileName + ":" + std::to_string(info->Line) + ":(" + secAndOffset + ")"; - // File->SourceFile contains STT_FILE symbol that contains a + // File->sourceFile contains STT_FILE symbol that contains a // source file name. If it's missing, we use an object file name. std::string srcFile = getFile<ELFT>()->sourceFile; if (srcFile.empty()) diff --git a/ELF/InputSection.h b/ELF/InputSection.h index dcd4848a0..3a974074e 100644 --- a/ELF/InputSection.h +++ b/ELF/InputSection.h @@ -219,8 +219,8 @@ protected: mutable ArrayRef<uint8_t> rawData; - // This field stores the uncompressed size of the compressed data in RawData, - // or -1 if RawData is not compressed (either because the section wasn't + // This field stores the uncompressed size of the compressed data in rawData, + // or -1 if rawData is not compressed (either because the section wasn't // compressed in the first place, or because we ended up uncompressing it). // Since the feature is not used often, this is usually -1. mutable int64_t uncompressedSize = -1; diff --git a/ELF/LTO.cpp b/ELF/LTO.cpp index 7230cc510..28d4bfe77 100644 --- a/ELF/LTO.cpp +++ b/ELF/LTO.cpp @@ -124,11 +124,11 @@ static lto::Config createConfig() { } BitcodeCompiler::BitcodeCompiler() { - // Initialize IndexFile. + // Initialize indexFile. if (!config->thinLTOIndexOnlyArg.empty()) indexFile = openFile(config->thinLTOIndexOnlyArg); - // Initialize LTOObj. + // Initialize ltoObj. lto::ThinBackend backend; if (config->thinLTOIndexOnly) { auto onIndexWrite = [&](StringRef s) { thinIndices.erase(s); }; @@ -142,7 +142,7 @@ BitcodeCompiler::BitcodeCompiler() { ltoObj = llvm::make_unique<lto::LTO>(createConfig(), backend, config->ltoPartitions); - // Initialize UsedStartStop. + // Initialize usedStartStop. symtab->forEachSymbol([&](Symbol *sym) { StringRef s = sym->getName(); for (StringRef prefix : {"__start_", "__stop_"}) diff --git a/ELF/LinkerScript.cpp b/ELF/LinkerScript.cpp index ce0091497..49e44d780 100644 --- a/ELF/LinkerScript.cpp +++ b/ELF/LinkerScript.cpp @@ -115,7 +115,7 @@ void LinkerScript::expandMemoryRegions(uint64_t size) { if (ctx->memRegion) expandMemoryRegion(ctx->memRegion, size, ctx->memRegion->name, ctx->outSec->name); - // Only expand the LMARegion if it is different from MemRegion. + // Only expand the LMARegion if it is different from memRegion. if (ctx->lmaRegion && ctx->memRegion != ctx->lmaRegion) expandMemoryRegion(ctx->lmaRegion, size, ctx->lmaRegion->name, ctx->outSec->name); @@ -1035,8 +1035,8 @@ static uint64_t getInitialDot() { return config->imageBase ? *config->imageBase : 0; uint64_t startAddr = UINT64_MAX; - // The Sections with -T<section> have been sorted in order of ascending - // address. We must lower StartAddr if the lowest -T<section address> as + // The sections with -T<section> have been sorted in order of ascending + // address. We must lower startAddr if the lowest -T<section address> as // calls to setDot() must be monotonically increasing. for (auto &kv : config->sectionStartMap) startAddr = std::min(startAddr, kv.second); diff --git a/ELF/Relocations.cpp b/ELF/Relocations.cpp index cd7196180..ee48f4808 100644 --- a/ELF/Relocations.cpp +++ b/ELF/Relocations.cpp @@ -829,7 +829,7 @@ public: // Translates offsets in input sections to offsets in output sections. // Given offset must increase monotonically. We assume that Piece is - // sorted by InputOff. + // sorted by inputOff. uint64_t get(uint64_t off) { if (pieces.empty()) return off; @@ -859,10 +859,10 @@ static void addRelativeReloc(InputSectionBase *isec, uint64_t offsetInSec, RelType type) { Partition &part = isec->getPartition(); - // Add a relative relocation. If RelrDyn section is enabled, and the + // Add a relative relocation. If relrDyn section is enabled, and the // relocation offset is guaranteed to be even, add the relocation to - // the RelrDyn section, otherwise add it to the RelaDyn section. - // RelrDyn sections don't support odd offsets. Also, RelrDyn sections + // the relrDyn section, otherwise add it to the relaDyn section. + // relrDyn sections don't support odd offsets. Also, relrDyn sections // don't store the addend values, so we must write it to the relocated // address. if (part.relrDyn && isec->alignment >= 2 && offsetInSec % 2 == 0) { @@ -922,7 +922,7 @@ static bool canDefineSymbolInExecutable(Symbol &sym) { // executable will preempt it. // Note that we want the visibility of the shared symbol itself, not // the visibility of the symbol in the output file we are producing. That is - // why we use Sym.StOther. + // why we use Sym.stOther. if ((sym.stOther & 0x3) == STV_DEFAULT) return true; @@ -1010,7 +1010,7 @@ static void processRelocAux(InputSectionBase &sec, RelExpr expr, RelType type, // Copy relocations (for STT_OBJECT) and canonical PLT (for STT_FUNC) are only // possible in an executable. // - // Among R_ABS relocatoin types, SymbolicRel has the same size as the word + // Among R_ABS relocatoin types, symbolicRel has the same size as the word // size. Others have fewer bits and may cause runtime overflow in -pie/-shared // mode. Disallow them. if (config->shared || @@ -1237,8 +1237,8 @@ static void scanReloc(InputSectionBase &sec, OffsetGetter &getOffset, RelTy *&i, // GOT-generating or PLT-generating, the handling of an ifunc is // relatively straightforward. We create a PLT entry in Iplt, which is // usually at the end of .plt, which makes an indirect call using a - // matching GOT entry in IgotPlt, which is usually at the end of .got.plt. - // The GOT entry is relocated using an IRELATIVE relocation in RelaIplt, + // matching GOT entry in igotPlt, which is usually at the end of .got.plt. + // The GOT entry is relocated using an IRELATIVE relocation in relaIplt, // which is usually at the end of .rela.plt. Unlike most relocations in // .rela.plt, which may be evaluated lazily without -z now, dynamic // loaders evaluate IRELATIVE relocs eagerly, which means that for @@ -1274,13 +1274,13 @@ static void scanReloc(InputSectionBase &sec, OffsetGetter &getOffset, RelTy *&i, // variable containing a pointer to the ifunc) needs to be relocated in // the exact same way as a GOT entry, so we can avoid needing to make the // PLT entry canonical by translating such relocations into IRELATIVE - // relocations in the RelaIplt. + // relocations in the relaIplt. if (!sym.isInPlt()) { // Create PLT and GOTPLT slots for the symbol. sym.isInIplt = true; // Create a copy of the symbol to use as the target of the IRELATIVE - // relocation in the IgotPlt. This is in case we make the PLT canonical + // relocation in the igotPlt. This is in case we make the PLT canonical // later, which would overwrite the original symbol. // // FIXME: Creating a copy of the symbol here is a bit of a hack. All @@ -1526,7 +1526,7 @@ void ThunkCreator::mergeThunks(ArrayRef<OutputSection *> outputSections) { // ISD->ThunkSections contains all created ThunkSections, including // those inserted in previous passes. Extract the Thunks created this - // pass and order them in ascending OutSecOff. + // pass and order them in ascending outSecOff. std::vector<ThunkSection *> newThunks; for (const std::pair<ThunkSection *, uint32_t> ts : isd->thunkSections) if (ts.second == pass) @@ -1536,7 +1536,7 @@ void ThunkCreator::mergeThunks(ArrayRef<OutputSection *> outputSections) { return a->outSecOff < b->outSecOff; }); - // Merge sorted vectors of Thunks and InputSections by OutSecOff + // Merge sorted vectors of Thunks and InputSections by outSecOff std::vector<InputSection *> tmp; tmp.reserve(isd->sections.size() + newThunks.size()); diff --git a/ELF/ScriptParser.h b/ELF/ScriptParser.h index 110684761..c953fb302 100644 --- a/ELF/ScriptParser.h +++ b/ELF/ScriptParser.h @@ -16,7 +16,7 @@ namespace lld { namespace elf { // Parses a linker script. Calling this function updates -// Config and ScriptConfig. +// lld::elf::config and lld::elf::script. void readLinkerScript(MemoryBufferRef mb); // Parses a version script. diff --git a/ELF/SymbolTable.cpp b/ELF/SymbolTable.cpp index fde08064a..3faeed8c2 100644 --- a/ELF/SymbolTable.cpp +++ b/ELF/SymbolTable.cpp @@ -99,7 +99,7 @@ Symbol *SymbolTable::find(StringRef name) { return sym; } -// Initialize DemangledSyms with a map from demangled symbols to symbol +// Initialize demangledSyms with a map from demangled symbols to symbol // objects. Used to handle "extern C++" directive in version scripts. // // The map will contain all demangled symbols. That can be very large, @@ -225,7 +225,7 @@ void SymbolTable::assignWildcardVersion(SymbolVersion ver, uint16_t versionId) { b->versionId = versionId; } -// This function processes version scripts by updating VersionId +// This function processes version scripts by updating the versionId // member of symbols. // If there's only one anonymous version definition in a version // script file, the script does not actually define any symbol version, diff --git a/ELF/SyntheticSections.cpp b/ELF/SyntheticSections.cpp index 918849bd6..f6d0f190d 100644 --- a/ELF/SyntheticSections.cpp +++ b/ELF/SyntheticSections.cpp @@ -579,11 +579,9 @@ void EhFrameSection::writeTo(uint8_t *buf) { GotSection::GotSection() : SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_PROGBITS, config->wordsize, ".got") { - // PPC64 saves the ElfSym::GlobalOffsetTable .TOC. as the first entry in the - // .got. If there are no references to .TOC. in the symbol table, - // ElfSym::GlobalOffsetTable will not be defined and we won't need to save - // .TOC. in the .got. When it is defined, we increase NumEntries by the number - // of entries used to emit ElfSym::GlobalOffsetTable. + // If ElfSym::globalOffsetTable is relative to .got and is referenced, + // increase numEntries by the number of entries used to emit + // ElfSym::globalOffsetTable. if (ElfSym::globalOffsetTable && !target->gotBaseSymInGotPlt) numEntries += target->gotHeaderEntriesNum; } @@ -861,9 +859,9 @@ void MipsGotSection::build() { } else { // If this is the first time we failed to merge with the primary GOT, // MergedGots.back() will also be the primary GOT. We must make sure not - // to try to merge again with IsPrimary=false, as otherwise, if the + // to try to merge again with isPrimary=false, as otherwise, if the // inputs are just right, we could allow the primary GOT to become 1 or 2 - // words too big due to ignoring the header size. + // words bigger due to ignoring the header size. if (mergedGots.size() == 1 || !tryMergeGots(mergedGots.back(), srcGot, false)) { mergedGots.emplace_back(); @@ -888,7 +886,7 @@ void MipsGotSection::build() { for (std::pair<const OutputSection *, FileGot::PageBlock> &p : got.pagesMap) { // For each output section referenced by GOT page relocations calculate - // and save into PagesMap an upper bound of MIPS GOT entries required + // and save into pagesMap an upper bound of MIPS GOT entries required // to store page addresses of local symbols. We assume the worst case - // each 64kb page of the output section has at least one GOT relocation // against it. And take in account the case when the section intersects @@ -910,7 +908,7 @@ void MipsGotSection::build() { } } - // Update Symbol::GotIndex field to use this + // Update Symbol::gotIndex field to use this // value later in the `sortMipsSymbols` function. for (auto &p : primGot->global) p.first->gotIndex = p.second; @@ -936,7 +934,7 @@ void MipsGotSection::build() { } else { // When building a shared library we still need a dynamic relocation // for the module index. Therefore only checking for - // S->IsPreemptible is not sufficient (this happens e.g. for + // S->isPreemptible is not sufficient (this happens e.g. for // thread-locals that have been marked as local through a linker script) if (!s->isPreemptible && !config->isPic) continue; @@ -1140,7 +1138,7 @@ StringTableSection::StringTableSection(StringRef name, bool dynamic) addString(""); } -// Adds a string to the string table. If HashIt is true we hash and check for +// Adds a string to the string table. If `hashIt` is true we hash and check for // duplicates. It is optional because the name of global symbols are already // uniqued and hashing them again has a big cost for a small value: uniquing // them with some other string that happens to be the same. @@ -1335,9 +1333,9 @@ template <class ELFT> void DynamicSection<ELFT>::finalizeContents() { } // .rel[a].plt section usually consists of two parts, containing plt and // iplt relocations. It is possible to have only iplt relocations in the - // output. In that case RelaPlt is empty and have zero offset, the same offset - // as RelaIplt have. And we still want to emit proper dynamic tags for that - // case, so here we always use RelaPlt as marker for the begining of + // output. In that case relaPlt is empty and have zero offset, the same offset + // as relaIplt has. And we still want to emit proper dynamic tags for that + // case, so here we always use relaPlt as marker for the begining of // .rel[a].plt section. if (isMain && (in.relaPlt->isNeeded() || in.relaIplt->isNeeded())) { addInSec(DT_JMPREL, in.relaPlt); @@ -2365,7 +2363,7 @@ void PltSection::writeTo(uint8_t *buf) { RelocationBaseSection *relSec = isIplt ? in.relaIplt : in.relaPlt; - // The IPlt is immediately after the Plt, account for this in RelOff + // The IPlt is immediately after the Plt, account for this in relOff size_t pltOff = isIplt ? in.plt->getSize() : 0; for (size_t i = 0, e = entries.size(); i != e; ++i) { @@ -2491,9 +2489,9 @@ readPubNamesAndTypes(const LLDDwarfObj<ELFT> &obj, for (const DWARFSection *pub : {&pubNames, &pubTypes}) { DWARFDebugPubTable table(obj, *pub, config->isLE, true); for (const DWARFDebugPubTable::Set &set : table.getData()) { - // The value written into the constant pool is Kind << 24 | CuIndex. As we + // The value written into the constant pool is kind << 24 | cuIndex. As we // don't know how many compilation units precede this object to compute - // CuIndex, we compute (Kind << 24 | CuIndexInThisObject) instead, and add + // cuIndex, we compute (kind << 24 | cuIndexInThisObject) instead, and add // the number of preceding compilation units later. uint32_t i = lower_bound(cUs, set.Offset, @@ -2945,7 +2943,7 @@ void MergeTailSection::finalizeContents() { // finalize() fixed tail-optimized strings, so we can now get // offsets of strings. Get an offset for each string and save it - // to a corresponding StringPiece for easy access. + // to a corresponding SectionPiece for easy access. for (MergeInputSection *sec : sections) for (size_t i = 0, e = sec->pieces.size(); i != e; ++i) if (sec->pieces[i].live) @@ -3330,7 +3328,7 @@ bool PPC32Got2Section::isNeeded() const { void PPC32Got2Section::finalizeContents() { // PPC32 may create multiple GOT sections for -fPIC/-fPIE, one per file in - // .got2 . This function computes OutSecOff of each .got2 to be used in + // .got2 . This function computes outSecOff of each .got2 to be used in // PPC32PltCallStub::writeTo(). The purpose of this empty synthetic section is // to collect input sections named ".got2". uint32_t offset = 0; diff --git a/ELF/SyntheticSections.h b/ELF/SyntheticSections.h index ab2995554..1c4dd06e0 100644 --- a/ELF/SyntheticSections.h +++ b/ELF/SyntheticSections.h @@ -434,8 +434,8 @@ public: uint32_t getSymIndex(SymbolTableBaseSection *symTab) const; // Computes the addend of the dynamic relocation. Note that this is not the - // same as the Addend member variable as it also includes the symbol address - // if UseSymVA is true. + // same as the addend member variable as it also includes the symbol address + // if useSymVA is true. int64_t computeAddend() const; RelType type; @@ -1026,7 +1026,7 @@ private: // thunks including ARM interworking and Mips LA25 PI to non-PI thunks. class ThunkSection : public SyntheticSection { public: - // ThunkSection in OS, with desired OutSecOff of Off + // ThunkSection in OS, with desired outSecOff of Off ThunkSection(OutputSection *os, uint64_t off); // Add a newly created Thunk to this container: @@ -1044,7 +1044,7 @@ private: size_t size = 0; }; -// Used to compute OutSecOff of .got2 in each object file. This is needed to +// Used to compute outSecOff of .got2 in each object file. This is needed to // synthesize PLT entries for PPC32 Secure PLT ABI. class PPC32Got2Section final : public SyntheticSection { public: diff --git a/ELF/Target.h b/ELF/Target.h index 00c93a9c2..effa6001f 100644 --- a/ELF/Target.h +++ b/ELF/Target.h @@ -73,7 +73,7 @@ public: virtual bool adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end, uint8_t stOther) const; - // Return true if we can reach Dst from Src with Relocation RelocType + // Return true if we can reach dst from src with RelType type. virtual bool inBranchRange(RelType type, uint64_t src, uint64_t dst) const; diff --git a/ELF/Thunks.cpp b/ELF/Thunks.cpp index 32e935126..73208f932 100644 --- a/ELF/Thunks.cpp +++ b/ELF/Thunks.cpp @@ -388,7 +388,7 @@ static uint64_t getARMThunkDestVA(const Symbol &s) { } // This function returns true if the target is not Thumb and is within 2^26, and -// it has not previously returned false (see comment for MayUseShortThunk). +// it has not previously returned false (see comment for mayUseShortThunk). bool ARMThunk::getMayUseShortThunk() { if (!mayUseShortThunk) return false; @@ -426,7 +426,7 @@ bool ARMThunk::isCompatibleWith(const InputSection &isec, } // This function returns true if the target is Thumb and is within 2^25, and -// it has not previously returned false (see comment for MayUseShortThunk). +// it has not previously returned false (see comment for mayUseShortThunk). bool ThumbThunk::getMayUseShortThunk() { if (!mayUseShortThunk) return false; diff --git a/ELF/Writer.cpp b/ELF/Writer.cpp index d1dc8ef76..3cf7b0560 100644 --- a/ELF/Writer.cpp +++ b/ELF/Writer.cpp @@ -504,7 +504,7 @@ template <class ELFT> static void createSyntheticSections() { config->isRela ? ".rela.plt" : ".rel.plt", /*sort=*/false); add(in.relaPlt); - // The RelaIplt immediately follows .rel.plt (.rel.dyn for ARM) to ensure + // The relaIplt immediately follows .rel.plt (.rel.dyn for ARM) to ensure // that the IRelative relocations are processed last by the dynamic loader. // We cannot place the iplt section in .rel.dyn when Android relocation // packing is enabled because that would cause a section type mismatch. @@ -1023,7 +1023,7 @@ template <class ELFT> void Writer<ELFT>::addRelIpltSymbols() { // By default, __rela_iplt_{start,end} belong to a dummy section 0 // because .rela.plt might be empty and thus removed from output. - // We'll override Out::ElfHeader with In.RelaIplt later when we are + // We'll override Out::elfHeader with In.relaIplt later when we are // sure that .rela.plt exists in output. ElfSym::relaIpltStart = addOptionalRegular( config->isRela ? "__rela_iplt_start" : "__rel_iplt_start", @@ -1424,7 +1424,7 @@ template <class ELFT> void Writer<ELFT>::sortSections() { continue; os->sortRank = getSectionRank(os); - // We want to assign rude approximation values to OutSecOff fields + // We want to assign rude approximation values to outSecOff fields // to know the relative order of the input sections. We use it for // sorting SHF_LINK_ORDER sections. See resolveShfLinkOrder(). uint64_t i = 0; @@ -1884,7 +1884,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { finalizeSynthetic(in.partIndex); // Dynamic section must be the last one in this list and dynamic - // symbol table section (DynSymTab) must be the first one. + // symbol table section (dynSymTab) must be the first one. for (Partition &part : partitions) { finalizeSynthetic(part.armExidx); finalizeSynthetic(part.dynSymTab); diff --git a/test/ELF/Inputs/gdb-index-multiple-cu-2.s b/test/ELF/Inputs/gdb-index-multiple-cu-2.s index 80c738eab..997eb6be3 100644 --- a/test/ELF/Inputs/gdb-index-multiple-cu-2.s +++ b/test/ELF/Inputs/gdb-index-multiple-cu-2.s @@ -31,7 +31,7 @@ _start: .byte 0 .Lcu_end0: -# .debug_gnu_pubnames has just one set, associated with .Lcu_begin1 (CuIndex: 1) +# .debug_gnu_pubnames has just one set, associated with .Lcu_begin1 (cuIndex: 1) .section .debug_gnu_pubnames,"",@progbits .long .LpubNames_end0 - .LpubNames_begin0 .LpubNames_begin0: diff --git a/test/ELF/gdb-index-multiple-cu-2.s b/test/ELF/gdb-index-multiple-cu-2.s index 9cf2a0c82..063168608 100644 --- a/test/ELF/gdb-index-multiple-cu-2.s +++ b/test/ELF/gdb-index-multiple-cu-2.s @@ -4,8 +4,8 @@ # RUN: ld.lld --gdb-index %t.o %t1.o -o %t # RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s -# %t.o has 2 CUs while %t1 has 1, thus _start in %t1.o should have CuIndex 2. -# Attributes << 24 | CuIndex = 48 << 24 | 2 = 0x30000002 +# %t.o has 2 CUs while %t1 has 1, thus _start in %t1.o should have cuIndex 2. +# attributes << 24 | cuIndex = 48 << 24 | 2 = 0x30000002 # CHECK: Constant pool # CHECK-NEXT: 0(0x0): 0x30000002 diff --git a/test/ELF/gdb-index-multiple-cu.s b/test/ELF/gdb-index-multiple-cu.s index 9a8c2eae7..8702d9f39 100644 --- a/test/ELF/gdb-index-multiple-cu.s +++ b/test/ELF/gdb-index-multiple-cu.s @@ -3,10 +3,10 @@ # RUN: ld.lld --gdb-index %t.o -o %t # RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s -# CuIndexAndAttrs of _start: -# Attributes << 24 | CuIndex = 48 << 24 | 0 = 0x30000000 -# CuIndexAndAttrs of foo: -# Attributes << 24 | CuIndex = 48 << 24 | 1 = 0x30000001 +# cuIndexAndAttrs of _start: +# attributes << 24 | cuIndex = 48 << 24 | 0 = 0x30000000 +# cuIndexAndAttrs of foo: +# attributes << 24 | cuIndex = 48 << 24 | 1 = 0x30000001 # CHECK: Symbol table # CHECK-DAG: String name: _start, CU vector index: 0 # CHECK-DAG: String name: foo, CU vector index: 1 @@ -63,7 +63,7 @@ foo: # Swap sets to test the case where pubnames are in a # different order than the CUs they refer to. .section .debug_gnu_pubnames,"",@progbits - # CuIndex: 1 + # cuIndex: 1 .long .LpubNames_end1 - .LpubNames_begin1 .LpubNames_begin1: .short 2 # Version @@ -75,7 +75,7 @@ foo: .long 0 .LpubNames_end1: - # CuIndex: 0 + # cuIndex: 0 .long .LpubNames_end0 - .LpubNames_begin0 .LpubNames_begin0: .short 2 # Version |