mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
[ORC] Don't require a null-terminator on MemoryBuffers for objects in archives.
The MemoryBuffer::getMemBuffer method's RequiresNullTerminator parameter defaults to true, but object files are not null terminated so we need to explicitly pass false here.
This commit is contained in:
parent
978bea5534
commit
df818b7034
@ -349,8 +349,8 @@ Error StaticLibraryDefinitionGenerator::tryToGenerate(
|
||||
MemoryBufferRef ChildBufferRef(ChildBufferInfo.first,
|
||||
ChildBufferInfo.second);
|
||||
|
||||
if (auto Err =
|
||||
L.add(JD, MemoryBuffer::getMemBuffer(ChildBufferRef), VModuleKey()))
|
||||
if (auto Err = L.add(JD, MemoryBuffer::getMemBuffer(ChildBufferRef, false),
|
||||
VModuleKey()))
|
||||
return Err;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
declare i32 @foo()
|
||||
|
||||
define i32 @bar() {
|
||||
entry:
|
||||
%0 = call i32 @foo()
|
||||
ret i32 %0
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: llc -filetype=obj -o %t %p/Inputs/basic-object-source.ll
|
||||
; RUN: llc -filetype=obj -o %t %p/Inputs/foo-return-i32-0.ll
|
||||
; RUN: lli -jit-kind=orc-lazy -extra-object %t %s
|
||||
;
|
||||
; Check that we can load an object file and call a function in it.
|
||||
|
@ -1,11 +1,13 @@
|
||||
; This first line will generate the .o files for the next run line
|
||||
; RUN: llc -filetype=obj -o %t.o %p/Inputs/basic-object-source.ll
|
||||
; RUN: llvm-ar r %t.a %t.o
|
||||
; RUN: lli -jit-kind=orc-lazy -extra-archive %t.a %s
|
||||
; RUN: rm -rf %t && mkdir -p %t
|
||||
; RUN: llc -filetype=obj -o %t/foo.o %p/Inputs/foo-return-i32-0.ll
|
||||
; RUN: llc -filetype=obj -o %t/bar.o %p/Inputs/bar-return-i32-call-foo.ll
|
||||
; RUN: llvm-ar r %t/staticlib.a %t/foo.o %t/bar.o
|
||||
; RUN: lli -jit-kind=orc-lazy -extra-archive %t/staticlib.a %s
|
||||
|
||||
declare i32 @foo()
|
||||
declare i32 @bar()
|
||||
|
||||
define i32 @main() {
|
||||
%r = call i32 @foo( ) ; <i32> [#uses=1]
|
||||
%r = call i32 @bar() ; <i32> [#uses=1]
|
||||
ret i32 %r
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user