llvm-6502/lib/ExecutionEngine/RuntimeDyld
Ulrich Weigand 03f018a713 Respect Addend when processing MCJIT relocations to local/global symbols.
When the RuntimeDyldELF::processRelocationRef routine finds the target
symbol of a relocation in the local or global symbol table, it performs
a section-relative relocation:

    Value.SectionID = lsi->second.first;
    Value.Addend = lsi->second.second;

At this point, however, any Addend that might have been specified in
the original relocation record is lost.  This is somewhat difficult to
trigger for relocations within the code section since they usually
do not contain non-zero Addends (when built with the default JIT code
model, in any case).  However, the problem can be reliably triggered
by a relocation within the data section caused by code like:

 int test[2] = { -1, 0 };
 int *p = &test[1];

The initializer of "p" will need a relocation to "test + 4".  On
platforms using RelA relocations this means an Addend of 4 is required.
Current code ignores this addend when processing the relocation,
resulting in incorrect execution.

Fixed by taking the Addend into account when processing relocations
to symbols found in the local or global symbol table.

Tested on x86_64-linux and powerpc64-linux.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178869 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05 13:29:04 +00:00
..
CMakeLists.txt Moving SectionMemoryManager to MCJIT to avoid cross dependency between JIT and RuntimeDyld 2012-11-28 01:02:06 +00:00
GDBRegistrar.cpp Removed "static" from "__jit_debug_descriptor" because "static" adds C++ mangling prefix to this symbol. 2012-12-24 09:42:27 +00:00
JITRegistrar.h Clean-up of memory buffer and object ownership model in MCJIT 2012-10-02 21:18:39 +00:00
LLVMBuild.txt
Makefile
ObjectImageCommon.h Add support for applying in-memory relocations to the .debug_line section and, in the case of ELF files, using symbol addresses when available for relocations to the .debug_info section. Also extending the llvm-rtdyld tool to add the ability to dump line number information for testing purposes. 2013-01-25 22:50:58 +00:00
RuntimeDyld.cpp Formatting, grammar 2013-02-20 18:24:34 +00:00
RuntimeDyldELF.cpp Respect Addend when processing MCJIT relocations to local/global symbols. 2013-04-05 13:29:04 +00:00
RuntimeDyldELF.h Change resolveRelocation parameters so the relocations can find placeholder values in the original object buffer. 2012-11-02 19:45:23 +00:00
RuntimeDyldImpl.h Sort includes for all of the .h files under the 'lib' tree. These were 2012-12-04 07:12:27 +00:00
RuntimeDyldMachO.cpp RuntimeDyld: Fix errant fallthrough. 2013-01-31 19:46:28 +00:00
RuntimeDyldMachO.h Sort includes for all of the .h files under the 'lib' tree. These were 2012-12-04 07:12:27 +00:00