[llvm-commits] ELFObject

Jason Kim jasonwkim at google.com
Wed Aug 3 10:41:26 PDT 2011


On Wed, Aug 3, 2011 at 10:03 AM, Danil Malyshev
<dmalyshev at accesssoftek.com>wrote:

>  Hello everyone,****
>
> ** **
>
> ** **
>
> Please review the new class: ELFObject - ELF object file wrapper.****
>
> It's will be use in MCJIT dynamic linker.****
>
> Patch attached****
>
> **
>

Hi, after a cursory glance, I have a few questions -

   1. What is the plan for this class? i.e. Is there a doc somewhere that
   describes ...
      1. Which architecture is to be supported first?
      2. How will you split off architecture specific details, such as ..
      3. Relocations during JIT?
   2. Is it intended to ever support 64 bit elf files directly? If so,
   you'll have to do something about the 32bit offset helpers below (for
   starters) and/or the class name (for clarity) If not, then should this class
   be called ELF32Object?


Thanks!


+
+  /// \brief Get the pointer to a byte with offset in the ELF object.
+  /// \param Offset - offset from a first byte in the ELF object.
+  const uint8_t *getOffset(unsigned Offset) const {
+    assert((Offset < Buffer->getBufferSize()) &&
+           "Offset out of range!");
+    return (const uint8_t*)Buffer->getBufferStart() + Offset;
+  }
+
+  /// \brief Get the pointer to a string from the string section.
+  /// \param Offset - offset from a first byte in the string section.
+  /// \param SectionIndex - index of section in the section headers table.
+  const char *getStringAtOffset(unsigned Offset, unsigned SectionIndex)
const {
+    return (const
char*)getOffset(getSectionHeader(SectionIndex)->sh_offset) +
+                        Offset;
+  }

Thanks

-jason

**
>
> ** **
>
> Regards,****
>
> Danil****
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110803/4d72c229/attachment.html>


More information about the llvm-commits mailing list