<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Can't add 16K+ (4*PageSize) object file to MCJIT."
href="http://llvm.org/bugs/show_bug.cgi?id=20722">20722</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Can't add 16K+ (4*PageSize) object file to MCJIT.
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>aleksey.bader@mail.ru
</td>
</tr>
<tr>
<th>CC</th>
<td>lhames@gmail.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I'm trying to add an object file created with
object::ObjectFile::createObjectFile to MCJIT using addObjectFile the same way
lli is doing it.
I found that if file size is > 4*PageSize MCJIT crashes with seg. fault trying
to load it.
The problem is that if object file exceeds 4*PageSize MemoryBufferMMapFile is
used to allocate memory and it marks allocated memory as read-only.
MCJIT creates ObjectImage from ObjectFile, but it simply sets internal pointers
to the memory allocated for ObjectFile.
The crash happens during the ObjectImage loading when loader tries to update
emitted ELF section address, which resides in read-only memory.
In order to reproduce the issue almost any ELF object is enough. For instance
lli.o can be used:
bin/lli -use-mcjit -extra-object=./tools/lli/CMakeFiles/lli.dir/lli.cpp.o <
../llvm/test/ExecutionEngine/Interpreter/intrinsics.ll
0 lli 0x0000000000a088e2 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1 lli 0x0000000000a08494
2 libpthread.so.0 0x00007fd0b2f03340
3 lli 0x0000000000b61365
4 lli 0x0000000000b524e3
llvm::RuntimeDyldImpl::emitSection(llvm::ObjectImage&, llvm::object::SectionRef
const&, bool) + 627
5 lli 0x0000000000b52bc0
llvm::RuntimeDyldImpl::findOrEmitSection(llvm::ObjectImage&,
llvm::object::SectionRef const&, bool, std::map<llvm::object::SectionRef,
unsigned int, std::less<llvm::object::SectionRef>,
std::allocator<std::pair<llvm::object::SectionRef const, unsigned int> > >&) +
176
6 lli 0x0000000000b53674
llvm::RuntimeDyldImpl::loadObject(llvm::ObjectImage*) + 2452
7 lli 0x0000000000b53af3
llvm::RuntimeDyld::loadObject(std::unique_ptr<llvm::object::ObjectFile,
std::default_delete<llvm::object::ObjectFile> >) + 131
8 lli 0x0000000000841bab
llvm::MCJIT::addObjectFile(std::unique_ptr<llvm::object::ObjectFile,
std::default_delete<llvm::object::ObjectFile> >) + 43
9 lli 0x0000000000516a29 main + 2489
10 libc.so.6 0x00007fd0b232eec5 __libc_start_main + 245
11 lli 0x0000000000527230
Stack dump:
0. Program arguments: bin/lli -use-mcjit
-extra-object=./tools/lli/CMakeFiles/lli.dir/lli.cpp.o
zsh: segmentation fault (core dumped) bin/lli -use-mcjit
-extra-object=./tools/lli/CMakeFiles/lli.dir/lli.cpp.o <</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>