[gollvm] build fail

196 views
Skip to first unread message

Qi Ling

unread,
Feb 19, 2026, 4:28:40 PMFeb 19
to golang-nuts
Hi! I failed to build gollvm following the instructions. Which LLVM version should I use? Thank you in advance!

Right now I'm using the LLVM main branch (6f253e87). Below is the build error:
[444/4666] Building CXX object tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o
FAILED: tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o
/usr/bin/c++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/qiling/llvm-project/build-debug/tools/gollvm/passes -I/home/qiling/llvm-project/llvm/tools/gollvm/passes -I/home/qiling/llvm-project/build-debug/include -I/home/qiling/llvm-project/llvm/include -I/home/qiling/llvm-project/llvm/tools/gollvm/driver -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -std=c++17   -Wno-suggest-override -fcf-protection=none -fno-exceptions -funwind-tables -fno-rtti -MD -MT tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o -MF tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o.d -o tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o -c /home/qiling/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp
/home/qiling/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp: In function ‘void zeroAmbiguouslyLiveSlots(llvm::Function&, llvm::SetVector<llvm::Value*>&, llvm::SetVector<llvm::Value*>&)’:
/home/qiling/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:1772:36: error: no matching function for call to ‘llvm::IRBuilder<>::CreateLifetimeStart(llvm::Instruction*, llvm::ConstantInt*)’
 1772 |         Builder.CreateLifetimeStart(&I, ConstantInt::get(Int64Ty, Size));
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/qiling/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:44:
/home/qiling/llvm-project/llvm/include/llvm/IR/IRBuilder.h:814:22: note: candidate: ‘llvm::CallInst* llvm::IRBuilderBase::CreateLifetimeStart(llvm::Value*)’
  814 |   LLVM_ABI CallInst *CreateLifetimeStart(Value *Ptr);
      |                      ^~~~~~~~~~~~~~~~~~~
/home/qiling/llvm-project/llvm/include/llvm/IR/IRBuilder.h:814:22: note:   candidate expects 1 argument, 2 provided
/home/qiling/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp: In member function ‘bool llvm::GoStatepoints::runOnFunction(llvm::Function&, llvm::DominatorTree&, llvm::TargetTransformInfo&, const llvm::TargetLibraryInfo&)’:
/home/qiling/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:2278:25: warning: ‘void llvm::Instruction::moveBefore(llvm::Instruction*)’ is deprecated: Use iterators as instruction positions [-Wdeprecated-declarations]
 2278 |         Cond->moveBefore(TI);
      |         ~~~~~~~~~~~~~~~~^~~~
In file included from /home/qiling/llvm-project/llvm/include/llvm/IR/DebugProgramInstruction.h:55,
                 from /home/qiling/llvm-project/llvm/include/llvm/IR/BasicBlock.h:23,
                 from /home/qiling/llvm-project/llvm/include/llvm/IR/Dominators.h:26,
                 from /home/qiling/llvm-project/llvm/include/llvm/Analysis/DomTreeUpdater.h:18,
                 from /home/qiling/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:31:
/home/qiling/llvm-project/llvm/include/llvm/IR/Instruction.h:246:37: note: declared here
  246 |                            "") void moveBefore(Instruction *MovePos);
      |                                     ^~~~~~~~~~
/home/qiling/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp: In function ‘void fixStackWriteBarriers(llvm::Function&, {anonymous}::DefiningValueMapTy&)’:
/home/qiling/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:3006:55: warning: ‘static llvm::PointerType* llvm::PointerType::get(llvm::Type*, unsigned int)’ is deprecated: PointerType::get with pointee type is pending removal. Use Context overload. [-Wdeprecated-declarations]
 3006 |                                       PointerType::get(Val->getType(), AS));
      |                                       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /home/qiling/llvm-project/llvm/include/llvm/IR/DataLayout.h:28,
                 from /home/qiling/llvm-project/llvm/tools/gollvm/passes/RemoveAddrSpace.h:18,
                 from /home/qiling/llvm-project/llvm/tools/gollvm/passes/GollvmPasses.h:16,
                 from /home/qiling/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:18:
/home/qiling/llvm-project/llvm/include/llvm/IR/DerivedTypes.h:713:32: note: declared here
  713 |   LLVM_ABI static PointerType *get(Type *ElementType, unsigned AddressSpace);
      |                                ^~~

Jason E. Aten

unread,
Feb 20, 2026, 1:13:49 AMFeb 20
to golang-nuts
I don't think gollvm is much maintained.

Big picture, what is your aim?  If you don't need standard library style network support, 
perhaps https://tinygo.org/ could be helpful? It is built on LLVM, targets embedded systems,
and has folks actively working with it.

Qi Ling

unread,
Mar 10, 2026, 4:00:47 PM (2 days ago) Mar 10
to golang-nuts
Thank you for the reply.

Here's what I want: I implemented some customized features in LLVM X86 backend (github link), and want to test it on some serverless functions written in Go. An example is here.

It seems like these serverless functions do need standard library style network support, so TinyGo may not be feasible? Also after compiling TinyGo with my customized LLVM, I couldn't find a way to enable my customized feature: I couldn't find a way to pass in LLVM flags into TinyGo. It doesn't work as expected even if I hardcode my customized X86 backend features to be enabled on default. 

I've tried to write a target json file to pass in my cflags, but it fails to compile as below:

qiling@zen4:~/tinygo$ cat targets/x86.json
{
"goos": "linux",
"goarch": "amd64",
"llvm-target": "x86_64-unknown-linux",
"linker": "ld.lld",
"cflags": ["-fno-lto", "-mllvm --x86-align-branch-boundary=64", "-mllvm --x86-align-branch=fused+jcc", "-mllvm --x86-align-skew=0"]
}
qiling@zen4:~/tinygo$ ./build/tinygo build -target x86 -o test_bin tests/tinygotest/main.go
qiling@zen4:~/tinygo$ nm test_bin
0000000000200000 t __ehdr_start
qiling@zen4:~/tinygo$ ./test_bin
Segmentation fault (core dumped)


Is there a recommended way to pass the LLVM backend flags into the TinyGo, or should I be looking at the go-llvm frontend instead?
Reply all
Reply to author
Forward
0 new messages