[PATCH] D33500: [LLD][ELF] .ARM.exidx sentinel section writeTo() should use InputSectionDescriptions.
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 17:29:24 PDT 2017
Peter Smith via Phabricator <reviews at reviews.llvm.org> writes:
> + std::vector<std::vector<InputSection *> *> Ranges =
> + Script->inputSectionRanges(OutSec->Name);
> + for (std::vector<InputSection*> *Range : Ranges)
> + for (InputSection* IS : *Range)
> + if (IS->kind() != InputSectionBase::Synthetic) {
> + InputSection *LS = cast<InputSection>(IS->getLinkOrderDep());
> + S = std::max(S, LS->OutSec->Addr + LS->getOffset(LS->getSize()));
> + }
Can't you just check the last entry? They are sorted, no?
> +// For an OutputSection S, return the InputSectionDescriptions that are
> +// associated with S. The intention is that callers can iterate over
> +// InputSectionDescription::Sections and insert sections such as Thunks.
> +std::vector<std::vector<InputSection *> *>
> +LinkerScript::inputSectionRanges(StringRef S) {
Please pass an OutputSection*, not a StringRef.
> + std::vector<std::vector<InputSection *> *> Ranges;
> + auto OutCmdPos = std::find_if(
> + Opt.Commands.begin(), Opt.Commands.end(), [=](BaseCommand *Cmd) {
> + if (auto *OSCmd = dyn_cast<OutputSectionCommand>(Cmd))
> + return (OSCmd->Name == S);
> + return false;
> + });
With an OutputSection* you can use getCmd.
Cheers,
Rafael
More information about the llvm-commits
mailing list