mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-14 20:22:30 +00:00
[ELF] addSectionSymbols: simplify isec->getOutputSection(). NFC
This commit is contained in:
parent
d77f483640
commit
940bd4c771
@ -710,13 +710,13 @@ template <class ELFT> void Writer<ELFT>::addSectionSymbols() {
|
|||||||
auto *osd = dyn_cast<OutputDesc>(cmd);
|
auto *osd = dyn_cast<OutputDesc>(cmd);
|
||||||
if (!osd)
|
if (!osd)
|
||||||
continue;
|
continue;
|
||||||
OutputSection *sec = &osd->osec;
|
OutputSection &osec = osd->osec;
|
||||||
auto i = llvm::find_if(sec->commands, [](SectionCommand *cmd) {
|
auto i = llvm::find_if(osec.commands, [](SectionCommand *cmd) {
|
||||||
if (auto *isd = dyn_cast<InputSectionDescription>(cmd))
|
if (auto *isd = dyn_cast<InputSectionDescription>(cmd))
|
||||||
return !isd->sections.empty();
|
return !isd->sections.empty();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
if (i == sec->commands.end())
|
if (i == osec.commands.end())
|
||||||
continue;
|
continue;
|
||||||
InputSectionBase *isec = cast<InputSectionDescription>(*i)->sections[0];
|
InputSectionBase *isec = cast<InputSectionDescription>(*i)->sections[0];
|
||||||
|
|
||||||
@ -733,9 +733,9 @@ template <class ELFT> void Writer<ELFT>::addSectionSymbols() {
|
|||||||
// Set the symbol to be relative to the output section so that its st_value
|
// Set the symbol to be relative to the output section so that its st_value
|
||||||
// equals the output section address. Note, there may be a gap between the
|
// equals the output section address. Note, there may be a gap between the
|
||||||
// start of the output section and isec.
|
// start of the output section and isec.
|
||||||
in.symTab->addSymbol(
|
in.symTab->addSymbol(makeDefined(isec->file, "", STB_LOCAL, /*stOther=*/0,
|
||||||
makeDefined(isec->file, "", STB_LOCAL, /*stOther=*/0, STT_SECTION,
|
STT_SECTION,
|
||||||
/*value=*/0, /*size=*/0, isec->getOutputSection()));
|
/*value=*/0, /*size=*/0, &osec));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user