[lld] r270275 - Simplify a bit. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri May 20 14:33:03 PDT 2016
On Fri, May 20, 2016 at 2:14 PM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: rafael
> Date: Fri May 20 16:14:06 2016
> New Revision: 270275
>
> URL: http://llvm.org/viewvc/llvm-project?rev=270275&view=rev
> Log:
> Simplify a bit. NFC.
>
> Modified:
> lld/trunk/ELF/InputSection.cpp
>
> Modified: lld/trunk/ELF/InputSection.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=270275&r1=270274&r2=270275&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/InputSection.cpp (original)
> +++ lld/trunk/ELF/InputSection.cpp Fri May 20 16:14:06 2016
> @@ -292,30 +292,30 @@ void InputSectionBase<ELFT>::relocate(ui
> uint64_t SymVA = SignExtend64<Bits>(
> getSymVA<ELFT>(Type, A, AddrLoc, *Rel.Sym, BufLoc, *File, Expr));
>
> - if (Expr == R_RELAX_TLS_IE_TO_LE) {
> - Target->relaxTlsIeToLe(BufLoc, Type, SymVA);
> - continue;
> - }
> - if (Expr == R_RELAX_TLS_LD_TO_LE) {
> - Target->relaxTlsLdToLe(BufLoc, Type, SymVA);
> - continue;
> - }
> - if (Expr == R_RELAX_TLS_GD_TO_LE) {
> - Target->relaxTlsGdToLe(BufLoc, Type, SymVA);
> - continue;
> - }
> - if (Expr == R_RELAX_TLS_GD_TO_IE_PC || Expr == R_RELAX_TLS_GD_TO_IE) {
> - Target->relaxTlsGdToIe(BufLoc, Type, SymVA);
> - continue;
> - }
> -
> if (Expr == R_PPC_PLT_OPD) {
> uint32_t Nop = 0x60000000;
> if (BufLoc + 8 <= BufEnd && read32be(BufLoc + 4) == Nop)
> write32be(BufLoc + 4, 0xe8410028); // ld %r2, 40(%r1)
> }
>
> - Target->relocateOne(BufLoc, Type, SymVA);
> + switch (Expr) {
> + case R_RELAX_TLS_IE_TO_LE:
> + Target->relaxTlsIeToLe(BufLoc, Type, SymVA);
> + break;
> + case R_RELAX_TLS_LD_TO_LE:
> + Target->relaxTlsLdToLe(BufLoc, Type, SymVA);
> + break;
> + case R_RELAX_TLS_GD_TO_LE:
> + Target->relaxTlsGdToLe(BufLoc, Type, SymVA);
> + break;
> + case R_RELAX_TLS_GD_TO_IE_PC:
> + case R_RELAX_TLS_GD_TO_IE:
> + Target->relaxTlsGdToIe(BufLoc, Type, SymVA);
> + break;
>
You could move the code for R_PPC_PLT_ORD here and fallthrough to default,
if you want. (I'm not saying that it's better, but just noticed.)
+ default:
> + Target->relocateOne(BufLoc, Type, SymVA);
> + break;
> + }
> }
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160520/61f71124/attachment.html>
More information about the llvm-commits
mailing list