<div dir="ltr"><div>FYI, an initial patch for handling some assembler-time absolute expressions for parsing is is being discussed here (<a href="https://reviews.llvm.org/D45164">https://reviews.llvm.org/D45164</a>).<br></div><div><br></div><div>-Nirav</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Apr 16, 2018 at 12:32 PM Peter Smith via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">><br>
> Hi,<br>
><br>
><br>
> I work in arm in an open source project called TF [1], and we support<br>
> compilation with clang. We want to get rid of GNU tools when a clang<br>
> toolchain is used, but we found some problems when we try to use the<br>
> clang assembler:<br>
><br>
> - .func, .endfunc and .struct directives are not supported<br>
> - substraction of relative labels doesn't produce absolute<br>
> values<br>
><br>
> .if (. - \begin) > 32)<br>
><br>
> generates 'error: expected absolute expression' message<br>
><br>
> Is clang going to support these features?<br>
><br>
> Best regards,<br>
><br>
><br>
> [1] <a href="https://github.com/ARM-software/arm-trusted-firmware" rel="noreferrer" target="_blank">https://github.com/ARM-software/arm-trusted-firmware</a><br>
<br>
Hello Roberto,<br>
<br>
Although I can't speak for the whole community, my predictions:<br>
- .func and .endfunc are unlikely as this is documented only to do<br>
something when the stabs debugging is enabled and clang is unlikely to<br>
support stabs. See <a href="https://sourceforge.net/p/libjpeg-turbo/bugs/72/" rel="noreferrer" target="_blank">https://sourceforge.net/p/libjpeg-turbo/bugs/72/</a><br>
<br>
- .struct seems feasible, but I don't know if anyone has any plans to<br>
implement it.<br>
<br>
- Subtraction of relative labels is unlikely in a .if statement. MC<br>
can produce absolute values for relative labels in some cases but it<br>
requires a layout. Instruction relaxation, such as turning a 16-bit<br>
Thumb branch into a 32-bit Thumb 2 branch if the distance requires it,<br>
means that the distance between 2 labels isn't known until the layout<br>
finalises. For .if the expression evaluation needs to occur before<br>
relaxation as the result of the .if could affect relaxation. In theory<br>
it could be possible to alter the assembler to calculate part of the<br>
layout inline and handle some expressions, but I don't think that the<br>
disruption to the implementation would be worth it.<br>
<br>
Peter<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>