[PATCH] D33496: [LLD][ELF] Move creation of .ARM.exidx sentinel before LinkerScript creation

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 11:13:40 PDT 2017


Peter Smith via Phabricator <reviews at reviews.llvm.org> writes:

>    // ARM ABI requires .ARM.exidx to be terminated by some piece of data.
>    // We have the terminater synthetic section class. Add that at the end.
>    auto *OS = dyn_cast_or_null<OutputSection>(findSection(".ARM.exidx"));
> -  if (OS && !OS->Sections.empty() && !Config->Relocatable)
> -    OS->addSection(make<ARMExidxSentinelSection>());
> +  if (!OS || OS->Sections.empty() || Config->Relocatable)
> +    return;
> +
> +  auto *Sentinel = make<ARMExidxSentinelSection>();
> +  OS->addSection(Sentinel);
> +  // If there are linker script commands existing at this point then add the
> +  // sentinel to these too.
> +  if (OutputSectionCommand *C = Script->getCmd(OS)) {
> +    auto *ISD = make<InputSectionDescription>("");
> +    ISD->Sections.push_back(Sentinel);
> +  }

We just checked that the section is not empty, so there must be an
InputSectionDescription. How about finding the last one and inserting
the sentinel into it? That way it is easier to find the section before
the sentinel in your other patch.

LGTM with that.

Cheers,
Rafael


More information about the llvm-commits mailing list