From 6c7eb2ee99470f37cd6347e11e7414ddbf3f2f9f Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 3 Nov 2016 16:39:41 -0700 Subject: [PATCH] fix asm syntax to be clang-compatible I'm unsure where all these %%s before register names comes from, but they confuse clang, like this: > criu/arch/arm/parasite-head.S:6:6: error: unexpected token in operand > sub %r2, %pc, #8 @ get the address of this instruction > ^ This patch looks scary, but all it does is removing %s before register names, fixing a few "many spaces instead of a tab" issues along the way. travis-ci: success for Fixes to compile on arm with clang Cc: Christopher Covington Dmitry Safonov Signed-off-by: Kir Kolyshkin Reviewed-by: Christopher Covington Signed-off-by: Pavel Emelyanov --- criu/arch/arm/include/asm/restore.h | 8 ++-- criu/arch/arm/include/asm/restorer.h | 52 ++++++++++++------------- criu/arch/arm/include/asm/syscall-aux.S | 14 +++---- criu/arch/arm/parasite-head.S | 14 +++---- criu/arch/arm/syscalls/syscall-common.S | 16 ++++---- 5 files changed, 52 insertions(+), 52 deletions(-) diff --git a/criu/arch/arm/include/asm/restore.h b/criu/arch/arm/include/asm/restore.h index ef4704f40..4c64d58ef 100644 --- a/criu/arch/arm/include/asm/restore.h +++ b/criu/arch/arm/include/asm/restore.h @@ -8,10 +8,10 @@ #define JUMP_TO_RESTORER_BLOB(new_sp, restore_task_exec_start, \ task_args) \ asm volatile( \ - "mov %%sp, %%%0 \n" \ - "mov %%r1, %%%1 \n" \ - "mov %%r0, %%%2 \n" \ - "bx %%r1 \n" \ + "mov sp, %0 \n" \ + "mov r1, %1 \n" \ + "mov r0, %2 \n" \ + "bx r1 \n" \ : \ : "r"(new_sp), \ "r"(restore_task_exec_start), \ diff --git a/criu/arch/arm/include/asm/restorer.h b/criu/arch/arm/include/asm/restorer.h index 2da417206..497c1eb19 100644 --- a/criu/arch/arm/include/asm/restorer.h +++ b/criu/arch/arm/include/asm/restorer.h @@ -69,8 +69,8 @@ struct rt_sigframe { #define ARCH_RT_SIGRETURN(new_sp) \ asm volatile( \ - "mov %%sp, %0 \n" \ - "mov %%r7, #"__stringify(__NR_rt_sigreturn)" \n" \ + "mov sp, %0 \n" \ + "mov r7, #"__stringify(__NR_rt_sigreturn)" \n" \ "svc #0 \n" \ : \ : "r"(new_sp) \ @@ -80,28 +80,28 @@ struct rt_sigframe { thread_args, clone_restore_fn) \ asm volatile( \ "clone_emul: \n" \ - "ldr %%r1, %2 \n" \ - "sub %%r1, #16 \n" \ - "mov %%r0, %%%6 \n" \ - "str %%r0, [%%r1, #4] \n" \ - "mov %%r0, %%%5 \n" \ - "str %%r0, [%%r1] \n" \ - "mov %%r0, %%%1 \n" \ - "mov %%r2, %%%3 \n" \ - "mov %%r3, %%%4 \n" \ - "mov %%r7, #"__stringify(__NR_clone)" \n" \ + "ldr r1, %2 \n" \ + "sub r1, #16 \n" \ + "mov r0, %6 \n" \ + "str r0, [r1, #4] \n" \ + "mov r0, %5 \n" \ + "str r0, [r1] \n" \ + "mov r0, %1 \n" \ + "mov r2, %3 \n" \ + "mov r3, %4 \n" \ + "mov r7, #"__stringify(__NR_clone)" \n" \ "svc #0 \n" \ \ - "cmp %%r0, #0 \n" \ + "cmp r0, #0 \n" \ "beq thread_run \n" \ \ - "mov %%%0, %%r0 \n" \ + "mov %0, r0 \n" \ "b clone_end \n" \ \ "thread_run: \n" \ - "pop { %%r1 } \n" \ - "pop { %%r0 } \n" \ - "bx %%r1 \n" \ + "pop { r1 } \n" \ + "pop { r0 } \n" \ + "bx r1 \n" \ \ "clone_end: \n" \ : "=r"(ret) \ @@ -115,9 +115,9 @@ struct rt_sigframe { #define ARCH_FAIL_CORE_RESTORE \ asm volatile( \ - "mov %%sp, %0 \n" \ - "mov %%r0, #0 \n" \ - "bx %%r0 \n" \ + "mov sp, %0 \n" \ + "mov r0, #0 \n" \ + "bx r0 \n" \ : \ : "r"(ret) \ : "memory") @@ -144,12 +144,12 @@ static inline int sigreturn_prep_fpu_frame(struct rt_sigframe *sigframe, static inline void restore_tls(tls_t *ptls) { asm ( - "mov %%r7, #15 \n" - "lsl %%r7, #16 \n" - "mov %%r0, #5 \n" - "add %%r7, %%r0 \n" /* r7 = 0xF005 */ - "ldr %%r0, [%0] \n" - "svc #0 \n" + "mov r7, #15 \n" + "lsl r7, #16 \n" + "mov r0, #5 \n" + "add r7, r0 \n" /* r7 = 0xF005 */ + "ldr r0, [%0] \n" + "svc #0 \n" : : "r"(ptls) : "r0", "r7" diff --git a/criu/arch/arm/include/asm/syscall-aux.S b/criu/arch/arm/include/asm/syscall-aux.S index 8bc01c3ec..22cc328c1 100644 --- a/criu/arch/arm/include/asm/syscall-aux.S +++ b/criu/arch/arm/include/asm/syscall-aux.S @@ -2,12 +2,12 @@ nr_sys_mmap: .long 192 ENTRY(sys_mmap) - push {%r4, %r5, %r7, %lr} - ldr %r4, [%sp, #16] - ldr %r5, [%sp, #20] - lsr %r5, #12 - adr %r7, nr_sys_mmap - ldr %r7, [%r7] + push {r4, r5, r7, lr} + ldr r4, [sp, #16] + ldr r5, [sp, #20] + lsr r5, #12 + adr r7, nr_sys_mmap + ldr r7, [r7] svc 0x00000000 - pop {%r4, %r5, %r7, %pc} + pop {r4, r5, r7, pc} END(sys_mmap) diff --git a/criu/arch/arm/parasite-head.S b/criu/arch/arm/parasite-head.S index b15fcbae2..7b41f56dd 100644 --- a/criu/arch/arm/parasite-head.S +++ b/criu/arch/arm/parasite-head.S @@ -3,17 +3,17 @@ .section .head.text, "ax" ENTRY(__export_parasite_head_start) - sub %r2, %pc, #8 @ get the address of this instruction + sub r2, pc, #8 @ get the address of this instruction - adr %r0, __export_parasite_cmd - ldr %r0, [%r0] + adr r0, __export_parasite_cmd + ldr r0, [r0] - adr %r1, parasite_args_ptr - ldr %r1, [%r1] - add %r1, %r1, %r2 @ fixup __export_parasite_args + adr r1, parasite_args_ptr + ldr r1, [r1] + add r1, r1, r2 @ fixup __export_parasite_args bl parasite_service - .byte 0xf0, 0x01, 0xf0, 0xe7 @ the instruction UDF #32 generates the signal SIGTRAP in Linux + .byte 0xf0, 0x01, 0xf0, 0xe7 @ the instruction UDF #32 generates the signal SIGTRAP in Linux parasite_args_ptr: .long __export_parasite_args diff --git a/criu/arch/arm/syscalls/syscall-common.S b/criu/arch/arm/syscalls/syscall-common.S index c3cbf7105..0e4367069 100644 --- a/criu/arch/arm/syscalls/syscall-common.S +++ b/criu/arch/arm/syscalls/syscall-common.S @@ -8,11 +8,11 @@ @ between parasite_service() and sys_munmap(). syscall_common: - ldr %r7, [%r7] - add %r8, %sp, #24 - ldm %r8, {%r4, %r5, %r6} + ldr r7, [r7] + add r8, sp, #24 + ldm r8, {r4, r5, r6} svc 0x00000000 - pop {%r4, %r5, %r6, %r7, %r8, %pc} + pop {r4, r5, r6, r7, r8, pc} .macro syscall name, nr @@ -20,15 +20,15 @@ syscall_common: .long \nr ENTRY(\name) - push {%r4, %r5, %r6, %r7, %r8, %lr} - adr %r7, .nr_\name + push {r4, r5, r6, r7, r8, lr} + adr r7, .nr_\name b syscall_common END(\name) .endm ENTRY(__cr_restore_rt) - adr %r7, .nr_sys_rt_sigreturn - ldr %r7, [%r7] + adr r7, .nr_sys_rt_sigreturn + ldr r7, [r7] svc #0 END(__cr_restore_rt)