Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

sbiw, adiw require a CPU feature not currently enabled #150

Closed
@seanmkauffman

Description

@seanmkauffman

I built the latest version of AVR LLVM, which has come a long way in the last couple of months, but I'm running into an issue compiling to object code with a source file I'm using.

I can generate assembly from the file using the AVR LLVM backend, but I can't reduce it to object code using the AVR LLVM tools. If I try to go directly from the IR, I get a very unhelpful LLVM ERROR: expected relocatable expression with no indication of what is causing it. If I try to use llvm-mc to assemble the .s file, I get errors about sbiw and adiw requiring a CPU feature not currently enabled.

$ ~/workspace/avr-work/bin/clang -O0 --target=avr-none-none -emit-llvm -I/usr/avr/include/ -S aes.c -o aes.ll
$ ~/workspace/avr-work/bin/llc -mtriple=avr-none -mcpu=atmega2560 -filetype=obj aes.ll -o aes.o 
LLVM ERROR: expected relocatable expression
 $ ~/workspace/avr-work/bin/llc -mtriple=avr-none -mcpu=atmega2560 -filetype=asm aes.ll -o aes.s
 $ ~/workspace/avr-work/bin/llvm-mc -triple=avr-none -mcpu=atmega2560 -filetype=obj aes.s -o aes.o
aes.s:22:2: error: instruction requires a CPU feature not currently enabled
        sbiw    r28, 24
        ^
aes.s:243:2: error: instruction requires a CPU feature not currently enabled
        adiw    r28, 24
        ^
aes.s:1507:2: error: instruction requires a CPU feature not currently enabled
        sbiw    r30, 32
        ^
aes.s:1938:2: error: instruction requires a CPU feature not currently enabled
        sbiw    r30, 32
        ^
aes.s:2088:2: error: instruction requires a CPU feature not currently enabled
        sbiw    r28, 42
        ^
aes.s:7258:2: error: instruction requires a CPU feature not currently enabled
        adiw    r28, 42
        ^
aes.s:7287:2: error: instruction requires a CPU feature not currently enabled
        sbiw    r28, 42
        ^
aes.s:12457:2: error: instruction requires a CPU feature not currently enabled
        adiw    r28, 42
        ^

(note I'm glossing over some warnings generated by clang, but those are related to the program, not to this project)

I'm opening this issue in the hopes that this problem is not enormously complicated to solve. I'd love to provide more information for debugging purposes. I'm really not sure how to isolate this into a simpler test case. The source file in question can be found here

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions