Jason Holajter via llvm-dev
2016-Feb-06 01:59 UTC
[llvm-dev] Unable to evaluate offset when using aliases
Raised the following bug to track this issue: https://llvm.org/bugs/show_bug.cgi?id=26502 Thanks, Jason From: llvm-dev <llvm-dev-bounces at lists.llvm.org<mailto:llvm-dev-bounces at lists.llvm.org>> on behalf of Jason Holajter via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> Reply-To: Jason Holajter <jholajter at arxan.com<mailto:jholajter at arxan.com>> Date: Friday, February 5, 2016 at 4:11 PM To: "llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>" <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> Subject: [llvm-dev] Unable to evaluate offset when using aliases We have encountered a problem when using multiple aliases in IR and would like feedback as to whether this use is expected to work properly. The following IR is causing a failure in llc when lowering to an object file: ; RUN: llc double-alias.ll -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 Thanks for the help, Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160206/7919d74a/attachment.html>