You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Clang as packaged by Ubuntu: Ubuntu clang version 3.5-1ubuntu1 (trunk) (based on LLVM 3.5)
This doesn't seem to agree with the available options in the 'version' field.
Consider the following test function:
int test(void) {
int out;
asm(" ldr %0, =%1\n" : "=r" (out) : "i" (0x000f0002));
return out;
}
The instruction generated by the inline assembly is "ldr r0, =#983042", since "i" constraints get a leading hash character by default. The GNU assembler ignores this character, but Clang does not:
test.c:4:7: error: unknown token in expression
asm(" ldr %0, =%1\n" : "=r" (out) : "i" (0x000f0002));
^
:1:13: note: instantiated into assembly here
ldr r0, =#983042
^
1 error generated.
GCC has an (undocumented) substitution predicate which causes the hash character to be omitted ("ldr %0, =%c1"), and Clang appears to support this, but this still represents an incompatibility with GCC and therefore might be considered a bug.
The text was updated successfully, but these errors were encountered:
I'm using Clang as packaged by Ubuntu: Ubuntu clang version 3.5-1ubuntu1
(trunk) (based on LLVM 3.5)
This doesn't seem to agree with the available options in the 'version' field.
Perhaps I was wrong about that, if Ubuntu have packaged a version from Clang's trunk.
I found that GAS ARM Machine Directive ".syntax unified"
responsible for successful compilation
ldr r0, =#983042
9.4.2.1 Instruction Set Syntax
...
The new, unified syntax, which can be selected via the .syntax directive,
and has the following main features:
Immediate operands do not require a # prefix.
...
So, it's really undocumented.
We have excessive #
Extended Description
I'm using Clang as packaged by Ubuntu: Ubuntu clang version 3.5-1ubuntu1 (trunk) (based on LLVM 3.5)
This doesn't seem to agree with the available options in the 'version' field.
Consider the following test function:
int test(void) {
int out;
asm(" ldr %0, =%1\n" : "=r" (out) : "i" (0x000f0002));
return out;
}
The instruction generated by the inline assembly is "ldr r0, =#983042", since "i" constraints get a leading hash character by default. The GNU assembler ignores this character, but Clang does not:
test.c:4:7: error: unknown token in expression
asm(" ldr %0, =%1\n" : "=r" (out) : "i" (0x000f0002));
^
:1:13: note: instantiated into assembly here
ldr r0, =#983042
^
1 error generated.
GCC has an (undocumented) substitution predicate which causes the hash character to be omitted ("ldr %0, =%c1"), and Clang appears to support this, but this still represents an incompatibility with GCC and therefore might be considered a bug.
The text was updated successfully, but these errors were encountered: