Skip to content

[AVR] crash on attiny85: cannot create long jump without FeatureJMPCALL #67042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aykevl opened this issue Sep 21, 2023 · 4 comments · Fixed by #67324
Closed

[AVR] crash on attiny85: cannot create long jump without FeatureJMPCALL #67042

aykevl opened this issue Sep 21, 2023 · 4 comments · Fixed by #67324
Assignees

Comments

@aykevl
Copy link
Contributor

aykevl commented Sep 21, 2023

The following IR file crashes when compiled with llc-17:

$ LLVM_SYMBOLIZER_PATH=llvm-symbolizer-17 llc-17 crash.ll
LLVM ERROR: cannot create long jump without FeatureJMPCALL
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc-17 crash.ll
1.      Running pass 'Function Pass Manager' on module 'crash.ll'.
2.      Running pass 'Branch relaxation pass' on function '@__d_vfprintf'
 #0 0x0000fffef6807f98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xcc7f98)
 #1 0x0000fffef6806260 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xcc6260)
 #2 0x0000fffef680867c (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xcc867c)
 #3 0x0000fffefcbe87d0 (linux-vdso.so.1+0x7d0)
 #4 0x0000fffef57009d0 (/lib/aarch64-linux-gnu/libc.so.6+0x809d0)
 #5 0x0000fffef56ba76c raise (/lib/aarch64-linux-gnu/libc.so.6+0x3a76c)
 #6 0x0000fffef56a74bc abort (/lib/aarch64-linux-gnu/libc.so.6+0x274bc)
 #7 0x0000fffef676a5e8 llvm::report_fatal_error(llvm::Twine const&, bool) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xc2a5e8)
 #8 0x0000fffef676a434 llvm::report_fatal_error(llvm::Twine const&, bool) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xc2a434)
 #9 0x0000fffef8868e70 (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0x2d28e70)
#10 0x0000fffef6a36f28 (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xef6f28)
#11 0x0000fffef6b88774 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0x1048774)
#12 0x0000fffef6944bd8 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xe04bd8)
#13 0x0000fffef694a2b4 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xe0a2b4)
#14 0x0000fffef6945150 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xe05150)
#15 0x0000aaaad4c30e64 main (/usr/lib/llvm-17/bin/llc+0x10e64)
#16 0x0000fffef56a7780 (/lib/aarch64-linux-gnu/libc.so.6+0x27780)
#17 0x0000fffef56a7858 __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x27858)
#18 0x0000aaaad4c2c5f0 _start (/usr/lib/llvm-17/bin/llc+0xc5f0)
fish: Job 1, 'LLVM_SYMBOLIZER_PATH=llvm-symbo…' terminated by signal SIGABRT (Abort)

crash.zip

This was introduced in https://reviews.llvm.org/D155570 (eb33db4).

CC @jacquesguan @benshi001

@aykevl aykevl added backend:AVR bug Indicates an unexpected problem or unintended behavior and removed bug Indicates an unexpected problem or unintended behavior labels Sep 21, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 21, 2023

@llvm/issue-subscribers-bug

The following IR file crashes when compiled with llc-17:
$ LLVM_SYMBOLIZER_PATH=llvm-symbolizer-17 llc-17 crash.ll
LLVM ERROR: cannot create long jump without FeatureJMPCALL
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc-17 crash.ll
1.      Running pass 'Function Pass Manager' on module 'crash.ll'.
2.      Running pass 'Branch relaxation pass' on function '@<!-- -->__d_vfprintf'
 #<!-- -->0 0x0000fffef6807f98 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xcc7f98)
 #<!-- -->1 0x0000fffef6806260 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xcc6260)
 #<!-- -->2 0x0000fffef680867c (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xcc867c)
 #<!-- -->3 0x0000fffefcbe87d0 (linux-vdso.so.1+0x7d0)
 #<!-- -->4 0x0000fffef57009d0 (/lib/aarch64-linux-gnu/libc.so.6+0x809d0)
 #<!-- -->5 0x0000fffef56ba76c raise (/lib/aarch64-linux-gnu/libc.so.6+0x3a76c)
 #<!-- -->6 0x0000fffef56a74bc abort (/lib/aarch64-linux-gnu/libc.so.6+0x274bc)
 #<!-- -->7 0x0000fffef676a5e8 llvm::report_fatal_error(llvm::Twine const&amp;, bool) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xc2a5e8)
 #<!-- -->8 0x0000fffef676a434 llvm::report_fatal_error(llvm::Twine const&amp;, bool) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xc2a434)
 #<!-- -->9 0x0000fffef8868e70 (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0x2d28e70)
