]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/syscall_shim: Fix C++ build error with Clang
authorRazvan Deaconescu <razvand@unikraft.io>
Thu, 19 Dec 2024 06:48:32 +0000 (08:48 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Fri, 20 Dec 2024 15:08:00 +0000 (15:08 +0000)
Clang (18) requires a space between identifier and literals for
preprocessor string concatenation. Otherwise, it results in build error.
The error shown is: "C++11 requires a space between literal and
identifier".

Add required spaces to fix the build error.

Checkpatch-Ignore: LONG_LINE
Signed-off-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #1559

lib/syscall_shim/arch/arm64/include/arch/syscall_prologue.h
lib/syscall_shim/arch/x86_64/include/arch/syscall_prologue.h

index 2d4b026f45e9a7ccde9972ee9ea3eff07c75dcf1..2212d5f1f65ecdb00f36ab5629e991266462c59f 100644 (file)
                "/* Use `struct lcpu` pointer from TPIDR_EL1 */\n\t"    \
                "mrs    x0, tpidr_el1\n\t"                              \
                " /* Switch to per-CPU auxiliary stack */\n\t"          \
-               "ldr    x0, [x0, #"STRINGIFY(LCPU_AUXSP_OFFSET)"]\n\t"  \
-               "sub    x0, x0, #"STRINGIFY(UKARCH_AUXSPCB_SIZE)"\n\t"  \
+               "ldr    x0, [x0, #" STRINGIFY(LCPU_AUXSP_OFFSET) "]\n\t"\
+               "sub    x0, x0, #" STRINGIFY(UKARCH_AUXSPCB_SIZE) "\n\t"\
                "ldr    x0, [x0, #"                                     \
-                       STRINGIFY(UKARCH_AUXSPCB_OFFSETOF_CURR_FP)"]\n\t"\
+                       STRINGIFY(UKARCH_AUXSPCB_OFFSETOF_CURR_FP) "]\n\t"\
                "/* Auxiliary stack is already ECTX aligned */\n\t"     \
                "/* Make room for `struct ukarch_execenv` */\n\t"       \
-               "sub    x0, x0, #"STRINGIFY(UKARCH_EXECENV_SIZE)"\n\t"  \
+               "sub    x0, x0, #" STRINGIFY(UKARCH_EXECENV_SIZE) "\n\t"\
                "/* Swap x0 and (old) sp */\n\t"                        \
                "add    sp, sp, x0\n\t"                                 \
                "sub    x0, sp, x0\n\t"                                 \
                "sub    sp, sp, x0\n\t"                                 \
                "/* Now store old sp w.r.t. `struct __regs` */\n\t"     \
-               "str    x0, [sp, #"STRINGIFY(__SP_OFFSET)"]\n\t"        \
+               "str    x0, [sp, #" STRINGIFY(__SP_OFFSET) "]\n\t"      \
                "/* Restore x0 from scratch register TPIDRRO_EL0 */\n\t"\
                "mrs    x0, tpidrro_el0\n\t"                            \
                "/* Now just store the rest of `struct __regs` */\n\t"  \
                " * following a SVC.\n\t"                               \
                " */\n\t"                                               \
                "mov    x22, #"                                         \
-                       STRINGIFY(UK_SYSCALL_PROLOGUE_SPSR_EL1_SVC64_DEFAULT_VALUE)"\n\t"\
+                       STRINGIFY(UK_SYSCALL_PROLOGUE_SPSR_EL1_SVC64_DEFAULT_VALUE) "\n\t"\
                "/* Same for esr_el1, make it look like a SVC\n\t"      \
                " * happened.\n\t"                                      \
                " */\n\t"                                               \
                "mov    x23, xzr\n\t"                                   \
-               "add    x23, x23, #"STRINGIFY(ESR_EL1_EC_SVC64)"\n\t"   \
-               "orr    x23, xzr, x23, lsl #"STRINGIFY(ESR_EC_SHIFT)"\n\t"\
-               "orr    x23, x23, #"STRINGIFY(ESR_IL)"\n\t"             \
+               "add    x23, x23, #" STRINGIFY(ESR_EL1_EC_SVC64) "\n\t" \
+               "orr    x23, xzr, x23, lsl #" STRINGIFY(ESR_EC_SHIFT) "\n\t"\
+               "orr    x23, x23, #" STRINGIFY(ESR_IL) "\n\t"           \
                "stp    x22, x23, [sp, #16 * 16]\n\t"                   \
                "/* ECTX at slot w.r.t. `struct ukarch_execenv` */\n\t" \
                "mov    x0, sp\n\t"                                     \
-               "add    x0, x0, #("STRINGIFY(__REGS_SIZEOF +            \
-                                    UKARCH_SYSCTX_SIZE)")\n\t"         \
+               "add    x0, x0, #(" STRINGIFY(__REGS_SIZEOF +           \
+                                    UKARCH_SYSCTX_SIZE) ")\n\t"        \
                "bl     ukarch_ectx_store\n\t"                          \
                "/* SYSCTX at slot w.r.t. `struct ukarch_execenv` */\n\t"\
                "mov    x0, sp\n\t"                                     \
-               "add    x0, x0, #"STRINGIFY(__REGS_SIZEOF)"\n\t"        \
+               "add    x0, x0, #" STRINGIFY(__REGS_SIZEOF) "\n\t"      \
                "bl     ukarch_sysctx_store\n\t"                        \
                "mov    x0, sp\n\t"                                     \
                "msr    daifclr, #2\n\t"                                \
-               "bl     "STRINGIFY(fname)"\n\t"                         \
+               "bl     " STRINGIFY(fname) "\n\t"                       \
                "/* Only restore callee preserved regs (ABI) */\n\t"    \
                "ldr    x30, [sp, #16 * 15]\n\t"                        \
                "ldp    x28, x29, [sp, #16 * 14]\t\n"                   \
                "ldp    x20, x21, [sp, #16 * 10]\t\n"                   \
                "ldp    x18, x19, [sp, #16 * 9]\t\n"                    \
                "/* Restore rsp from where it was stored */\n\t"        \
-               "ldr    x9, [sp, #"STRINGIFY(__SP_OFFSET)"]\n\t"        \
+               "ldr    x9, [sp, #" STRINGIFY(__SP_OFFSET) "]\n\t"      \
                "mov    sp, x9\n\t"                                     \
                "ret\n\t"                                               \
                ::                                                      \
index 5482194f93ad0c80f8a9dd0f2bb31f98e5e39e23..43a0737ae7838f1785b992d23bd9c93a4f3ab076 100644 (file)
                "/* Switch to the per-CPU auxiliary stack */\n\t"       \
                "/* AMD64 SysV ABI: r11 is scratch register */\n\t"     \
                "movq   %%rsp, %%r11\n\t"                               \
-               "movq   %%gs:("STRINGIFY(LCPU_AUXSP_OFFSET)"), %%rsp\n\t"\
+               "movq   %%gs:(" STRINGIFY(LCPU_AUXSP_OFFSET) "), %%rsp\n\t"\
                "/* Auxiliary stack is already ECTX aligned */\n\t"     \
                "/* Make room for `struct UKARCH_EXECENV` */\n\t"       \
-               "subq   $("STRINGIFY(UKARCH_EXECENV_SIZE -              \
-                                    __REGS_SIZEOF)"), %%rsp\n\t"       \
+               "subq   $(" STRINGIFY(UKARCH_EXECENV_SIZE -             \
+                                    __REGS_SIZEOF)" ), %%rsp\n\t"      \
                "/* Now build stack frame beginning with 5 pointers\n\t"\
                " * in the classical iretq/`struct __regs` format\n\t"  \
                " */\n\t"                                               \
@@ -56,7 +56,7 @@
                " * manually set the flag.\n\t"                         \
                " */\n\t"                                               \
                "pushfq\n\t"                                            \
-               "orq    $("STRINGIFY(X86_EFLAGS_IF)"), 0(%%rsp)\n\t"    \
+               "orq    $(" STRINGIFY(X86_EFLAGS_IF) "), 0(%%rsp)\n\t"  \
                "/* Push code segment, GDT code segment selector:\n\t"  \
                " * [15: 3]: Selector Index - first GDT entry\n\t"      \
                " * [ 2: 2]: Table Indicator - GDT, table 0\n\t"        \
                "pushq  %%r13\n\t"                                      \
                "pushq  %%r14\n\t"                                      \
                "pushq  %%r15\n\t"                                      \
-               "subq   $("STRINGIFY(__REGS_PAD_SIZE)"), %%rsp\n\t"     \
-               "/* ECTX at slot w.r.t. `struct UKARCH_EXECENV` */\n\t"\
+               "subq   $(" STRINGIFY(__REGS_PAD_SIZE) "), %%rsp\n\t"   \
+               "/* ECTX at slot w.r.t. `struct UKARCH_EXECENV` */\n\t" \
                "movq   %%rsp, %%rdi\n\t"                               \
-               "addq   $("STRINGIFY(__REGS_SIZEOF +                    \
-                                    UKARCH_SYSCTX_SIZE)"), %%rdi\n\t"  \
+               "addq   $(" STRINGIFY(__REGS_SIZEOF +                   \
+                                    UKARCH_SYSCTX_SIZE) "), %%rdi\n\t" \
                "call   ukarch_ectx_store\n\t"                          \
                "/* SYSCTX at slot w.r.t. `struct UKARCH_EXECENV` */\n\t"\
                "movq   %%rsp, %%rdi\n\t"                               \
-               "addq   $("STRINGIFY(__REGS_SIZEOF)"), %%rdi\n\t"       \
+               "addq   $(" STRINGIFY(__REGS_SIZEOF) "), %%rdi\n\t"     \
                "call   ukarch_sysctx_store\n\t"                        \
                "movq   %%rsp, %%rdi\n\t"                               \
                "sti\n\t"                                               \
-               "call   "STRINGIFY(fname)"\n\t"                         \
-               "addq   $("STRINGIFY(__REGS_PAD_SIZE)"), %%rsp\n\t"     \
+               "call   " STRINGIFY(fname) "\n\t"                       \
+               "addq   $(" STRINGIFY(__REGS_PAD_SIZE) "), %%rsp\n\t"   \
                "/* Only restore callee preserved regs (ABI) */\n\t"    \
                "popq   %%r15\n\t"                                      \
                "popq   %%r14\n\t"                                      \