diff options
Diffstat (limited to 'lld/lib')
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/ELFFile.h | 6 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lld/lib/ReaderWriter/ELF/ELFFile.h b/lld/lib/ReaderWriter/ELF/ELFFile.h index 60d8ce083ac..66f781a1a6e 100644 --- a/lld/lib/ReaderWriter/ELF/ELFFile.h +++ b/lld/lib/ReaderWriter/ELF/ELFFile.h @@ -383,7 +383,7 @@ protected: /// sections. They may not reference local symbols for addresses in /// the group's sections, including section symbols. /// ABI Doc : https://mentorembedded.github.io/cxx-abi/abi/prop-72-comdat.html - /// Does the atom need to be redirected using a separate undefined atom ? + /// Does the atom need to be redirected using a separate undefined atom? bool redirectReferenceUsingUndefAtom(const Elf_Sym *sourceSymbol, const Elf_Sym *targetSymbol) const; @@ -440,7 +440,7 @@ protected: /// \brief the cached options relevant while reading the ELF File bool _doStringsMerge; - /// \brief Is --wrap on ? + /// \brief Is --wrap on? bool _useWrap; /// \brief The LinkingContext. @@ -1166,7 +1166,7 @@ void ELFFile<ELFT>::createEdge(ELFDefinedAtom<ELFT> *from, from->addReference(reference); } -/// Does the atom need to be redirected using a separate undefined atom ? +/// Does the atom need to be redirected using a separate undefined atom? template <class ELFT> bool ELFFile<ELFT>::redirectReferenceUsingUndefAtom( const Elf_Sym *sourceSymbol, const Elf_Sym *targetSymbol) const { diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp index 422df403480..0c5da203dd3 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp @@ -950,7 +950,7 @@ std::error_code FileCOFF::addRelocationReferenceToAtoms() { for (const auto &sec : _obj->sections()) { const coff_section *section = _obj->getCOFFSection(sec); - // Skip there's no atom for the section. Currently we do not create any + // Skip if there's no atom for the section. Currently we do not create any // atoms for some sections, such as "debug$S", and such sections need to // be skipped here too. if (_sectionAtoms.find(section) == _sectionAtoms.end()) @@ -1056,10 +1056,13 @@ StringRef FileCOFF::ArrayRefToString(ArrayRef<uint8_t> array) { if (array.empty()) return ""; + // This is equivalent to strnlen, but we don't use the function because + // it only exists in recent POSIX standards. size_t len = 0; size_t e = array.size(); while (len < e && array[len] != '\0') ++len; + std::string *contents = new (_alloc) std::string(reinterpret_cast<const char *>(&array[0]), len); return StringRef(*contents).trim(); |