#<!-- -->10 0x0000fffef6a36f28 (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xef6f28)
#<!-- -->11 0x0000fffef6b88774 llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0x1048774)
#<!-- -->12 0x0000fffef6944bd8 llvm::FPPassManager::runOnFunction(llvm::Function&amp;) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xe04bd8)
#<!-- -->13 0x0000fffef694a2b4 llvm::FPPassManager::runOnModule(llvm::Module&amp;) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xe0a2b4)
#<!-- -->14 0x0000fffef6945150 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xe05150)
#<!-- -->15 0x0000aaaad4c30e64 main (/usr/lib/llvm-17/bin/llc+0x10e64)
#<!-- -->16 0x0000fffef56a7780 (/lib/aarch64-linux-gnu/libc.so.6+0x27780)
#<!-- -->17 0x0000fffef56a7858 __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x27858)
#<!-- -->18 0x0000aaaad4c2c5f0 _start (/usr/lib/llvm-17/bin/llc+0xc5f0)
fish: Job 1, 'LLVM_SYMBOLIZER_PATH=llvm-symbo…' terminated by signal SIGABRT (Abort)

crash.zip

This was introduced in https://reviews.llvm.org/D155570 (eb33db4).

CC @jacquesguan @benshi001

aykevl added a commit to tinygo-org/tinygo that referenced this issue Sep 23, 2023
These parts aren't critical and lead to crashes on small chips without
long jumps (like the attiny85) with LLVM 17. (Older LLVM versions would
emit long jumps regardless, even if the chip didn't support those).

For more information, see: llvm/llvm-project#67042
aykevl added a commit to tinygo-org/tinygo that referenced this issue Sep 23, 2023
These parts aren't critical and lead to crashes on small chips without
long jumps (like the attiny85) with LLVM 17. (Older LLVM versions would
emit long jumps regardless, even if the chip didn't support those).

For more information, see: llvm/llvm-project#67042
@jaedson-barbosa
Copy link

Any news on this?

@benshi001
Copy link
Member

This seems harder, I need more time to fix.

@aykevl @jacquesguan

I plan to use pseudo instructions something like

ldi r30, low_addr
ldi r31, high_addr
imp

But the AVRExpandPseudo Pass runs before the BranchRelazation pass, so my way does not work. Do you have better solution for this?

@benshi001
Copy link
Member

A better solution would be introducing "code model", like riscv did
https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/RISCV/jumptable.ll#L4

when --model-mode=medium is specified, we use indirect branch ijmp instead of short direct branch rjmp, for AVR devices without long direct jump.

aykevl added a commit to tinygo-org/tinygo that referenced this issue Oct 4, 2023
These parts aren't critical and lead to crashes on small chips without
long jumps (like the attiny85) with LLVM 17. (Older LLVM versions would
emit long jumps regardless, even if the chip didn't support those).

For more information, see: llvm/llvm-project#67042
deadprogram pushed a commit to tinygo-org/tinygo that referenced this issue Oct 6, 2023
These parts aren't critical and lead to crashes on small chips without
long jumps (like the attiny85) with LLVM 17. (Older LLVM versions would
emit long jumps regardless, even if the chip didn't support those).

For more information, see: llvm/llvm-project#67042
crypto-smoke pushed a commit to meshnet-gophers/tinygo that referenced this issue Feb 14, 2024
These parts aren't critical and lead to crashes on small chips without
long jumps (like the attiny85) with LLVM 17. (Older LLVM versions would
emit long jumps regardless, even if the chip didn't support those).

For more information, see: llvm/llvm-project#67042
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants