[cfe-users] Clang inline assembly issue
Ghitulete Razvan
razvan.ghitulete at gmail.com
Fri Jan 17 05:30:52 PST 2014
Hi guys,
I have a issue caused by some inline assembly. Basically when there is file
scope inline assembly the clang front end will not include it in any
section if the section is not specified by the inline asm itself.
Furthermore this issue seems to only occur when generating LLVM bitcode.
That is for the following code snippet
<code>
__asm__(".globl func\n\t.align 4\nfunc: ret");
int main() { return 0 ;}
</code>
We have the following cases:
$ clang file.c -o binary # compiles without errors
$ echo $?
0
$ clang -c -flto file.c -o file.o
$ ld.gold -plugin /opt/llvm/lib/LLVMgold.so file.o -o binary
error: expected section directive before assembly directive
.align 4
...
I wasn't able to find any paper or thorough documentation on how the
compilation is handled by clang in these two cases. Shouldn't it behave
identical?
--
Sincerely,
Razvan Ghitulete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20140117/5a499f8c/attachment.html>
More information about the cfe-users
mailing list