[LLVMbugs] [Bug 283] NEW: Need support for position independent code & relocations

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Mar 10 11:20:52 PST 2004


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=283

           Summary: Need support for position independent code & relocations
           Product: libraries
           Version: 1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org
                CC: alkis at cs.uiuc.edu


Our current mechanism for outputing machine code is basically the bare minimum
required to get the JIT working.  Long term, we want to be able to write the
code generated by the JIT out and read it back in as well.  To do this, we will
need to generate relocatable machine code along with a list of relocations.

Currently the code emission process looks something like this:
X86CodeGen: emit an instruction 'mov EAX, [global]'
X86CodeGen: "hey jit, what's the address of global"
JIT       : Hey code generator, it's at 0x12345678
X86CodeGen: Ok, emit 0xAB 0xCD 0x12345678

So currently the code generators produce a stream of binary machine code, but
has to call into the JIT to get the addresses of various globals, constant pool
entries, etc.  Instead the code generator should be independent of the JIT and
produce both machine code and *relocations*, so that it does not need to call
into the JIT at all.

Consumers of this information could choose to write out a native ELF .o file, or
could choose to splat it to memory and then execute it (like the JIT).  Once the
LLVM code generators can write out PIC code, making the JIT cache translations
would be really quite easy :)

-Chris



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list