<html>
<head>
<base href="https://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 --- - LLVM ERROR: unable to evaluate offset to undefined symbol"
href="https://llvm.org/bugs/show_bug.cgi?id=26502">26502</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLVM ERROR: unable to evaluate offset to undefined symbol
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jholajter@arxan.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=15840" name="attach_15840" title="Bitcode file that reproduces the issue">attachment 15840</a> <a href="attachment.cgi?id=15840&action=edit" title="Bitcode file that reproduces the issue">[details]</a></span>
Bitcode file that reproduces the issue
The following IR is causing a failure in llc when lowering to an object file:
; RUN: llc double-alias.bc -filetype=obj -o double-alias.o
@bar = global i32 0
@foo2 = alias i32, i32* @bar
@foo3 = alias i32, i32* @foo2
@baz = global i32* @foo3
Is redirection through multiple aliases supposed to work? If @baz is modified
to reference @foo2 instead of @foo3, the IR lowers to an object file
successfully.
Without asserts enabled, the following error is seen:
LLVM ERROR: unable to evaluate offset to undefined symbol '_foo2'
With asserts enabled, the following assert is seen:
Assertion failed: ((SymbolContents == SymContentsUnset || SymbolContents ==
SymContentsOffset) && "Cannot get offset for a common/variable symbol"),
function getOffset, file /llvm-3.8-rc1/src/include/llvm/MC/MCSymbol.h, line
317.
0 llc 0x00000001111c2a5e
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46
1 llc 0x00000001111c2e99
PrintStackTraceSignalHandler(void*) + 25
2 llc 0x00000001111bf729 llvm::sys::RunSignalHandlers() +
425
3 llc 0x00000001111c31e2 SignalHandler(int) + 354
4 libsystem_platform.dylib 0x00007fff885c2eaa _sigtramp + 26
5 llc 0x0000000111e06635 ErrorCategory + 87253
6 llc 0x00000001111c2ebb raise + 27
7 llc 0x00000001111c2f62 abort + 18
8 llc 0x00000001111c2f4e __assert_rtn + 126
9 llc 0x0000000110bb988e llvm::MCSymbol::getOffset()
const + 126
10 llc 0x0000000110bbc25d getLabelOffset(llvm::MCAsmLayout
const&, llvm::MCSymbol const&, bool, unsigned long long&) + 221
11 llc 0x0000000110bba362
getSymbolOffsetImpl(llvm::MCAsmLayout const&, llvm::MCSymbol const&, bool,
unsigned long long&) + 322
12 llc 0x0000000110bba456
llvm::MCAsmLayout::getSymbolOffset(llvm::MCSymbol const&) const + 38
13 llc 0x0000000110b82f21
llvm::MCAssembler::evaluateFixup(llvm::MCAsmLayout const&, llvm::MCFixup
const&, llvm::MCFragment const*, llvm::MCValue&, unsigned long long&) const +
625
14 llc 0x0000000110b85036
llvm::MCAssembler::handleFixup(llvm::MCAsmLayout const&, llvm::MCFragment&,
llvm::MCFixup const&) + 182
15 llc 0x0000000110b85a7f
llvm::MCAssembler::layout(llvm::MCAsmLayout&) + 2223
16 llc 0x0000000110b85f33 llvm::MCAssembler::Finish() + 83
17 llc 0x0000000110bd07ff
llvm::MCObjectStreamer::FinishImpl() + 191
18 llc 0x0000000110bc2017 (anonymous
namespace)::MCMachOStreamer::FinishImpl() + 807
19 llc 0x0000000110bdba35 llvm::MCStreamer::Finish() + 149
20 llc 0x0000000110296a21
llvm::AsmPrinter::doFinalization(llvm::Module&) + 5425
21 llc 0x0000000110a4e5d4
llvm::FPPassManager::doFinalization(llvm::Module&) + 84
22 llc 0x0000000110a4f7f3 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&) + 3603
23 llc 0x0000000110a4e766
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 342
24 llc 0x0000000110a4fd81
llvm::legacy::PassManager::run(llvm::Module&) + 33
25 llc 0x000000010eece223 compileModule(char**,
llvm::LLVMContext&) + 19363
26 llc 0x000000010eec9621 main + 225
27 libdyld.dylib 0x00007fff85f6a5ad start + 1
28 libdyld.dylib 0x0000000000000005 start + 2047433305
Stack dump:
0.
Program arguments: /llvm-3.8-rc1/build/bin/llc double-alias.ll -filetype=obj -o
double-alias.o
Illegal instruction: 4
The attached bc and ll files are for LLVM-3.8 RC2, but this is reproducible on
older versions of LLVM as well.</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>