[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
Tue May 30 12:15:50 PDT 2017


Peter Smith via Phabricator <reviews at reviews.llvm.org> writes:
> +  // The Sections are sorted in order of ascending PREL31 address with the
> +  // sentinel last. We need to find the InputSection that precedes the
> +  // sentinel. By construction the Sentinel is in the last
> +  // InputSectionDescription as the InputSection that precedes it.
> +  OutputSectionCommand *C = Script->getCmd(OutSec);
> +  auto ISD = std::find_if(C->Commands.rbegin(), C->Commands.rend(),
> +                          [](const BaseCommand *Base) {
> +                            return isa<InputSectionDescription>(Base);
> +                          });
> +  auto L = cast<InputSectionDescription>(*ISD);
> +  auto Highest = std::find_if(
> +      L->Sections.rbegin(), L->Sections.rend(),
> +      [](const InputSection *IS) { return !isa<SyntheticSection>(IS); });

You know that the section is the second to last one, so you don't need
std::find_if to get it.

LGTM with that.

Cheers,
Rafael


More information about the llvm-commits mailing list