LLVM backend for 6502
Go to file
Jim Grosbach f8c1c8465f MCJIT lazy relocation resolution and symbol address re-assignment.
Add handling for tracking the relocations on symbols and resolving them.
Keep track of the relocations even after they are resolved so that if
the RuntimeDyld client moves the object, it can update the address and any
relocations to that object will be updated.

For our trival object file load/run test harness (llvm-rtdyld), this enables
relocations between functions located in the same object module. It should
be trivially extendable to load multiple objects with mutual references.

As a simple example, the following now works (running on x86_64 Darwin 10.6):


$ cat t.c
int bar() {
  return 65;
}

int main() {
  return bar();
}
$ clang t.c -fno-asynchronous-unwind-tables -o t.o -c
$ otool -vt t.o
t.o:
(__TEXT,__text) section
_bar:
0000000000000000  pushq %rbp
0000000000000001  movq  %rsp,%rbp
0000000000000004  movl  $0x00000041,%eax
0000000000000009  popq  %rbp
000000000000000a  ret
000000000000000b  nopl  0x00(%rax,%rax)
_main:
0000000000000010  pushq %rbp
0000000000000011  movq  %rsp,%rbp
0000000000000014  subq  $0x10,%rsp
0000000000000018  movl  $0x00000000,0xfc(%rbp)
000000000000001f  callq 0x00000024
0000000000000024  addq  $0x10,%rsp
0000000000000028  popq  %rbp
0000000000000029  ret
$ llvm-rtdyld t.o -debug-only=dyld ; echo $?
Function sym: '_bar' @ 0
Function sym: '_main' @ 16
Extracting function: _bar from [0, 15]
    allocated to 0x100153000
Extracting function: _main from [16, 41]
    allocated to 0x100154000
Relocation at '_main' + 16 from '_bar(Word1: 0x2d000000)
Resolving relocation at '_main' + 16 (0x100154010) from '_bar (0x100153000)(pcrel, type: 2, Size: 4).
loaded '_main' at: 0x100154000
65
$




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129388 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 21:20:41 +00:00
autoconf Check that the AsmParser exists for the native target to enable initialization 2011-03-14 22:12:35 +00:00
bindings Fix compiling the ocaml kaleidoscope tutorials 2011-02-09 18:32:02 +00:00
cmake CMake: remove some unnecesary code and ToDos. 2011-04-11 14:52:39 +00:00
docs Document how to build a LLVM pass with CMake out of source. 2011-04-12 19:40:35 +00:00
examples Added new FIXME note 2011-04-12 12:30:10 +00:00
include MCJIT lazy relocation resolution and symbol address re-assignment. 2011-04-12 21:20:41 +00:00
lib MCJIT lazy relocation resolution and symbol address re-assignment. 2011-04-12 21:20:41 +00:00
projects Regen configure 2010-12-12 21:42:01 +00:00
runtime Print our uint64_t with the more portable (C99 and C++0x) %PRIu64 format 2011-04-12 20:06:50 +00:00
test Add bad register checks for Thumb2 Ld/St instructions. 2011-04-12 21:17:51 +00:00
tools MCJIT lazy relocation resolution and symbol address re-assignment. 2011-04-12 21:20:41 +00:00
unittests Don't include Operator.h from InstrTypes.h. 2011-04-11 09:35:34 +00:00
utils Thumb disassembler was erroneously rejecting "blx sp" instruction. 2011-04-11 23:33:30 +00:00
website
.gitignore Cleanup and document .gitignore. 2010-12-17 17:22:50 +00:00
build-for-llvm-top.sh Patch to build llvm with srcdir != objdir from 2009-01-23 08:42:38 +00:00
CMakeLists.txt Supports building with a list of targets that does not contain 2011-03-23 17:42:13 +00:00
configure Check that the AsmParser exists for the native target to enable initialization 2011-03-14 22:12:35 +00:00
CREDITS.TXT Another git svn dcommit test. This time let's hope it doesn't kill my repo. 2010-12-10 14:45:10 +00:00
LICENSE.TXT 2010 is upon us. 2010-01-09 18:40:31 +00:00
llvm.spec.in
Makefile build: Add support for a SHOW_DIAGNOSTICS build variable. 2011-04-11 22:37:39 +00:00
Makefile.common Removed trailing whitespace from Makefiles. 2009-01-09 16:44:42 +00:00
Makefile.config.in autoconf: Add --disable-embed-stdcxx to suppress linking libstdc++.a into llvm.dll with --enable-shared on Cygming. 2010-12-29 03:59:14 +00:00
Makefile.rules build: Add support for a SHOW_DIAGNOSTICS build variable. 2011-04-11 22:37:39 +00:00
ModuleInfo.txt Remove trailing space. This is just an excuse to poke the 2010-10-05 20:32:15 +00:00
README.txt Test commit. 2011-02-11 19:11:57 +00:00

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for the Low Level
Virtual Machine, a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the HTML documentation provided in docs/index.html for further
assistance with LLVM.

If you're writing a package for LLVM, see docs/Packaging.html for our
suggestions.