Moshe Kravchik
2013-Jun-12 12:51 UTC
[LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode"
Hi, I've got an assembly file which used to compile with previous clang versions. However with 4.2 I get the following error: admin$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 ./src/asm.s -o asm.o ./src/asm.s:30:5: error: instruction requires a CPU feature not currently enabled add r2, pc, r2 According to ARM specification:Use of PC and SP in Thumb instructionsIn most of these instructions, you cannot use PC (R15) for Rd, or any operand.The exceptions are:you can use PC for Rn in 32-bit Thumb ADD and SUB instructions, with a constant Operand2 value in the range 0-4095, and no S suffix. These instructions are useful for generating PC-relative addresses. Bit[1] of the PC value reads as 0 in this case, so that the base address for the calculation is always word-aligned.you can use PC in 16-bit Thumb ADD{cond} Rd, Rd, Rm instructions, where both registers cannot be PC. I indeed specified that this line belongs to the Thumb function. But the clang still produces this error. When I compile this file directly with "as" it compiles correctly. Please help! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130612/1d8d00e1/attachment.html>
Joe Abbey
2013-Jun-12 13:02 UTC
[LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode"
Moshe, You're more than likely going to get a better response from https://devforums.apple.com/community/tools/xcode llvmdev is a mailing list for the LLVM project which is separate from Xcode development. Cheers, Joe On Jun 12, 2013, at 8:51 AM, Moshe Kravchik <mkravchik at hotmail.com<mailto:mkravchik at hotmail.com>> wrote: Hi, I've got an assembly file which used to compile with previous clang versions. However with 4.2 I get the following error: admin$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 ./src/asm.s -o asm.o ./src/asm.s:30:5: error: instruction requires a CPU feature not currently enabled add r2, pc, r2 According to ARM <http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/Cihcjfjg.html> specification: [http://infocenter.arm.com/help/topic/com.arm.doc.common/images/triangle_down.png]Use of PC and SP in Thumb instructions In most of these instructions, you cannot use PC (R15) for Rd, or any operand. The exceptions are: * you can use PC for Rn in 32-bit Thumb ADD and SUB instructions, with a constant Operand2 value in the range 0-4095, and no S suffix. These instructions are useful for generating PC-relative addresses. Bit[1] of the PC value reads as 0 in this case, so that the base address for the calculation is always word-aligned. * you can use PC in 16-bit Thumb ADD{cond} Rd, Rd, Rm instructions, where both registers cannot be PC. I indeed specified that this line belongs to the Thumb function. But the clang still produces this error. When I compile this file directly with "as" it compiles correctly. Please help! _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130612/6bce60c1/attachment.html>
Joe Abbey
2013-Jun-12 13:05 UTC
[LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode"
There is also this forum: https://devforums.apple.com/community/tools/llvm Cheers, Joe On Jun 12, 2013, at 9:02 AM, Joe Abbey <jabbey at arxan.com<mailto:jabbey at arxan.com>> wrote: Moshe, You're more than likely going to get a better response from https://devforums.apple.com/community/tools/xcode llvmdev is a mailing list for the LLVM project which is separate from Xcode development. Cheers, Joe On Jun 12, 2013, at 8:51 AM, Moshe Kravchik <mkravchik at hotmail.com<mailto:mkravchik at hotmail.com>> wrote: Hi, I've got an assembly file which used to compile with previous clang versions. However with 4.2 I get the following error: admin$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 ./src/asm.s -o asm.o ./src/asm.s:30:5: error: instruction requires a CPU feature not currently enabled add r2, pc, r2 According to ARM <http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/Cihcjfjg.html> specification: [http://infocenter.arm.com/help/topic/com.arm.doc.common/images/triangle_down.png]Use of PC and SP in Thumb instructions In most of these instructions, you cannot use PC (R15) for Rd, or any operand. The exceptions are: * you can use PC for Rn in 32-bit Thumb ADD and SUB instructions, with a constant Operand2 value in the range 0-4095, and no S suffix. These instructions are useful for generating PC-relative addresses. Bit[1] of the PC value reads as 0 in this case, so that the base address for the calculation is always word-aligned. * you can use PC in 16-bit Thumb ADD{cond} Rd, Rd, Rm instructions, where both registers cannot be PC. I indeed specified that this line belongs to the Thumb function. But the clang still produces this error. When I compile this file directly with "as" it compiles correctly. Please help! _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu<http://llvm.cs.uiuc.edu/> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130612/4322d471/attachment.html>
Tim Northover
2013-Jun-12 17:53 UTC
[LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode"
Hi Moshe, The others are right that you'll likely get better Apple-specific help at the forums, but this problem happens to be the same in generic LLVM.> ./src/asm.s:30:5: error: instruction requires a CPU feature not currently enabled > > add r2, pc, r2 > > According to ARM specification:The specifications you're referring to are a little vague, and the actual instruction definitions give the real situation (page/section A3-308). I think it boils down to: "add r2, r2, pc" should be allowed (but LLVM doesn't, this is a bug). "add r2, pc" should be allowed (and is) "add r2, pc, r2" should be allowed *if* it's in an IT block (but LLVM doesn't, this is a bug). That last one might be rather tricky to implement. I'll take a bit of a look, but may not have time to do it properly. Reporting it at llvm.org/bugs (and/or bugreporter.apple.com since that seems to be your platform) would make sure it doesn't get lost. Cheers. Tim.
Moshe Kravchik
2013-Jun-12 19:18 UTC
[LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode"
So probably it is a LLVM issue - can anyone from the team look at it and let me know if there is anything to do. Moshe> Date: Wed, 12 Jun 2013 10:53:56 -0700 > Subject: Re: [LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode" > From: t.p.northover at gmail.com > To: mkravchik at hotmail.com > CC: llvmdev at cs.uiuc.edu > > Hi Moshe, > > The others are right that you'll likely get better Apple-specific help > at the forums, but this problem happens to be the same in generic > LLVM. > > > ./src/asm.s:30:5: error: instruction requires a CPU feature not currently enabled > > > > add r2, pc, r2 > > > > According to ARM specification: > > The specifications you're referring to are a little vague, and the > actual instruction definitions give the real situation (page/section > A3-308). > > I think it boils down to: > "add r2, r2, pc" should be allowed (but LLVM doesn't, this is a bug). > "add r2, pc" should be allowed (and is) > "add r2, pc, r2" should be allowed *if* it's in an IT block (but LLVM > doesn't, this is a bug). > > That last one might be rather tricky to implement. I'll take a bit of > a look, but may not have time to do it properly. Reporting it at > llvm.org/bugs (and/or bugreporter.apple.com since that seems to be > your platform) would make sure it doesn't get lost. > > Cheers. > > Tim.-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130612/e87ed436/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode"
- [LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode"
- [LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode"
- [LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode"
- [LLVMdev] Apple clang 4.2 based on llvm 3.2 produces a wrong "instruction requires:arm-mode"