[PATCH] D15453: [ELF] - refactor of code in RelocationSection<ELFT>::writeTo()

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 11:22:48 PST 2015


Nice!

On Fri, Dec 11, 2015 at 8:14 AM, George Rimar <grimar at accesssoftek.com>
wrote:

> grimar created this revision.
> grimar added reviewers: ruiu, rafael.
> grimar added subscribers: llvm-commits, grimar.
>
> Just a little reformat of conditions.
>
> http://reviews.llvm.org/D15453
>
> Files:
>   ELF/OutputSections.cpp
>
> Index: ELF/OutputSections.cpp
> ===================================================================
> --- ELF/OutputSections.cpp
> +++ ELF/OutputSections.cpp
> @@ -264,21 +264,19 @@
>      bool LazyReloc = Body && Target->supportsLazyRelocations() &&
>                       Target->relocNeedsPlt(Type, *Body);
>
> -    if (CanBePreempted) {
> -      unsigned GotReloc =
> -          Body->isTLS() ? Target->getTlsGotReloc() :
> Target->getGotReloc();
> -      if (NeedsGot)
> -        P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
> -                            LazyReloc ? Target->getPltReloc() : GotReloc,
> -                            Config->Mips64EL);
> -      else
> -        P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
> -                            NeedsCopy ? Target->getCopyReloc()
> -                                      : Target->getDynReloc(Type),
> -                            Config->Mips64EL);
> -    } else {
> -      P->setSymbolAndType(0, Target->getRelativeReloc(),
> Config->Mips64EL);
> -    }
> +    unsigned Sym = CanBePreempted ? Body->getDynamicSymbolTableIndex() :
> 0;
> +    unsigned Rel;
> +    if (!CanBePreempted)
> +      Rel = Target->getRelativeReloc();
> +    else if (LazyReloc)
> +      Rel = Target->getPltReloc();
> +    else if (NeedsGot)
> +      Rel = Body->isTLS() ? Target->getTlsGotReloc() :
> Target->getGotReloc();
> +    else if (NeedsCopy)
> +      Rel = Target->getCopyReloc();
> +    else
> +      Rel = Target->getDynReloc(Type);
> +    P->setSymbolAndType(Sym, Rel, Config->Mips64EL);
>
>      if (NeedsGot) {
>        if (LazyReloc)
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151211/0e1b802b/attachment.html>


More information about the llvm-commits mailing list