From: Matthijs K. <mat...@st...> - 2013-09-27 10:30:59
|
Hi folks, I just tried avr-llvm for the first time and after I finally properly followed the official instructions (I first didn't see that you also need a patched clang), I got things to run and compile. I did need a tiny patch to make it compile (PCSymbol was removed in llvm r191362): Index: AVR/MCTargetDesc/AVRMCAsmInfo.cpp =================================================================== --- AVR/MCTargetDesc/AVRMCAsmInfo.cpp (revision 293) +++ AVR/MCTargetDesc/AVRMCAsmInfo.cpp (working copy) @@ -22,7 +22,6 @@ { PointerSize = CalleeSaveStackSlotSize = 2; - PCSymbol = "."; CommentString = ";"; PrivateGlobalPrefix = ".L"; Running clang for my ATtiny13, I did get another error: $ clang -Os -I/usr/lib/avr/include -D__AVR_ATtiny13__ -target avr -Wno-attributes backpack.c /tmp/backpack-7ccd60.s: Assembler messages: /tmp/backpack-7ccd60.s:376: Error: illegal opcode call for mcu avr2 /tmp/backpack-7ccd60.s:462: Error: illegal opcode call for mcu avr2 /tmp/backpack-7ccd60.s:503: Error: illegal opcode call for mcu avr2 /tmp/backpack-7ccd60.s:505: Error: illegal opcode call for mcu avr2 clang-3.4: error: assembler (via gcc) command failed with exit code 1 (use -v to see invocation) I'm not entirely sure if I'm specifying my target CPU correctly, but the complaint from the assembler looks valid (the tiny13 really doesn't have a call instruction, only icall and rcall). Looking in the code, I don't see anything for emitting rcall, so I guess this is just not implemented yet. If I simply replace the call instruction with rcall in the code, my program compiles succesfully. Index: AVRInstrInfo.td =================================================================== --- AVRInstrInfo.td (revision 293) +++ AVRInstrInfo.td (working copy) @@ -812,7 +812,7 @@ //:TODO: the imm field can be either 16 or 22 bits in devices with more // than 64k of ROM, fix it once we support the largests devices. (ins i16imm:$dst), - "call\t$dst", + "rcall\t$dst", [(AVRcall imm:$dst)]>; } This is probably not the best way to fix this, though. Thinking about it, I'm not sure what a proper fix would be. For small targets, just using rcall is fine. However, for bigger targets, one would want to use rcall whenever possible, or fall back to call otherwise. But I don't think you can actually know (in all cases) if using rcall is possible until after assembling, right? Gr. Matthijs |