[llvm-commits] [PATCH] ELFObjectFile with dynamic loading support

Xerxes RĂ„nby xerxes at zafena.se
Mon Jan 9 10:56:16 PST 2012


2012-01-09 16:15, Bendersky, Eli skrev:
> Hello, Following the email I sent to LLVMdev earlier today (http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-January/046671.html), please find attached the first patch in the MCJIT/ELF series. It presents a subclass of ELFObjectFile, named DyldELFObject, which supports basic dynamic loading. This class is used by MCJIT/ELF to load an ELF image generated by MC into memory and executing it.
> 
> Please note that there are no stand-alone tests for this class yet. It is being tested extensively in the ExecutionEngine tests run on MCJIT/ELF, which will be part of the next patch in the series, once this one is accepted and committed.
> 
> Thanks in advance,
> 
> Eli

Hi Eli!

Thank you and your team for working on MCJIT/ELF support!

+// Walk through the ELF headers, updating virtual addresses to reflect where
+// the object is currently loaded in memory
+template<support::endianness target_endianness, bool is64Bits>
+void DyldELFObject<target_endianness, is64Bits>::rebaseObject(
...
+      else {
+        if (sec->sh_flags & ELF::SHF_WRITE) {
+          // TODO: setRangeWritable
+        }
+        if (sec->sh_flags & ELF::SHF_EXECINSTR) {
+          // TODO: setRangeExecutable
+        }

It would be nice if these two TODOs got replaced by
report_fatal_error("Unimplemented DyldELFObject setRangeWritable");
and
report_fatal_error("Unimplemented DyldELFObject setRangeExecutable");
to prevent more obscure errors to sneak in if someone expect the two flags to have effect.

Cheers
Xerxes



More information about the llvm-commits mailing list