<html>
  <head>
    
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    RelocationPass implements CRTP, and I believe it's a good practice
    of the base relocation handler switch to call specific handlers<br>
    with regard to their possible "overrides" in derived classes.<br>
    <br>
    - Denis.<br>
    <br>
    <div class="moz-cite-prefix">On 04/10/2015 10:59 PM, Rui Ueyama
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAJENXgtof5jbg0EXVJzCZuQ-J2Du_PYZ=x2pRAH0Sgw-eTiTLw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Fri, Apr 10, 2015 at 2:54 AM,
            Denis Protivensky <span dir="ltr"><<a
                moz-do-not-send="true"
                href="mailto:dprotivensky@accesssoftek.com"
                target="_blank">dprotivensky@accesssoftek.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">Author:
              denis-protivensky<br>
              Date: Fri Apr 10 04:54:10 2015<br>
              New Revision: 234580<br>
              <br>
              URL: <a moz-do-not-send="true"
                href="http://llvm.org/viewvc/llvm-project?rev=234580&view=rev"
                target="_blank">http://llvm.org/viewvc/llvm-project?rev=234580&view=rev</a><br>
              Log:<br>
              [ARM] Improve veneer handling and introduce handlePlain
              method<br>
              <br>
              Handle veneers only for call-like relocations.<br>
              <br>
              Modified:<br>
                 
              lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp<br>
              <br>
              Modified:
              lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp<br>
              URL: <a moz-do-not-send="true"
href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp?rev=234580&r1=234579&r2=234580&view=diff"
                target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp?rev=234580&r1=234579&r2=234580&view=diff</a><br>
==============================================================================<br>
              ---
              lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp
              (original)<br>
              +++
              lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp
              Fri Apr 10 04:54:10 2015<br>
              @@ -297,12 +297,14 @@ template <class Derived> class
              ARMReloca<br>
                   case R_ARM_MOVT_ABS:<br>
                   case R_ARM_THM_MOVW_ABS_NC:<br>
                   case R_ARM_THM_MOVT_ABS:<br>
              +      static_cast<Derived
              *>(this)->handlePlain(atom, ref);<br>
              +      break;<br>
                   case R_ARM_THM_CALL:<br>
                   case R_ARM_CALL:<br>
                   case R_ARM_JUMP24:<br>
                   case R_ARM_THM_JUMP24:<br>
                   case R_ARM_THM_JUMP11:<br>
              -      static_cast<Derived
              *>(this)->handleIFUNC(atom, ref);<br>
              +      static_cast<Derived
              *>(this)->handlePlain(atom, ref);<br>
                     static_cast<Derived
              *>(this)->handleVeneer(atom, ref);</blockquote>
            <div><br>
            </div>
            <div>I believe this static_cast is to eliminate vtable
              lookup, but do you think we really need this? This is not
              written by you nor me, so maybe neither of us can't answer
              to the question, but it feels like premature optimization
              to me.</div>
            <div><br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
                     break;<br>
                   case R_ARM_TLS_IE32:<br>
              @@ -666,6 +668,11 @@ public:<br>
                 ARMStaticRelocationPass(const elf::ARMLinkingContext
              &ctx)<br>
                     : ARMRelocationPass(ctx) {}<br>
              <br>
              +  /// \brief Handle ordinary relocation references.<br>
              +  std::error_code handlePlain(const DefinedAtom
              &atom, const Reference &ref) {<br>
              +    return handleIFUNC(atom, ref);<br>
              +  }<br>
              +<br>
                 /// \brief Get the veneer for ARM B/BL instructions.<br>
                 const VeneerAtom *getVeneer_ARM_B_BL(const DefinedAtom
              *da,<br>
                                                      StringRef secName)
              {<br>
              @@ -728,6 +735,11 @@ public:<br>
                 ARMDynamicRelocationPass(const elf::ARMLinkingContext
              &ctx)<br>
                     : ARMRelocationPass(ctx) {}<br>
              <br>
              +  /// \brief Handle ordinary relocation references.<br>
              +  std::error_code handlePlain(const DefinedAtom
              &atom, const Reference &ref) {<br>
              +    return handleIFUNC(atom, ref);<br>
              +  }<br>
              +<br>
                 /// \brief Get the veneer for ARM B/BL instructions.<br>
                 const VeneerAtom *getVeneer_ARM_B_BL(const DefinedAtom
              *da,<br>
                                                      StringRef secName)
              {<br>
              <br>
              <br>
              _______________________________________________<br>
              llvm-commits mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
              <a moz-do-not-send="true"
                href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits"
                target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>