On Wed, 8 May 2013, Niels Möller wrote:
Nikos Mavrogiannopoulos nmav@gnutls.org writes:
Trying to build nettle 2.7 for an arm10 system of mine using its (old) toolchain fails with assembler errors.
arm-linux-gcc -Os -I[...] -I. -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wno-pointer-sign -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wbad-function-cast -Wnested-externs -fpic -MT aes-decrypt-internal.o -MD -MP -MF aes-decrypt-internal.o.d -fpic -c aes-decrypt-internal.s aes-decrypt-internal.s: Assembler messages: aes-decrypt-internal.s:81: Error: bad instruction `push {r4,r5,r6,r7,r8,r10,r11,lr}' aes-decrypt-internal.s:87: Error: register or shift expression expected -- `orr r4,r8,lsl#8' aes-decrypt-internal.s:89: Error: register or shift expression expected -- `orr r4,r8,lsl#16' aes-decrypt-internal.s:91: Error: register or shift expression expected -- `orr r4,r8,lsl#24' aes-decrypt-internal.s:93: Error: bad arguments to instruction -- `eor r4,r8' [...] make[2]: *** [aes-decrypt-internal.o] Error 1
I recently got a similar bugreport from a user with an arm system running freebsd with an ancient GNU as. I think it would make sense to use more traditional ARM asm syntax. Things I'm aware of:
Always use 3-operand form instructions, i.e.,
add r1, r1, r2
rather then
add r1, r2
- Write shift and rotate instructions as mov with a shift/rotate
operand.
Add explicit ia/db suffixes on push, pop, ldm, stm.
Some file uses "unified" assembler syntax. Revert to traditional arm
syntax (unless we have a good reason to support compiling to thumb instructions? I don't really understand pros and cons there).
I wouldn't suggest moving away from the unified syntax - being able to build for both thumb and arm from the same source is useful. Normally it's sufficient to support only arm mode, but there are certain cases where you want/need to build in thumb mode. One of them is the fact that windows 8 on arm (WinRT and Windows Phone 8) only supports thumb mode.
If the instructions can be written more elaborately to allow older tools to assemble them, without making the code itself worse, it's probably a good tradeoff.
// Martin