[llvm] r188572 - Fixed RuntimeDyldELF absolute relocations.

Rafael Avila de Espindola rafael.espindola at gmail.com
Fri Aug 16 21:38:00 PDT 2013


Test case ?

Sent from my iPhone

On 2013-08-16, at 11:54, Richard Mitton <richard at codersnotes.com> wrote:

> Author: rmitton
> Date: Fri Aug 16 13:54:26 2013
> New Revision: 188572
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=188572&view=rev
> Log:
> Fixed RuntimeDyldELF absolute relocations.
> 
> If an ELF relocation is pointed at an absolute address, it will have a symbol ID of zero.
> RuntimeDyldELF::processRelocationRef was not previously handling this case, and was instead trying to handle it as a section-relative fixup.
> 
> I think this is the right fix here, but my elf-fu is poor on some of the more exotic platforms, so I'd appreciate it if anyone with greater knowledge could verify this.
> 
> Modified:
>    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
> 
> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=188572&r1=188571&r2=188572&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Fri Aug 16 13:54:26 2013
> @@ -843,6 +843,13 @@ void RuntimeDyldELF::processRelocationRe
>         case SymbolRef::ST_Unknown: {
>           Value.SymbolName = TargetName.data();
>           Value.Addend = Addend;
> +
> +          // Absolute relocations will have a zero symbol ID (STN_UNDEF), which
> +          // will manifest here as a NULL symbol name.
> +          // We can set this as a valid (but empty) symbol name, and rely
> +          // on addRelocationForSymbol to handle this.
> +          if (!Value.SymbolName)
> +              Value.SymbolName = "";
>           break;
>         }
>         default:
> @@ -1068,7 +1075,10 @@ void RuntimeDyldELF::processRelocationRe
>       RelocationEntry RE(SectionID, Offset, RelType, Value.Addend);
>       // Extra check to avoid relocation againt empty symbols (usually
>       // the R_PPC64_TOC).
> -      if (Value.SymbolName && !TargetName.empty())
> +      if (SymType != SymbolRef::ST_Unknown && TargetName.empty())
> +        Value.SymbolName = NULL;
> +
> +      if (Value.SymbolName)
>         addRelocationForSymbol(RE, Value.SymbolName);
>       else
>         addRelocationForSection(RE, Value.SectionID);
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list