| Issue |
55456
|
| Summary |
Use of the `ppu-lv2-elf` target causes a fatal error in backend for simple C code
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
ProtoByter
|
I get this output when I try and compile a simple C file:
```
fatal error: error in backend: Cannot select: 0x55c53760b160: ch,glue = PPCISD::CALL_NOP 0x55c53760b1c8, TargetGlobalAddress:i32<void (...)* @_init> 0, Register:i64 $x2, RegisterMask:Untyped, shared/crt/crt1.c:9:2
0x55c53760b028: i32 = TargetGlobalAddress<void (...)* @_init> 0, shared/crt/crt1.c:9:2
0x55c53760afc0: i64 = Register $x2
0x55c53760adb8: Untyped = RegisterMask
In function: _initialize
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /usr/bin/clang --target=ppu-lv2-elf -g -MD -MT shared/crt/CMakeFiles/celldk-crt.dir/crt1.c.obj -MF shared/crt/CMakeFiles/celldk-crt.dir/crt1.c.obj.d -o shared/crt/CMakeFiles/celldk-crt.dir/crt1.c.obj -c /home/protobyter/celldk/shared/crt/crt1.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/home/protobyter/celldk/shared/crt/crt1.c'.
4. Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@_initialize'
#0 0x00007ff958d260a7 (/usr/lib/libLLVM-13.so+0xb9e0a7)
#1 0x00007ff958d23b1c llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/libLLVM-13.so+0xb9bb1c)
#2 0x00007ff958c29a4f llvm::CrashRecoveryContext::HandleExit(int) (/usr/lib/libLLVM-13.so+0xaa1a4f)
#3 0x00007ff958d1e224 llvm::sys::Process::Exit(int, bool) (/usr/lib/libLLVM-13.so+0xb96224)
#4 0x000055c536347743 (/usr/bin/clang+0x10743)
#5 0x00007ff958c3f9fe llvm::report_fatal_error(llvm::Twine const&, bool) (/usr/lib/libLLVM-13.so+0xab79fe)
#6 0x00007ff958c3fb84 (/usr/lib/libLLVM-13.so+0xab7b84)
#7 0x00007ff959697f85 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/usr/lib/libLLVM-13.so+0x150ff85)
#8 0x00007ff9596993ba llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/usr/lib/libLLVM-13.so+0x15113ba)
#9 0x00007ff95ba47498 (/usr/lib/libLLVM-13.so+0x38bf498)
#10 0x00007ff959696ac7 llvm::SelectionDAGISel::DoInstructionSelection() (/usr/lib/libLLVM-13.so+0x150eac7)
#11 0x00007ff95969f869 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/usr/lib/libLLVM-13.so+0x1517869)
#12 0x00007ff9596a37ea llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/lib/libLLVM-13.so+0x151b7ea)
#13 0x00007ff9596a50a2 (/usr/lib/libLLVM-13.so+0x151d0a2)
#14 0x00007ff95ba4bada (/usr/lib/libLLVM-13.so+0x38c3ada)
#15 0x00007ff959153289 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/libLLVM-13.so+0xfcb289)
#16 0x00007ff958e8bfd0 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/libLLVM-13.so+0xd03fd0)
#17 0x00007ff958e8c144 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/libLLVM-13.so+0xd04144)
#18 0x00007ff958e8da8a llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/libLLVM-13.so+0xd05a8a)
#19 0x00007ff9610e21ed (/usr/lib/libclang-cpp.so.13+0x26441ed)
#20 0x00007ff9601594af clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/usr/lib/libclang-cpp.so.13+0x16bb4af)
#21 0x00007ff960428e9b (/usr/lib/libclang-cpp.so.13+0x198ae9b)
#22 0x00007ff95f48c19a clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.13+0x9ee19a)
#23 0x00007ff960a15f79 clang::FrontendAction::Execute() (/usr/lib/libclang-cpp.so.13+0x1f77f79)
#24 0x00007ff9609bc2cf clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.13+0x1f1e2cf)
#25 0x00007ff960a615f0 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.13+0x1fc35f0)
#26 0x000055c53634d84c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+0x1684c)
#27 0x000055c53634fc2d (/usr/bin/clang+0x18c2d)
#28 0x00007ff960725a99 (/usr/lib/libclang-cpp.so.13+0x1c87a99)
#29 0x00007ff958c298e7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/libLLVM-13.so+0xaa18e7)
#30 0x00007ff96072c030 (/usr/lib/libclang-cpp.so.13+0x1c8e030)
#31 0x00007ff960744694 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/usr/lib/libclang-cpp.so.13+0x1ca6694)
#32 0x00007ff960744ac9 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/usr/lib/libclang-cpp.so.13+0x1ca6ac9)
#33 0x00007ff960747a42 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/usr/lib/libclang-cpp.so.13+0x1ca9a42)
#34 0x000055c53634561b main (/usr/bin/clang+0xe61b)
#35 0x00007ff957d70290 __libc_start_call_main libc-start.c:0:0
#36 0x00007ff957d7034a __libc_start_main@GLIBC_2.2.5 (/usr/lib/libc.so.6+0x2d34a)
#37 0x000055c536346485 _start (/usr/bin/clang+0xf485)
clang-13: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 13.0.1
Target: ppu-unknown-lv2-elf
Thread model: posix
InstalledDir: /usr/bin
```
In this zip file is the files it tells me to attach:
[adc519.zip](https://github.com/llvm/llvm-project/files/8692579/adc519.zip)
It appears to come from the fact that it's trying to call a function set as `extern` since it fails at the call to `_init()`
I also get this error on clang 15:
```
fatal error: error in backend: Cannot select: 0x2363c08: ch,glue = PPCISD::CALL_NOP 0x2363fb0, TargetGlobalAddress:i32<i32 (%union._PDCLIB_mtx_t*)* @mtx_unlock> 0, Register:i64 $x3, Register:i64 $x2, RegisterMask:Untyped, 0x2363fb0:1, pdclib/functions/stdio/fwrite.c:92:21
0x2363da8: i32 = TargetGlobalAddress<i32 (%union._PDCLIB_mtx_t*)* @mtx_unlock> 0, pdclib/functions/stdio/fwrite.c:92:21
0x2364630: i64 = Register $x3
0x2363cd8: i64 = Register $x2
0x2364490: Untyped = RegisterMask
0x2363fb0: ch,glue = CopyToReg 0x2364220, Register:i64 $x3, 0x2364698, pdclib/functions/stdio/fwrite.c:92:21
0x2364630: i64 = Register $x3
0x2364698: i64 = zero_extend 0x2363ee0, pdclib/functions/stdio/fwrite.c:92:21
0x2363ee0: i32 = add nuw 0x2363ba0, Constant:i32<52>, pdclib/functions/stdio/fwrite.c:92:21
0x2363ba0: i32,ch = load<(dereferenceable load (s32) from %ir.9)> 0x2364080, FrameIndex:i32<4>, undef:i32, pdclib/functions/stdio/fwrite.c:92:21
0x2364018: i32 = FrameIndex<4>
0x2364288: i32 = undef
0x2364768: i32 = Constant<52>
In function: fwrite
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /usr/bin/clang --target=ppu-lv2-elf -I/workspace/celldk/pdclib/include -I/workspace/celldk/pdclib/platform/ps3/include -g -fPIC -D_PDCLIB_BUILD -MD -MT pdclib/CMakeFiles/pdclib.dir/functions/stdio/fwrite.c.obj -MF pdclib/CMakeFiles/pdclib.dir/functions/stdio/fwrite.c.obj.d -o pdclib/CMakeFiles/pdclib.dir/functions/stdio/fwrite.c.obj -c /workspace/celldk/pdclib/functions/stdio/fwrite.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/workspace/celldk/pdclib/functions/stdio/fwrite.c'.
4. Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@fwrite'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x31)[0x7f0785436671]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0xee)[0x7f07854343ce]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm3sys15CleanupOnSignalEm+0x100)[0x7f0785435a40]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(+0xd4910a)[0x7f078536010a]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(+0xd490ab)[0x7f07853600ab]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm3sys7Process4ExitEib+0x27)[0x7f07854309b7]
/usr/bin/clang[0x413a82]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm18report_fatal_errorERKNS_5TwineEb+0x121)[0x7f0785371c31]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(+0x1649e51)[0x7f0785c60e51]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm16SelectionDAGISel16SelectCodeCommonEPNS_6SDNodeEPKhj+0x3898)[0x7f0785c60308]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(+0x32d73b5)[0x7f07878ee3b5]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm16SelectionDAGISel22DoInstructionSelectionEv+0x19f)[0x7f0785c58f9f]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm16SelectionDAGISel17CodeGenAndEmitDAGEv+0x5c4)[0x7f0785c58664]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm16SelectionDAGISel20SelectAllBasicBlocksERKNS_8FunctionE+0x176e)[0x7f0785c57a5e]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm16SelectionDAGISel20runOnMachineFunctionERNS_15MachineFunctionE+0x904)[0x7f0785c555e4]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(+0x32cf38f)[0x7f07878e638f]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0x12d)[0x7f07857be49d]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x39f)[0x7f078557097f]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x33)[0x7f0785577ef3]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x936)[0x7f0785571516]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsEN4llvm9StringRefEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISK_EE+0xc14)[0x7f078c84a824]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(+0x1bfe9d9)[0x7f078cb969d9]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(_ZN5clang8ParseASTERNS_4SemaEbb+0x274)[0x7f078b9cfec4]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(_ZN5clang13CodeGenAction13ExecuteActionEv+0xd5)[0x7f078cb92cf5]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(_ZN5clang14FrontendAction7ExecuteEv+0x67)[0x7f078d56b7d7]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x336)[0x7f078d4e1ab6]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x29a)[0x7f078d5e701a]
/usr/bin/clang(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x974)[0x413644]
/usr/bin/clang[0x4119bb]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(+0x21c6622)[0x7f078d15e622]
/lib/x86_64-linux-gnu/libLLVM-15.so.1(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xdd)[0x7f078536008d]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x140)[0x7f078d15e110]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x3f3)[0x7f078d127ae3]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x8a)[0x7f078d127d6a]
/lib/x86_64-linux-gnu/libclang-cpp.so.15(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x1a7)[0x7f078d1424a7]
/usr/bin/clang(main+0x2cbc)[0x41141c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f07840fb0b3]
/usr/bin/clang(_start+0x2e)[0x40e41e]
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 15.0.0-++20220323052916+e4a42c5b64d0-1~exp1~20220323173010.198
Target: ppu-unknown-lv2-elf
Thread model: posix
InstalledDir: /usr/bin
```
In this zip file is the files it tells me to attach:
[efd448.zip](https://github.com/llvm/llvm-project/files/8692577/efd448.zip)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs