maddymakesgames / Rust-CE

A proof-of-concept of rust on the ti-84+ce
MIT License
33 stars 1 forks source link

Issue with dependencies #1

Open dtomvan opened 3 years ago

dtomvan commented 3 years ago

So I created a fork of your project and I tried some things out. Good stuff. I changed my Makefile.toml to use cargo rustc, so you can use some dependencies if you want. However, when trying to use the core library in rust, your build of llc does not understand the instruction ret in the LLVM IR (which rustc came up with). I tried building my version of llvm as well. Do you have any idea why this is occurring?

Llc logs:


tools/llc: /usr/lib/libtinfo.so.6: no version information available (required by tools/llc)
LLVM ERROR: unable to translate instruction: ret (in function: _ZN4core6result19Result$LT$T$C$E$GT$6unwrap17h902768c9e7854d83E)
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.      Program arguments: tools/llc incremental/ti_84_poc-a6bfe995eb836153.ll -o ./incremental/ti_84_poc.s
1.      Running pass 'Function Pass Manager' on module 'incremental/ti_84_poc-a6bfe995eb836153.ll'.
2.      Running pass 'IRTranslator' on function '@"_ZN4core6result19Result$LT$T$C$E$GT$6unwrap17h902768c9e7854d83E"'
 #0 0x000000000166c653 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (tools/llc+0x166c653)
 #1 0x000000000166a57e llvm::sys::RunSignalHandlers() (tools/llc+0x166a57e)
 #2 0x000000000166caff SignalHandler(int) (tools/llc+0x166caff)
 #3 0x00007feb2d964870 __restore_rt (/usr/lib/libpthread.so.0+0x13870)
 #4 0x00007feb2d5c4d22 raise (/usr/lib/libc.so.6+0x3cd22)
 #5 0x00007feb2d5ae862 abort (/usr/lib/libc.so.6+0x26862)
 #6 0x00000000015e9919 (tools/llc+0x15e9919)
 #7 0x00000000015e9937 (tools/llc+0x15e9937)
 #8 0x00000000018c4a4a (tools/llc+0x18c4a4a)
 #9 0x00000000018d5e88 llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&) (tools/llc+0x18d5e88)
#10 0x0000000000bbc26e llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (tools/llc+0xbbc26e)
#11 0x0000000000f68f5d llvm::FPPassManager::runOnFunction(llvm::Function&) (tools/llc+0xf68f5d)
#12 0x0000000000f6ecf3 llvm::FPPassManager::runOnModule(llvm::Module&) (tools/llc+0xf6ecf3)
#13 0x0000000000f6959f llvm::legacy::PassManagerImpl::run(llvm::Module&) (tools/llc+0xf6959f)
#14 0x000000000081e683 main (tools/llc+0x81e683)
#15 0x00007feb2d5afb25 __libc_start_main (/usr/lib/libc.so.6+0x27b25)
#16 0x0000000000819eae _start (tools/llc+0x819eae)
/tmp/tomvd/fsio/CHns2yiOPZ.sh: line 5: 67714 Aborted                 (core dumped) tools/llc $(find incremental -name ${CARGO_MAKE_PROJECT_NAME}-*.ll) -o ./incremental/${CARGO_MAKE_PROJECT_NAME}.s
maddymakesgames commented 3 years ago

hmmm, I'd actually been messing around with getting cargo rustc working last week and for me llc was erroring on call instructions into core.

I've been assuming this is because there is no core built for the ez80.

I don't know why its erroring on ret for you. The build of llc ive been using recently is, I'm pretty sure, up to date with Jacobly0's llvm fork.

I think any programs / libraries that are no_core should compile fine but that limits what you're able to do quite a bit obviously

To compile core we would most likely want to make a fork of rustc, which after trying it for a while, I don't think is really possible without someone who has more knowledge about how it works as if we were to do that I would want to add support for 24 bit pointers

dtomvan commented 3 years ago

I don't know why its erroring on ret for you. The build of llc ive been using recently is, I'm pretty sure, up to date with Jacobly0's llvm fork.

In fact, ret also errored for me, when I tried to index in a str. Also, I let github compile his fork and I’m also pretty confident in that I am up-to-date as well.

I also saw that compiler is ~3000 files out-of-sync with the main project (~1800 commits). The call instruction is brand new (as far as I could find in the docs), so it is very likely this version of llc just doesn’t know about it yet.

samipourquoi commented 3 years ago

I am trying to do exactly that, but I got stuck at compile core too because llc just won't compile the LLVM-IR, because of a call instruction too. Glad to see I'm not the only one struggling lol.

I'm not particularly well-versed into LLVM and rustc so I really don't know what to do. Did you manage to make it work since, or do you even have any lead for that?