tomhrr / dale

Lisp-flavoured C
BSD 3-Clause "New" or "Revised" License
1.02k stars 48 forks source link

Issues building on ppc-64 #216

Closed BracketMaster closed 2 years ago

BracketMaster commented 2 years ago

I hit the following issue trying to build dale on linux-ppc64 on a POWER9 machine.

LLVM ERROR: Cannot select: 0xebcb7a4140: ch = store<(store 10, align 16)> 0xebcb7a3fa0, 0xebcb7a3e00, 0xebcb7a4278, undef:i64
  0xebcb7a3e00: f80 = fadd 0xebcb7a44e8, 0xebcb7a3ed0
    0xebcb7a44e8: f80,ch = CopyFromReg 0xebcb71f278, Register:f80 %1
      0xebcb7a47c0: f80 = Register %1
    0xebcb7a3ed0: f80,ch = CopyFromReg 0xebcb71f278, Register:f80 %2
      0xebcb7a45b8: f80 = Register %2
  0xebcb7a4278: i64,ch = CopyFromReg 0xebcb71f278, Register:i64 %3
    0xebcb7a4210: i64 = Register %3
  0xebcb7a46f0: i64 = undef
In function: _Z1$2baa
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /usr/bin/llc -relocation-model=pic -filetype=asm libarithmetic.bc -o libarithmetic.s
1.  Running pass 'Function Pass Manager' on module 'libarithmetic.bc'.
2.  Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@"_Z1$2baa"'
 #0 0x00003fb86b625d28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/bin/../lib/libLLVM-12.so+0xc4ed28)
 #1 0x00003fb86b625ec4 (/usr/bin/../lib/libLLVM-12.so+0xc4eec4)
 #2 0x00003fb86b623430 llvm::sys::RunSignalHandlers() (/usr/bin/../lib/libLLVM-12.so+0xc4c430)
 #3 0x00003fb86b623664 (/usr/bin/../lib/libLLVM-12.so+0xc4c664)
 #4 0x00003fb871a82444 (linux-vdso64.so.1+0x444)
 #5 0x00003fb86a583c14 __libc_signal_restore_set /builddir/glibc-2.32/signal/../sysdeps/unix/sysv/linux/internal-signals.h:104:3
 #6 0x00003fb86a583c14 raise /builddir/glibc-2.32/signal/../sysdeps/unix/sysv/linux/raise.c:47:3
 #7 0x00003fb86a564868 abort /builddir/glibc-2.32/stdlib/abort.c:79:7
 #8 0x00003fb86b527394 llvm::report_fatal_error(llvm::Twine const&, bool) (/usr/bin/../lib/libLLVM-12.so+0xb50394)
 #9 0x00003fb86b527538 llvm::report_fatal_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/usr/bin/../lib/libLLVM-12.so+0xb50538)
#10 0x00003fb86c15bd9c llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/usr/bin/../lib/libLLVM-12.so+0x1784d9c)
#11 0x00003fb86c15d3c8 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/usr/bin/../lib/libLLVM-12.so+0x17863c8)
#12 0x00003fb86eb72d1c (/usr/bin/../lib/libLLVM-12.so+0x419bd1c)
#13 0x00003fb86c15a1ec llvm::SelectionDAGISel::DoInstructionSelection() (/usr/bin/../lib/libLLVM-12.so+0x17831ec)
#14 0x00003fb86c165220 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/usr/bin/../lib/libLLVM-12.so+0x178e220)
#15 0x00003fb86c1656e4 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, true>, bool&) (/usr/bin/../lib/libLLVM-12.so+0x178e6e4)
#16 0x00003fb86c167ee8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/bin/../lib/libLLVM-12.so+0x1790ee8)
#17 0x00003fb86c16ae58 (/usr/bin/../lib/libLLVM-12.so+0x1793e58)
#18 0x00003fb86eb78398 (/usr/bin/../lib/libLLVM-12.so+0x41a1398)
#19 0x00003fb86bb452e0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/bin/../lib/libLLVM-12.so+0x116e2e0)
#20 0x00003fb86b811180 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/bin/../lib/libLLVM-12.so+0xe3a180)
#21 0x00003fb86b812f74 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/bin/../lib/libLLVM-12.so+0xe3bf74)
#22 0x00003fb86b810b98 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/bin/../lib/libLLVM-12.so+0xe39b98)
#23 0x00003fb86b810d8c llvm::legacy::PassManager::run(llvm::Module&) (/usr/bin/../lib/libLLVM-12.so+0xe39d8c)
#24 0x000000ebb476fbfc main (/usr/bin/llc+0xfbfc)
#25 0x00003fb86a564cdc generic_start_main.constprop.0.isra.0 /builddir/glibc-2.32/csu/../csu/libc-start.c:314:16
#26 0x00003fb86a564ec0 __libc_start_main /builddir/glibc-2.32/csu/../sysdeps/unix/sysv/linux/powerpc/libc-start.c:98:10
Aborted
dalec: /home/redacted/git/dale/src/dale/Module/Writer/Writer.cpp:89: bool dale::Module::Writer::writeSharedObject(const char*): Assertion `!res && "unable to assemble bitcode"' failed.
make[2]: *** [CMakeFiles/arithmetic.dir/build.make:73: libarithmetic.so] Aborted
make[1]: *** [CMakeFiles/Makefile2:391: CMakeFiles/arithmetic.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
BracketMaster commented 2 years ago

Happy to provide SSH access to a POWER9 machine if needed.

tomhrr commented 2 years ago

This should be fine now (see the gh-216 branch). Tested on an S922 (CentOS Stream 8) on IBM Cloud.