Remove another use of section names. NFC.

llvm-svn: 302671
This commit is contained in:
Rafael Espindola 2017-05-10 14:28:31 +00:00
parent 6f4cdb8912
commit 2c923c2c37
2 changed files with 6 additions and 7 deletions

View File

@ -1004,7 +1004,7 @@ std::vector<PhdrEntry> LinkerScript::createPhdrs() {
break;
// Assign headers specified by linker script
for (size_t Id : getPhdrIndices(Sec->Name)) {
for (size_t Id : getPhdrIndices(Sec)) {
Ret[Id].add(Sec);
if (Opt.PhdrsCommands[Id].Flags == UINT_MAX)
Ret[Id].p_flags |= Sec->getPhdrFlags();
@ -1084,13 +1084,12 @@ ExprValue LinkerScript::getSymbolValue(const Twine &Loc, StringRef S) {
bool LinkerScript::isDefined(StringRef S) { return findSymbol(S) != nullptr; }
// Returns indices of ELF headers containing specific section, identified
// by Name. Each index is a zero based number of ELF header listed within
// PHDRS {} script block.
std::vector<size_t> LinkerScript::getPhdrIndices(StringRef SectionName) {
// Returns indices of ELF headers containing specific section. Each index is a
// zero based number of ELF header listed within PHDRS {} script block.
std::vector<size_t> LinkerScript::getPhdrIndices(OutputSection *Sec) {
for (BaseCommand *Base : Opt.Commands) {
auto *Cmd = dyn_cast<OutputSectionCommand>(Base);
if (!Cmd || Cmd->Name != SectionName)
if (!Cmd || Cmd->Sec != Sec)
continue;
std::vector<size_t> Ret;

View File

@ -222,7 +222,7 @@ protected:
std::vector<InputSectionBase *>
createInputSectionList(OutputSectionCommand &Cmd);
std::vector<size_t> getPhdrIndices(StringRef SectionName);
std::vector<size_t> getPhdrIndices(OutputSection *Sec);
size_t getPhdrIndex(const Twine &Loc, StringRef PhdrName);
MemoryRegion *findMemoryRegion(OutputSectionCommand *Cmd);