diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-11-04 13:20:45 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-11-04 13:20:45 +0000 |
commit | 63732f5356e04c3f340411cb2d64fdafb6c243a0 (patch) | |
tree | 2719c595d1a34023a42793cd2cda799c2825587f | |
parent | 2d2d33f1dc4c976ab41ab5fc814f2aca7fdd99d1 (diff) | |
download | bcm5719-llvm-63732f5356e04c3f340411cb2d64fdafb6c243a0.tar.gz bcm5719-llvm-63732f5356e04c3f340411cb2d64fdafb6c243a0.zip |
Add a few const qualifiers.
llvm-svn: 285996
-rw-r--r-- | lld/ELF/OutputSections.h | 2 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 19 | ||||
-rw-r--r-- | lld/ELF/Writer.h | 2 |
3 files changed, 12 insertions, 11 deletions
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 20b2881bc8c..c71c6340fe7 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -79,7 +79,7 @@ public: uintX_t getFileOffset() { return Header.sh_offset; } void setSHName(unsigned Val) { Header.sh_name = Val; } void writeHeaderTo(Elf_Shdr *SHdr); - StringRef getName() { return Name; } + StringRef getName() const { return Name; } virtual void addSection(InputSectionBase<ELFT> *C) {} virtual Kind getKind() const { return Base; } diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 6d7be2f2c92..f9f573f3bfe 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -385,7 +385,8 @@ static int getPPC64SectionRank(StringRef SectionName) { .Default(1); } -template <class ELFT> bool elf::isRelroSection(OutputSectionBase<ELFT> *Sec) { +template <class ELFT> +bool elf::isRelroSection(const OutputSectionBase<ELFT> *Sec) { if (!Config->ZRelro) return false; typename ELFT::uint Flags = Sec->getFlags(); @@ -407,8 +408,8 @@ template <class ELFT> bool elf::isRelroSection(OutputSectionBase<ELFT> *Sec) { } template <class ELFT> -static bool compareSectionsNonScript(OutputSectionBase<ELFT> *A, - OutputSectionBase<ELFT> *B) { +static bool compareSectionsNonScript(const OutputSectionBase<ELFT> *A, + const OutputSectionBase<ELFT> *B) { // Put .interp first because some loaders want to see that section // on the first page of the executable file when loaded into memory. bool AIsInterp = A->getName() == ".interp"; @@ -489,8 +490,8 @@ static bool compareSectionsNonScript(OutputSectionBase<ELFT> *A, // Output section ordering is determined by this function. template <class ELFT> -static bool compareSections(OutputSectionBase<ELFT> *A, - OutputSectionBase<ELFT> *B) { +static bool compareSections(const OutputSectionBase<ELFT> *A, + const OutputSectionBase<ELFT> *B) { // For now, put sections mentioned in a linker script first. int AIndex = Script<ELFT>::X->getSectionIndex(A->getName()); int BIndex = Script<ELFT>::X->getSectionIndex(B->getName()); @@ -1473,10 +1474,10 @@ template struct elf::PhdrEntry<ELF32BE>; template struct elf::PhdrEntry<ELF64LE>; template struct elf::PhdrEntry<ELF64BE>; -template bool elf::isRelroSection<ELF32LE>(OutputSectionBase<ELF32LE> *); -template bool elf::isRelroSection<ELF32BE>(OutputSectionBase<ELF32BE> *); -template bool elf::isRelroSection<ELF64LE>(OutputSectionBase<ELF64LE> *); -template bool elf::isRelroSection<ELF64BE>(OutputSectionBase<ELF64BE> *); +template bool elf::isRelroSection<ELF32LE>(const OutputSectionBase<ELF32LE> *); +template bool elf::isRelroSection<ELF32BE>(const OutputSectionBase<ELF32BE> *); +template bool elf::isRelroSection<ELF64LE>(const OutputSectionBase<ELF64LE> *); +template bool elf::isRelroSection<ELF64BE>(const OutputSectionBase<ELF64BE> *); template void elf::reportDiscarded<ELF32LE>(InputSectionBase<ELF32LE> *); template void elf::reportDiscarded<ELF32BE>(InputSectionBase<ELF32BE> *); diff --git a/lld/ELF/Writer.h b/lld/ELF/Writer.h index 0ec997d6109..b0d60b40077 100644 --- a/lld/ELF/Writer.h +++ b/lld/ELF/Writer.h @@ -22,7 +22,7 @@ template <class ELFT> class ObjectFile; template <class ELFT> class SymbolTable; template <class ELFT> void writeResult(); template <class ELFT> void markLive(); -template <class ELFT> bool isRelroSection(OutputSectionBase<ELFT> *Sec); +template <class ELFT> bool isRelroSection(const OutputSectionBase<ELFT> *Sec); // This describes a program header entry. // Each contains type, access flags and range of output sections that will be |