[mips] Resolve relocation for the stubs in MCJIT when load address is known

Instead of processing relocation for branch to stubs right away, emit a
modified relocation and add it to queue to be resolved later when final load
address is known.
This resolves seven MIPS MCJIT issues that were caused by missing relocation
fixups at the end.

llvm-svn: 195157
This commit is contained in:
Petar Jovanovic 2013-11-19 21:56:00 +00:00
parent b34871027f
commit 45115f877c
8 changed files with 4 additions and 19 deletions

View File

@ -1031,8 +1031,8 @@ void RuntimeDyldELF::processRelocationRef(unsigned SectionID,
// Look up for existing stub.
StubMap::const_iterator i = Stubs.find(Value);
if (i != Stubs.end()) {
resolveRelocation(Section, Offset,
(uint64_t)Section.Address + i->second, RelType, 0);
RelocationEntry RE(SectionID, Offset, RelType, i->second);
addRelocationForSection(RE, SectionID);
DEBUG(dbgs() << " Stub function found\n");
} else {
// Create a new stub function.
@ -1057,9 +1057,8 @@ void RuntimeDyldELF::processRelocationRef(unsigned SectionID,
addRelocationForSection(RELo, Value.SectionID);
}
resolveRelocation(Section, Offset,
(uint64_t)Section.Address + Section.StubOffset,
RelType, 0);
RelocationEntry RE(SectionID, Offset, RelType, Section.StubOffset);
addRelocationForSection(RE, SectionID);
Section.StubOffset += getMaxStubSize();
}
} else if (Arch == Triple::ppc64 || Arch == Triple::ppc64le) {

View File

@ -1,7 +1,5 @@
; RUN: %lli_mcjit -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
; XFAIL: mips
declare i32 @FB()
define i32 @FA() {

View File

@ -1,7 +1,5 @@
; RUN: %lli_mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
; XFAIL: mips
declare i32 @FB()
define i32 @main() {

View File

@ -1,7 +1,5 @@
; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
; XFAIL: mips
define i32 @bar() {
ret i32 0
}

View File

@ -1,7 +1,5 @@
; RUN: %lli_mcjit -remote-mcjit -O0 -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target %s
; XFAIL: mips
; The intention of this test is to verify that symbols mapped to COMMON in ELF
; work as expected.
;

View File

@ -1,7 +1,5 @@
; RUN: %lli_mcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target %s
; XFAIL: mips
; Check that a variable is always aligned as specified.
@var = global i32 0, align 32

View File

@ -1,7 +1,5 @@
; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
; XFAIL: mips
define double @test(double* %DP, double %Arg) {
%D = load double* %DP ; <double> [#uses=1]
%V = fadd double %D, 1.000000e+00 ; <double> [#uses=2]

View File

@ -1,7 +1,5 @@
; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
; XFAIL: mips
@count = global i32 1, align 4
define i32 @main() nounwind uwtable {