2
votes

I have generated an assembly file try.s with aarch64 instruction set.I want to compile this on an ARM8 (aarch64 processor) running ubuntu. my native compiler is gcc(4.8) and i use the following command to compile

gcc -o try.o try.s

I am getting the following errors Error : ARM register expected -- mov x10,x0

It seems like the aarch4 registers are not being recognized although i thought gcc 4.8 supported aarch64. Can someone tell me what am i missing or is there any special option i should include.Or suggest me a native compiler(not cross-compilers) for doing aarch64.I would also like to use gdb to debug this natively.

1
Did you try generating asm from a C file (with gcc -S) to compare with your syntax? (and actually completely compile to check that your compiler works, but if it is the one that comes with Ubuntu, it should) - Marc Glisse
so... when i cross compiled it on an x-86 system with g++-arch64-linux-gnu it compiles allright, which makes me think the syntax is correct.Also It throws an error saying ARM register expected when i use the 64 bit access(x0-x30) :( . yeah compiler came with ubuntu gcc 4.8.2 - c_mnon
Which Ubuntu is that? I tried on a aarch64 machine on the gcc test farm that has Ubuntu 14.04.3 LTS, and gcc is 4.8.4-2ubuntu1~14.04. - Marc Glisse
Yup, 32-bit assembler. Either you've got some messed up multiarch packages going on or you're unwittingly running a whole 32-bit userspace (I'd check what uname -a reports). - Notlikethat
Notlikethat guessed right, you installed a whole 32-bit userspace... You will have to reinstall the whole thing, picking the right version of Ubuntu this time. - Marc Glisse

1 Answers

1
votes

gcc is for a 32b targets. 'Xn' registers are not defined for a aarch32 instruction set. That's what compiler tells you.


Right toolchain is aarch64-elf-gcc.

PS: that's a good idea to make asm file extention .S (capital s)