I'm writing a C project in Xcode and I'd like to link a separate assembly file to be compiled along with the project. But I need the assembly to be written in Intel syntax since I find AT&T syntax absolutely grotesque.
Unfortunately, Apple's default Clang compiler doesn't like me writing my assembly code in Intel and prefers AT&T. Is there a setting I can change to allow my separate assembly file to be written in Intel syntax?
As an example, this assembles:
.text
.global _func
func:
mov %rdx,%rax
ret
But this doesn't assemble
.text
.global _func
_func:
mov rax,rdx
ret
The compiler throws errors with the latter example.
_func Is being called from the C code.
#include <stdio.h>
void func(void);
int main(int argc, const char * argv[]) {
func();
return 0;
}
To clarify, I am not writing inline assembly.