diff options
| author | George Rimar <grimar@accesssoftek.com> | 2017-03-14 10:24:47 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2017-03-14 10:24:47 +0000 |
| commit | d83ce1b49dac96652fb480faa9888304c78cc5e1 (patch) | |
| tree | 94b37b06d12a91e63aa3eb19962c333a52f8bb61 /lld/ELF/LinkerScript.cpp | |
| parent | 335b6bf208e176feb0401f1c4379e3e37a73fe60 (diff) | |
| download | bcm5719-llvm-d83ce1b49dac96652fb480faa9888304c78cc5e1.tar.gz bcm5719-llvm-d83ce1b49dac96652fb480faa9888304c78cc5e1.zip | |
[ELF] - Devirtualize LinkerScriptBase::getOutputSectionSize. NFC.
It does not use ELFT templates so can be non-virtual.
llvm-svn: 297727
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index bbe0e45816c..67dda41a6d6 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -91,6 +91,19 @@ OutputSection *LinkerScriptBase::getOutputSection(const Twine &Loc, return &FakeSec; } +// This function is essentially the same as getOutputSection(Name)->Size, +// but it won't print out an error message if a given section is not found. +// +// Linker script does not create an output section if its content is empty. +// We want to allow SIZEOF(.foo) where .foo is a section which happened to +// be empty. That is why this function is different from getOutputSection(). +uint64_t LinkerScriptBase::getOutputSectionSize(StringRef Name) { + for (OutputSection *Sec : *OutputSections) + if (Sec->Name == Name) + return Sec->Size; + return 0; +} + template <class ELFT> void LinkerScript<ELFT>::setDot(Expr E, const Twine &Loc, bool InSec) { uint64_t Val = E(); @@ -914,20 +927,6 @@ template <class ELFT> int LinkerScript<ELFT>::getSectionIndex(StringRef Name) { return INT_MAX; } -// This function is essentially the same as getOutputSection(Name)->Size, -// but it won't print out an error message if a given section is not found. -// -// Linker script does not create an output section if its content is empty. -// We want to allow SIZEOF(.foo) where .foo is a section which happened to -// be empty. That is why this function is different from getOutputSection(). -template <class ELFT> -uint64_t LinkerScript<ELFT>::getOutputSectionSize(StringRef Name) { - for (OutputSection *Sec : *OutputSections) - if (Sec->Name == Name) - return Sec->Size; - return 0; -} - template <class ELFT> uint64_t LinkerScript<ELFT>::getSymbolValue(const Twine &Loc, StringRef S) { if (S == ".") |

