<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<div><br></div><div>I've got an assembly file which used to compile with previous clang versions. However with 4.2 I get the following error:</div><div><br></div><div><p class="MsoNormal"><span style="font-family: 'Courrier New';"><font size="3">admin$
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch armv7 ./src/asm.s  -o asm.o<o:p></o:p></font></span></p>

<p class="MsoNormal"><span style="font-family: 'Courrier New';"><font size="3">./src/asm.s:30:5: error: instruction requires
a CPU feature not currently enabled<o:p></o:p></font></span></p>

<p class="MsoNormal"><span style="font-family: 'Courrier New';"><font size="3">    add r2, pc, r2</font><span style="font-size: 9pt;"><o:p></o:p></span></span></p><p class="MsoNormal"><span style="font-size:9.0pt;
font-family:"Courrier New""><br></span></p><p class="MsoNormal">According to <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/Cihcjfjg.html">ARM </a>specification:</p><div class="titlepage" style="font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; font-size: small;"><h4 class="title" style="font-size: 1.1em; clear: both; margin-top: 1.2em; margin-bottom: 0px;"><img class="toggler" id="id4666174_toggler" src="http://infocenter.arm.com/help/topic/com.arm.doc.common/images/triangle_down.png" alt="Show/hide" style="cursor: pointer;">Use of PC and SP in Thumb instructions</h4></div><div id="id4666174_contents" style="font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; font-size: small; margin-top: 0.4em !important; margin-bottom: 0.2em !important;"><p style="margin-top: 0.8em; margin-bottom: 0.2em;">In most of these instructions, you cannot use PC (<code class="literal" style="color: rgb(51, 51, 153); font-family: 'Lucida Sans Typewriter', 'Courier New', Courier, monospace; font-size: 0.9em;">R15</code>) for <code class="literal" style="color: rgb(51, 51, 153); font-family: 'Lucida Sans Typewriter', 'Courier New', Courier, monospace; font-size: 0.9em;"><em class="replaceable">Rd</em></code>, or any operand.</p><p style="margin-top: 0.8em; margin-bottom: 0.2em;">The exceptions are:</p><div class="itemizedlist"><ul type="disc" style="margin-top: 0.8em; margin-bottom: 0.2em;"><li style="margin-top: 0.6em; margin-bottom: 0.2em;"><p style="margin-top: 0.4em; margin-bottom: 0.2em;">you can use PC for <code class="literal" style="color: rgb(51, 51, 153); font-family: 'Lucida Sans Typewriter', 'Courier New', Courier, monospace; font-size: 0.9em; margin-top: 0.4em; margin-bottom: 0.2em;"><em class="replaceable" style="margin-top: 0.4em; margin-bottom: 0.2em;"><code style="color: inherit; font-family: inherit; margin-top: 0.4em; margin-bottom: 0.2em;">Rn</code></em></code> in 32-bit Thumb <code class="code" style="color: rgb(51, 51, 153); font-family: 'Lucida Sans Typewriter', 'Courier New', Courier, monospace; font-size: 0.9em; margin-top: 0.4em; margin-bottom: 0.2em;">ADD</code> and <code class="code" style="color: rgb(51, 51, 153); font-family: 'Lucida Sans Typewriter', 'Courier New', Courier, monospace; font-size: 0.9em; margin-top: 0.4em; margin-bottom: 0.2em;">SUB</code> instructions, with a constant <code class="literal" style="color: rgb(51, 51, 153); font-family: 'Lucida Sans Typewriter', 'Courier New', Courier, monospace; font-size: 0.9em; margin-top: 0.4em; margin-bottom: 0.2em;"><em class="replaceable" style="margin-top: 0.4em; margin-bottom: 0.2em;"><code style="color: inherit; font-family: inherit; margin-top: 0.4em; margin-bottom: 0.2em;">Operand2</code></em></code> value in the range 0-4095, and no <code class="literal" style="color: rgb(51, 51, 153); font-family: 'Lucida Sans Typewriter', 'Courier New', Courier, monospace; font-size: 0.9em; margin-top: 0.4em; margin-bottom: 0.2em;">S</code> 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.</p></li><li style="margin-top: 0.6em; margin-bottom: 0.2em;"><p style="margin-top: 0.4em; margin-bottom: 0.2em;">you can use PC in 16-bit Thumb <code class="code" style="color: rgb(51, 51, 153); font-family: 'Lucida Sans Typewriter', 'Courier New', Courier, monospace; font-size: 0.9em; margin-top: 0.4em; margin-bottom: 0.2em;">ADD{<em class="replaceable" style="margin-top: 0.4em; margin-bottom: 0.2em;"><code style="color: inherit; font-family: inherit; margin-top: 0.4em; margin-bottom: 0.2em;">cond</code></em>} Rd, Rd, Rm</code> instructions, where both registers cannot be PC.</p><p style="margin-top: 0.4em; margin-bottom: 0.2em;"><br></p><p style="margin-top: 0.4em; margin-bottom: 0.2em;"><br></p><p style="margin-top: 0.4em; margin-bottom: 0.2em;">I indeed specified that this line belongs to the Thumb function. But the clang still produces this error.</p><p style="margin-top: 0.4em; margin-bottom: 0.2em;"><br></p><p style="margin-top: 0.4em; margin-bottom: 0.2em;">When I compile this file directly with "as" it compiles correctly.</p><p style="margin-top: 0.4em; margin-bottom: 0.2em;"><br></p><p style="margin-top: 0.4em; margin-bottom: 0.2em;"><br></p><p style="margin-top: 0.4em; margin-bottom: 0.2em;">Please help!</p><p style="margin-top: 0.4em; margin-bottom: 0.2em;"><br></p><p style="margin-top: 0.4em; margin-bottom: 0.2em;"> </p></li></ul></div></div></div>                                     </div></body>
</html>