Skip to content

Commit 940bd4c

Browse files
committed
[ELF] addSectionSymbols: simplify isec->getOutputSection(). NFC
1 parent d77f483 commit 940bd4c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lld/ELF/Writer.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -710,13 +710,13 @@ template <class ELFT> void Writer<ELFT>::addSectionSymbols() {
710710
auto *osd = dyn_cast<OutputDesc>(cmd);
711711
if (!osd)
712712
continue;
713-
OutputSection *sec = &osd->osec;
714-
auto i = llvm::find_if(sec->commands, [](SectionCommand *cmd) {
713+
OutputSection &osec = osd->osec;
714+
auto i = llvm::find_if(osec.commands, [](SectionCommand *cmd) {
715715
if (auto *isd = dyn_cast<InputSectionDescription>(cmd))
716716
return !isd->sections.empty();
717717
return false;
718718
});
719-
if (i == sec->commands.end())
719+
if (i == osec.commands.end())
720720
continue;
721721
InputSectionBase *isec = cast<InputSectionDescription>(*i)->sections[0];
722722

@@ -733,9 +733,9 @@ template <class ELFT> void Writer<ELFT>::addSectionSymbols() {
733733
// Set the symbol to be relative to the output section so that its st_value
734734
// equals the output section address. Note, there may be a gap between the
735735
// start of the output section and isec.
736-
in.symTab->addSymbol(
737-
makeDefined(isec->file, "", STB_LOCAL, /*stOther=*/0, STT_SECTION,
738-
/*value=*/0, /*size=*/0, isec->getOutputSection()));
736+
in.symTab->addSymbol(makeDefined(isec->file, "", STB_LOCAL, /*stOther=*/0,
737+
STT_SECTION,
738+
/*value=*/0, /*size=*/0, &osec));
739739
}
740740
}
741741

0 commit comments

Comments
 (0)