[GOLLVM] Running LLI on LLVM Bitcode Fails with Recommended Setting

105 views
Skip to first unread message

Md. Sakib Anwar

unread,
Aug 8, 2023, 11:10:14 PM8/8/23
to golang-nuts
Hello,
I am trying to follow this commit of gofrontend: 140917: runtime: hack to make LLVM's lli work. For LLVM, GO-LLVM, LIBFFI and LIBBACKTRACE I am following the recommended commits as well:

GOLLVM_COMMIT=3452ec6bebaa1b432aabed1991475f4444c1775e
LIBBACKTRACE_COMMIT=fd9442f7b5413e7788dfcf356f6261afcedb56e8
LIBFFI_COMMIT=2e825e219fa06d308b9a9863d70320606d67490d
LLVM_COMMIT=09629215c272f09e3ebde6cc7eac9625d28910ff

LLI VERSION: LLVM (http://llvm.org/):
  LLVM version 13.0.1
  Optimized build with assertions.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: goldmont

However, even after following and applying the required patch to make them work, I am unable to reproduce the expected result as mentioned in the gofrontend hack. The error I am getting is: :

Error opening './gollvm/lib64/libgo.so.15git': ./gollvm/lib64/libgo.so.15git: undefined symbol: main.main
  -load request ignored.
lli: /tmp/llvm-130/llvm/lib/Bitcode/Reader/MetadataLoader.cpp:366: {anonymous}::{anonymous}::PlaceholderQueue::~PlaceholderQueue(): Assertion `empty() && "PlaceholderQueue hasn't been flushed before being destroyed"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.      Program arguments: lli -load=./gollvm/lib64/libgo.so.15git -extra-module=hello.bc newmain.bc
 #0 0x00007f91db4c0e66 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /tmp/llvm-130/llvm/lib/Support/Unix/Signals.inc:569:3
 #1 0x00007f91db4bee64 llvm::sys::RunSignalHandlers() /tmp/llvm-130/llvm/lib/Support/Signals.cpp:97:20
 #2 0x00007f91db4befe6 SignalHandler(int) /tmp/llvm-130/llvm/lib/Support/Unix/Signals.inc:407:1
 #3 0x00007f91da973520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f91da9c7a7c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x96a7c)
 #5 0x00007f91da973476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007f91da9597f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007f91da95971b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007f91da96ae96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00007f91dc0a90e1 (/tmp/llvm-130-install_O_D_A/bin/../lib/libLLVM-13.so+0x13210e1)
#10 0x00007f91dc0ba14b llvm::SmallVectorTemplateCommon<unsigned long, void>::begin() /tmp/llvm-130/llvm/include/llvm/ADT/SmallVector.h:253:45
#11 0x00007f91dc0ba14b llvm::SmallVectorTemplateCommon<unsigned long, void>::end() /tmp/llvm-130/llvm/include/llvm/ADT/SmallVector.h:255:32
#12 0x00007f91dc0ba14b llvm::SmallVector<unsigned long, 64u>::~SmallVector() /tmp/llvm-130/llvm/include/llvm/ADT/SmallVector.h:1175:24
#13 0x00007f91dc0ba14b llvm::MetadataLoader::MetadataLoaderImpl::parseMetadata(bool) /tmp/llvm-130/llvm/lib/Bitcode/Reader/MetadataLoader.cpp:1058:1
#14 0x00007f91dc0baa38 llvm::MetadataLoader::parseMetadata(bool) /tmp/llvm-130/llvm/lib/Bitcode/Reader/MetadataLoader.cpp:2319:1
#15 0x00007f91dc09b362 llvm::Error::setChecked(bool) /tmp/llvm-130/llvm/include/llvm/Support/Error.h:305:22
#16 0x00007f91dc09b362 llvm::Error::operator bool() /tmp/llvm-130/llvm/include/llvm/Support/Error.h:236:15
#17 0x00007f91dc09b362 (anonymous namespace)::BitcodeReader::parseModule(unsigned long, bool, llvm::function_ref<llvm::Optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (llvm::StringRef)>) /tmp/llvm-130/llvm/lib/Bitcode/Reader/BitcodeReader.cpp:3612:56
#18 0x00007f91dc0a81db llvm::Error::setChecked(bool) /tmp/llvm-130/llvm/include/llvm/Support/Error.h:305:22
#19 0x00007f91dc0a81db llvm::Error::operator bool() /tmp/llvm-130/llvm/include/llvm/Support/Error.h:236:15
#20 0x00007f91dc0a81db llvm::BitcodeModule::getModuleImpl(llvm::LLVMContext&, bool, bool, bool, llvm::function_ref<llvm::Optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (llvm::StringRef)>) /tmp/llvm-130/llvm/lib/Bitcode/Reader/BitcodeReader.cpp:6790:71
#21 0x00007f91dc0a84f5 llvm::Expected<llvm::BitcodeModule>::assertIsChecked() const /tmp/llvm-130/llvm/include/llvm/Support/Error.h:708:9
#22 0x00007f91dc0a84f5 llvm::Expected<llvm::BitcodeModule>::~Expected() /tmp/llvm-130/llvm/include/llvm/Support/Error.h:554:20
#23 0x00007f91dc0a84f5 llvm::parseBitcodeFile(llvm::MemoryBufferRef, llvm::LLVMContext&, llvm::function_ref<llvm::Optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (llvm::StringRef)>) /tmp/llvm-130/llvm/lib/Bitcode/Reader/BitcodeReader.cpp:6990:1
#24 0x00007f91db70abc9 llvm::Expected<std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > >::takeError() /tmp/llvm-130/llvm/include/llvm/Support/Error.h:592:15
#25 0x00007f91db70abc9 llvm::parseIR(llvm::MemoryBufferRef, llvm::SMDiagnostic&, llvm::LLVMContext&, llvm::function_ref<llvm::Optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (llvm::StringRef)>) /tmp/llvm-130/llvm/lib/IRReader/IRReader.cpp:78:41
#26 0x00007f91db70b732 llvm::parseIRFile(llvm::StringRef, llvm::SMDiagnostic&, llvm::LLVMContext&, llvm::function_ref<llvm::Optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (llvm::StringRef)>) /tmp/llvm-130/llvm/lib/IRReader/IRReader.cpp:103:36
#27 0x000055bb60a352dc loadModule(llvm::StringRef, llvm::orc::ThreadSafeContext) (/tmp/llvm-130-install_O_D_A/bin/lli+0x212dc)
#28 0x000055bb60a48bbc runOrcJIT(char const*) (/tmp/llvm-130-install_O_D_A/bin/lli+0x34bbc)
#29 0x000055bb60a280b7 main (/tmp/llvm-130-install_O_D_A/bin/lli+0x140b7)
#30 0x00007f91da95ad90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#31 0x00007f91da95ae40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#32 0x000055bb60a2a4a5 _start (/tmp/llvm-130-install_O_D_A/bin/lli+0x164a5)
Aborted (core dumped)

I am not sure what my next step should be, any help is appreciated.

Than McIntosh

unread,
Aug 9, 2023, 7:35:40 AM8/9/23
to Md. Sakib Anwar, golang-nuts
Hi, 

Looks like things are crashing while trying to read your bitcode, but other than that I am not sure what the issue might be ( I don't think I have seen that failure mode before). Sorry, this is not super helpful.

Best regards, Than


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/90ecaad6-da7e-4085-8ab2-f6025edc0189n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages