tools/nolibc: use C89 comment syntax
authorThomas Weißschuh <linux@weissschuh.net>
Thu, 6 Apr 2023 21:54:49 +0000 (21:54 +0000)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 9 Jun 2023 18:46:07 +0000 (11:46 -0700)
Most of nolibc is already using C89 comments.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/include/nolibc/arch-aarch64.h
tools/include/nolibc/arch-arm.h
tools/include/nolibc/arch-i386.h
tools/include/nolibc/arch-loongarch.h
tools/include/nolibc/arch-mips.h
tools/include/nolibc/arch-riscv.h
tools/include/nolibc/arch-s390.h
tools/include/nolibc/arch-x86_64.h
tools/include/nolibc/stackprotector.h
tools/include/nolibc/sys.h
tools/testing/selftests/nolibc/nolibc-test.c

index 383baddef701914dd12478a62c01b6673c284a95..76ef26520c85a80bc2f273f3fe6a5644cb46f5a6 100644 (file)
@@ -176,24 +176,24 @@ const unsigned long *_auxv __attribute__((weak));
 void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
 {
        __asm__ volatile (
-               "ldr x0, [sp]\n"     // argc (x0) was in the stack
-               "add x1, sp, 8\n"    // argv (x1) = sp
-               "lsl x2, x0, 3\n"    // envp (x2) = 8*argc ...
-               "add x2, x2, 8\n"    //           + 8 (skip null)
-               "add x2, x2, x1\n"   //           + argv
-               "adrp x3, environ\n"          // x3 = &environ (high bits)
-               "str x2, [x3, #:lo12:environ]\n" // store envp into environ
-               "mov x4, x2\n"       // search for auxv (follows NULL after last env)
+               "ldr x0, [sp]\n"     /* argc (x0) was in the stack                          */
+               "add x1, sp, 8\n"    /* argv (x1) = sp                                      */
+               "lsl x2, x0, 3\n"    /* envp (x2) = 8*argc ...                              */
+               "add x2, x2, 8\n"    /*           + 8 (skip null)                           */
+               "add x2, x2, x1\n"   /*           + argv                                    */
+               "adrp x3, environ\n"          /* x3 = &environ (high bits)                  */
+               "str x2, [x3, #:lo12:environ]\n" /* store envp into environ                 */
+               "mov x4, x2\n"       /* search for auxv (follows NULL after last env)       */
                "0:\n"
-               "ldr x5, [x4], 8\n"  // x5 = *x4; x4 += 8
-               "cbnz x5, 0b\n"      // and stop at NULL after last env
-               "adrp x3, _auxv\n"   // x3 = &_auxv (high bits)
-               "str x4, [x3, #:lo12:_auxv]\n" // store x4 into _auxv
-               "and sp, x1, -16\n"  // sp must be 16-byte aligned in the callee
-               "bl main\n"          // main() returns the status code, we'll exit with it.
-               "mov x8, 93\n"       // NR_exit == 93
+               "ldr x5, [x4], 8\n"  /* x5 = *x4; x4 += 8                                   */
+               "cbnz x5, 0b\n"      /* and stop at NULL after last env                     */
+               "adrp x3, _auxv\n"   /* x3 = &_auxv (high bits)                             */
+               "str x4, [x3, #:lo12:_auxv]\n" /* store x4 into _auxv                       */
+               "and sp, x1, -16\n"  /* sp must be 16-byte aligned in the callee            */
+               "bl main\n"          /* main() returns the status code, we'll exit with it. */
+               "mov x8, 93\n"       /* NR_exit == 93                                       */
                "svc #0\n"
        );
        __builtin_unreachable();
 }
-#endif // _NOLIBC_ARCH_AARCH64_H
+#endif /* _NOLIBC_ARCH_AARCH64_H */
index 42499f23e73c5c583e434d5c579c95104e7d8ff7..2eab1aef321bf1d0f031efd3aab6e7746c2ad6d1 100644 (file)
@@ -203,34 +203,34 @@ const unsigned long *_auxv __attribute__((weak));
 void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
 {
        __asm__ volatile (
-               "pop {%r0}\n"                 // argc was in the stack
-               "mov %r1, %sp\n"              // argv = sp
+               "pop {%r0}\n"                 /* argc was in the stack                               */
+               "mov %r1, %sp\n"              /* argv = sp                                           */
 
-               "add %r2, %r0, $1\n"          // envp = (argc + 1) ...
-               "lsl %r2, %r2, $2\n"          //        * 4        ...
-               "add %r2, %r2, %r1\n"         //        + argv
-               "ldr %r3, 1f\n"               // r3 = &environ (see below)
-               "str %r2, [r3]\n"             // store envp into environ
+               "add %r2, %r0, $1\n"          /* envp = (argc + 1) ...                               */
+               "lsl %r2, %r2, $2\n"          /*        * 4        ...                               */
+               "add %r2, %r2, %r1\n"         /*        + argv                                       */
+               "ldr %r3, 1f\n"               /* r3 = &environ (see below)                           */
+               "str %r2, [r3]\n"             /* store envp into environ                             */
 
-               "mov r4, r2\n"                // search for auxv (follows NULL after last env)
+               "mov r4, r2\n"                /* search for auxv (follows NULL after last env)       */
                "0:\n"
-               "mov r5, r4\n"                // r5 = r4
-               "add r4, r4, #4\n"            // r4 += 4
-               "ldr r5,[r5]\n"               // r5 = *r5 = *(r4-4)
-               "cmp r5, #0\n"                // and stop at NULL after last env
+               "mov r5, r4\n"                /* r5 = r4                                             */
+               "add r4, r4, #4\n"            /* r4 += 4                                             */
+               "ldr r5,[r5]\n"               /* r5 = *r5 = *(r4-4)                                  */
+               "cmp r5, #0\n"                /* and stop at NULL after last env                     */
                "bne 0b\n"
-               "ldr %r3, 2f\n"               // r3 = &_auxv (low bits)
-               "str r4, [r3]\n"              // store r4 into _auxv
+               "ldr %r3, 2f\n"               /* r3 = &_auxv (low bits)                              */
+               "str r4, [r3]\n"              /* store r4 into _auxv                                 */
 
-               "mov %r3, $8\n"               // AAPCS : sp must be 8-byte aligned in the
-               "neg %r3, %r3\n"              //         callee, and bl doesn't push (lr=pc)
-               "and %r3, %r3, %r1\n"         // so we do sp = r1(=sp) & r3(=-8);
-               "mov %sp, %r3\n"              //
+               "mov %r3, $8\n"               /* AAPCS : sp must be 8-byte aligned in the            */
+               "neg %r3, %r3\n"              /*         callee, and bl doesn't push (lr=pc)         */
+               "and %r3, %r3, %r1\n"         /* so we do sp = r1(=sp) & r3(=-8);                    */
+               "mov %sp, %r3\n"
 
-               "bl main\n"                   // main() returns the status code, we'll exit with it.
-               "movs r7, $1\n"               // NR_exit == 1
+               "bl main\n"                   /* main() returns the status code, we'll exit with it. */
+               "movs r7, $1\n"               /* NR_exit == 1                                        */
                "svc $0x00\n"
-               ".align 2\n"                  // below are the pointers to a few variables
+               ".align 2\n"                  /* below are the pointers to a few variables           */
                "1:\n"
                ".word environ\n"
                "2:\n"
@@ -239,4 +239,4 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
        __builtin_unreachable();
 }
 
-#endif // _NOLIBC_ARCH_ARM_H
+#endif /* _NOLIBC_ARCH_ARM_H */
index 2d98d78fd3f3a6459d7372dc51c65d1147b471ef..7c41897a08ce15e8d6057871adaef8c5bc7c8730 100644 (file)
@@ -194,31 +194,31 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"),no_stack_protec
 {
        __asm__ volatile (
 #ifdef NOLIBC_STACKPROTECTOR
-               "call __stack_chk_init\n"   // initialize stack protector
+               "call __stack_chk_init\n"   /* initialize stack protector                    */
 #endif
-               "pop %eax\n"                // argc   (first arg, %eax)
-               "mov %esp, %ebx\n"          // argv[] (second arg, %ebx)
-               "lea 4(%ebx,%eax,4),%ecx\n" // then a NULL then envp (third arg, %ecx)
-               "mov %ecx, environ\n"       // save environ
-               "xor %ebp, %ebp\n"          // zero the stack frame
-               "mov %ecx, %edx\n"          // search for auxv (follows NULL after last env)
+               "pop %eax\n"                /* argc   (first arg, %eax)                      */
+               "mov %esp, %ebx\n"          /* argv[] (second arg, %ebx)                     */
+               "lea 4(%ebx,%eax,4),%ecx\n" /* then a NULL then envp (third arg, %ecx)       */
+               "mov %ecx, environ\n"       /* save environ                                  */
+               "xor %ebp, %ebp\n"          /* zero the stack frame                          */
+               "mov %ecx, %edx\n"          /* search for auxv (follows NULL after last env) */
                "0:\n"
-               "add $4, %edx\n"            // search for auxv using edx, it follows the
-               "cmp -4(%edx), %ebp\n"      // ... NULL after last env (ebp is zero here)
+               "add $4, %edx\n"            /* search for auxv using edx, it follows the     */
+               "cmp -4(%edx), %ebp\n"      /* ... NULL after last env (ebp is zero here)    */
                "jnz 0b\n"
-               "mov %edx, _auxv\n"         // save it into _auxv
-               "and $-16, %esp\n"          // x86 ABI : esp must be 16-byte aligned before
-               "sub $4, %esp\n"            // the call instruction (args are aligned)
-               "push %ecx\n"               // push all registers on the stack so that we
-               "push %ebx\n"               // support both regparm and plain stack modes
+               "mov %edx, _auxv\n"         /* save it into _auxv                            */
+               "and $-16, %esp\n"          /* x86 ABI : esp must be 16-byte aligned before  */
+               "sub $4, %esp\n"            /* the call instruction (args are aligned)       */
+               "push %ecx\n"               /* push all registers on the stack so that we    */
+               "push %ebx\n"               /* support both regparm and plain stack modes    */
                "push %eax\n"
-               "call main\n"               // main() returns the status code in %eax
-               "mov %eax, %ebx\n"          // retrieve exit code (32-bit int)
-               "movl $1, %eax\n"           // NR_exit == 1
-               "int $0x80\n"               // exit now
-               "hlt\n"                     // ensure it does not
+               "call main\n"               /* main() returns the status code in %eax        */
+               "mov %eax, %ebx\n"          /* retrieve exit code (32-bit int)               */
+               "movl $1, %eax\n"           /* NR_exit == 1                                  */
+               "int $0x80\n"               /* exit now                                      */
+               "hlt\n"                     /* ensure it does not                            */
        );
        __builtin_unreachable();
 }
 
-#endif // _NOLIBC_ARCH_I386_H
+#endif /* _NOLIBC_ARCH_I386_H */
index 029ee3cd6bafa370a345343c6655c5f45d852cad..ec3b46a991a987311e4f1c1790b210ef15bd7f87 100644 (file)
@@ -158,7 +158,7 @@ const unsigned long *_auxv __attribute__((weak));
 #define LONG_ADDI    "addi.w"
 #define LONG_SLL     "slli.w"
 #define LONG_BSTRINS "bstrins.w"
-#else // __loongarch_grlen == 64
+#else /* __loongarch_grlen == 64 */
 #define LONGLOG      "3"
 #define SZREG        "8"
 #define REG_L        "ld.d"
@@ -173,28 +173,28 @@ const unsigned long *_auxv __attribute__((weak));
 void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
 {
        __asm__ volatile (
-               REG_L        " $a0, $sp, 0\n"         // argc (a0) was in the stack
-               LONG_ADDI    " $a1, $sp, "SZREG"\n"   // argv (a1) = sp + SZREG
-               LONG_SLL     " $a2, $a0, "LONGLOG"\n" // envp (a2) = SZREG*argc ...
-               LONG_ADDI    " $a2, $a2, "SZREG"\n"   //             + SZREG (skip null)
-               LONG_ADD     " $a2, $a2, $a1\n"       //             + argv
+               REG_L        " $a0, $sp, 0\n"         /* argc (a0) was in the stack                          */
+               LONG_ADDI    " $a1, $sp, "SZREG"\n"   /* argv (a1) = sp + SZREG                              */
+               LONG_SLL     " $a2, $a0, "LONGLOG"\n" /* envp (a2) = SZREG*argc ...                          */
+               LONG_ADDI    " $a2, $a2, "SZREG"\n"   /*             + SZREG (skip null)                     */
+               LONG_ADD     " $a2, $a2, $a1\n"       /*             + argv                                  */
 
-               "move          $a3, $a2\n"            // iterate a3 over envp to find auxv (after NULL)
-               "0:\n"                                // do {
-               REG_L        " $a4, $a3, 0\n"         //   a4 = *a3;
-               LONG_ADDI    " $a3, $a3, "SZREG"\n"   //   a3 += sizeof(void*);
-               "bne           $a4, $zero, 0b\n"      // } while (a4);
-               "la.pcrel      $a4, _auxv\n"          // a4 = &_auxv
-               LONG_S       " $a3, $a4, 0\n"         // store a3 into _auxv
+               "move          $a3, $a2\n"            /* iterate a3 over envp to find auxv (after NULL)      */
+               "0:\n"                                /* do {                                                */
+               REG_L        " $a4, $a3, 0\n"         /*   a4 = *a3;                                         */
+               LONG_ADDI    " $a3, $a3, "SZREG"\n"   /*   a3 += sizeof(void*);                              */
+               "bne           $a4, $zero, 0b\n"      /* } while (a4);                                       */
+               "la.pcrel      $a4, _auxv\n"          /* a4 = &_auxv                                         */
+               LONG_S       " $a3, $a4, 0\n"         /* store a3 into _auxv                                 */
 
-               "la.pcrel      $a3, environ\n"        // a3 = &environ
-               LONG_S       " $a2, $a3, 0\n"         // store envp(a2) into environ
-               LONG_BSTRINS " $sp, $zero, 3, 0\n"    // sp must be 16-byte aligned
-               "bl            main\n"                // main() returns the status code, we'll exit with it.
-               "li.w          $a7, 93\n"             // NR_exit == 93
+               "la.pcrel      $a3, environ\n"        /* a3 = &environ                                       */
+               LONG_S       " $a2, $a3, 0\n"         /* store envp(a2) into environ                         */
+               LONG_BSTRINS " $sp, $zero, 3, 0\n"    /* sp must be 16-byte aligned                          */
+               "bl            main\n"                /* main() returns the status code, we'll exit with it. */
+               "li.w          $a7, 93\n"             /* NR_exit == 93                                       */
                "syscall       0\n"
        );
        __builtin_unreachable();
 }
 
-#endif // _NOLIBC_ARCH_LOONGARCH_H
+#endif /* _NOLIBC_ARCH_LOONGARCH_H */
index bf83432d23ed3115c8a211a9820694adce1cc39e..8822f150e72f73f61e69d80932231c2e60f44e42 100644 (file)
@@ -183,42 +183,42 @@ const unsigned long *_auxv __attribute__((weak));
 void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) __start(void)
 {
        __asm__ volatile (
-               //".set nomips16\n"
+               /*".set nomips16\n"*/
                ".set push\n"
                ".set    noreorder\n"
                ".option pic0\n"
-               //".ent __start\n"
-               //"__start:\n"
-               "lw $a0,($sp)\n"        // argc was in the stack
-               "addiu  $a1, $sp, 4\n"  // argv = sp + 4
-               "sll $a2, $a0, 2\n"     // a2 = argc * 4
-               "add   $a2, $a2, $a1\n" // envp = argv + 4*argc ...
-               "addiu $a2, $a2, 4\n"   //        ... + 4
-               "lui $a3, %hi(environ)\n"     // load environ into a3 (hi)
-               "addiu $a3, %lo(environ)\n"   // load environ into a3 (lo)
-               "sw $a2,($a3)\n"              // store envp(a2) into environ
-
-               "move $t0, $a2\n"             // iterate t0 over envp, look for NULL
-               "0:"                          // do {
-               "lw $a3, ($t0)\n"             //   a3=*(t0);
-               "bne $a3, $0, 0b\n"           // } while (a3);
-               "addiu $t0, $t0, 4\n"         // delayed slot: t0+=4;
-               "lui $a3, %hi(_auxv)\n"       // load _auxv into a3 (hi)
-               "addiu $a3, %lo(_auxv)\n"     // load _auxv into a3 (lo)
-               "sw $t0, ($a3)\n"             // store t0 into _auxv
+               /*".ent __start\n"*/
+               /*"__start:\n"*/
+               "lw $a0,($sp)\n"        /* argc was in the stack                               */
+               "addiu  $a1, $sp, 4\n"  /* argv = sp + 4                                       */
+               "sll $a2, $a0, 2\n"     /* a2 = argc * 4                                       */
+               "add   $a2, $a2, $a1\n" /* envp = argv + 4*argc ...                            */
+               "addiu $a2, $a2, 4\n"   /*        ... + 4                                      */
+               "lui $a3, %hi(environ)\n"     /* load environ into a3 (hi)                     */
+               "addiu $a3, %lo(environ)\n"   /* load environ into a3 (lo)                     */
+               "sw $a2,($a3)\n"              /* store envp(a2) into environ                   */
+
+               "move $t0, $a2\n"             /* iterate t0 over envp, look for NULL           */
+               "0:"                          /* do {                                          */
+               "lw $a3, ($t0)\n"             /*   a3=*(t0);                                   */
+               "bne $a3, $0, 0b\n"           /* } while (a3);                                 */
+               "addiu $t0, $t0, 4\n"         /* delayed slot: t0+=4;                          */
+               "lui $a3, %hi(_auxv)\n"       /* load _auxv into a3 (hi)                       */
+               "addiu $a3, %lo(_auxv)\n"     /* load _auxv into a3 (lo)                       */
+               "sw $t0, ($a3)\n"             /* store t0 into _auxv                           */
 
                "li $t0, -8\n"
-               "and $sp, $sp, $t0\n"   // sp must be 8-byte aligned
-               "addiu $sp,$sp,-16\n"   // the callee expects to save a0..a3 there!
-               "jal main\n"            // main() returns the status code, we'll exit with it.
-               "nop\n"                 // delayed slot
-               "move $a0, $v0\n"       // retrieve 32-bit exit code from v0
-               "li $v0, 4001\n"        // NR_exit == 4001
+               "and $sp, $sp, $t0\n"   /* sp must be 8-byte aligned                           */
+               "addiu $sp,$sp,-16\n"   /* the callee expects to save a0..a3 there!            */
+               "jal main\n"            /* main() returns the status code, we'll exit with it. */
+               "nop\n"                 /* delayed slot                                        */
+               "move $a0, $v0\n"       /* retrieve 32-bit exit code from v0                   */
+               "li $v0, 4001\n"        /* NR_exit == 4001                                     */
                "syscall\n"
-               //".end __start\n"
+               /*".end __start\n"*/
                ".set pop\n"
        );
        __builtin_unreachable();
 }
 
-#endif // _NOLIBC_ARCH_MIPS_H
+#endif /* _NOLIBC_ARCH_MIPS_H */
index e197fcb10ac00294a6509300a281da583729b2c9..0d5f15fdedc4c3a2fa80667b4f76593f5f7694b9 100644 (file)
@@ -181,28 +181,28 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
                ".option norelax\n"
                "lla   gp, __global_pointer$\n"
                ".option pop\n"
-               "lw    a0, 0(sp)\n"          // argc (a0) was in the stack
-               "add   a1, sp, "SZREG"\n"    // argv (a1) = sp
-               "slli  a2, a0, "PTRLOG"\n"   // envp (a2) = SZREG*argc ...
-               "add   a2, a2, "SZREG"\n"    //             + SZREG (skip null)
-               "add   a2,a2,a1\n"           //             + argv
-
-               "add   a3, a2, zero\n"       // iterate a3 over envp to find auxv (after NULL)
-               "0:\n"                       // do {
-               "ld    a4, 0(a3)\n"          //   a4 = *a3;
-               "add   a3, a3, "SZREG"\n"    //   a3 += sizeof(void*);
-               "bne   a4, zero, 0b\n"       // } while (a4);
-               "lui   a4, %hi(_auxv)\n"     // a4 = &_auxv (high bits)
-               "sd    a3, %lo(_auxv)(a4)\n" // store a3 into _auxv
-
-               "lui a3, %hi(environ)\n"     // a3 = &environ (high bits)
-               "sd a2,%lo(environ)(a3)\n"   // store envp(a2) into environ
-               "andi  sp,a1,-16\n"          // sp must be 16-byte aligned
-               "call  main\n"               // main() returns the status code, we'll exit with it.
-               "li a7, 93\n"                // NR_exit == 93
+               "lw    a0, 0(sp)\n"          /* argc (a0) was in the stack                          */
+               "add   a1, sp, "SZREG"\n"    /* argv (a1) = sp                                      */
+               "slli  a2, a0, "PTRLOG"\n"   /* envp (a2) = SZREG*argc ...                          */
+               "add   a2, a2, "SZREG"\n"    /*             + SZREG (skip null)                     */
+               "add   a2,a2,a1\n"           /*             + argv                                  */
+
+               "add   a3, a2, zero\n"       /* iterate a3 over envp to find auxv (after NULL)      */
+               "0:\n"                       /* do {                                                */
+               "ld    a4, 0(a3)\n"          /*   a4 = *a3;                                         */
+               "add   a3, a3, "SZREG"\n"    /*   a3 += sizeof(void*);                              */
+               "bne   a4, zero, 0b\n"       /* } while (a4);                                       */
+               "lui   a4, %hi(_auxv)\n"     /* a4 = &_auxv (high bits)                             */
+               "sd    a3, %lo(_auxv)(a4)\n" /* store a3 into _auxv                                 */
+
+               "lui a3, %hi(environ)\n"     /* a3 = &environ (high bits)                           */
+               "sd a2,%lo(environ)(a3)\n"   /* store envp(a2) into environ                         */
+               "andi  sp,a1,-16\n"          /* sp must be 16-byte aligned                          */
+               "call  main\n"               /* main() returns the status code, we'll exit with it. */
+               "li a7, 93\n"                /* NR_exit == 93                                       */
                "ecall\n"
        );
        __builtin_unreachable();
 }
 
-#endif // _NOLIBC_ARCH_RISCV_H
+#endif /* _NOLIBC_ARCH_RISCV_H */
index 6b0e54ed543dd89716f8b4338f800b91c44fe6c3..c62ee2472407e142d29779f04097fa84f5b1b0e5 100644 (file)
@@ -223,4 +223,4 @@ void *sys_mmap(void *addr, size_t length, int prot, int flags, int fd,
        return (void *)my_syscall1(__NR_mmap, &args);
 }
 #define sys_mmap sys_mmap
-#endif // _NOLIBC_ARCH_S390_H
+#endif /* _NOLIBC_ARCH_S390_H */
index f7f2a11d4c3b08fa9af028356da25d7038a381f1..d98f6c89d1431839fe8da42f487fc553bb946016 100644 (file)
@@ -194,27 +194,27 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
 {
        __asm__ volatile (
 #ifdef NOLIBC_STACKPROTECTOR
-               "call __stack_chk_init\n"   // initialize stack protector
+               "call __stack_chk_init\n"   /* initialize stack protector                          */
 #endif
-               "pop %rdi\n"                // argc   (first arg, %rdi)
-               "mov %rsp, %rsi\n"          // argv[] (second arg, %rsi)
-               "lea 8(%rsi,%rdi,8),%rdx\n" // then a NULL then envp (third arg, %rdx)
-               "mov %rdx, environ\n"       // save environ
-               "xor %ebp, %ebp\n"          // zero the stack frame
-               "mov %rdx, %rax\n"          // search for auxv (follows NULL after last env)
+               "pop %rdi\n"                /* argc   (first arg, %rdi)                            */
+               "mov %rsp, %rsi\n"          /* argv[] (second arg, %rsi)                           */
+               "lea 8(%rsi,%rdi,8),%rdx\n" /* then a NULL then envp (third arg, %rdx)             */
+               "mov %rdx, environ\n"       /* save environ                                        */
+               "xor %ebp, %ebp\n"          /* zero the stack frame                                */
+               "mov %rdx, %rax\n"          /* search for auxv (follows NULL after last env)       */
                "0:\n"
-               "add $8, %rax\n"            // search for auxv using rax, it follows the
-               "cmp -8(%rax), %rbp\n"      // ... NULL after last env (rbp is zero here)
+               "add $8, %rax\n"            /* search for auxv using rax, it follows the           */
+               "cmp -8(%rax), %rbp\n"      /* ... NULL after last env (rbp is zero here)          */
                "jnz 0b\n"
-               "mov %rax, _auxv\n"         // save it into _auxv
-               "and $-16, %rsp\n"          // x86 ABI : esp must be 16-byte aligned before call
-               "call main\n"               // main() returns the status code, we'll exit with it.
-               "mov %eax, %edi\n"          // retrieve exit code (32 bit)
-               "mov $60, %eax\n"           // NR_exit == 60
-               "syscall\n"                 // really exit
-               "hlt\n"                     // ensure it does not return
+               "mov %rax, _auxv\n"         /* save it into _auxv                                  */
+               "and $-16, %rsp\n"          /* x86 ABI : esp must be 16-byte aligned before call   */
+               "call main\n"               /* main() returns the status code, we'll exit with it. */
+               "mov %eax, %edi\n"          /* retrieve exit code (32 bit)                         */
+               "mov $60, %eax\n"           /* NR_exit == 60                                       */
+               "syscall\n"                 /* really exit                                         */
+               "hlt\n"                     /* ensure it does not return                           */
        );
        __builtin_unreachable();
 }
 
-#endif // _NOLIBC_ARCH_X86_64_H
+#endif /* _NOLIBC_ARCH_X86_64_H */
index d119cbbbc256f18251b9fe46d1b81c3495511722..77e5251c4490b7ae7a3cb7fb8abed18e34e483e0 100644 (file)
@@ -48,6 +48,6 @@ void __stack_chk_init(void)
        /* a bit more randomness in case getrandom() fails */
        __stack_chk_guard ^= (uintptr_t) &__stack_chk_guard;
 }
-#endif // defined(NOLIBC_STACKPROTECTOR)
+#endif /* defined(NOLIBC_STACKPROTECTOR) */
 
-#endif // _NOLIBC_STACKPROTECTOR_H
+#endif /* _NOLIBC_STACKPROTECTOR_H */
index bea9760dbd16be042910a17a41907da894775b1e..1b9b91cd8b57016e3502ba7343d81fcc3f5572b9 100644 (file)
 
 /* system includes */
 #include <asm/unistd.h>
-#include <asm/signal.h>  // for SIGCHLD
+#include <asm/signal.h>  /* for SIGCHLD */
 #include <asm/ioctls.h>
 #include <asm/mman.h>
 #include <linux/fs.h>
 #include <linux/loop.h>
 #include <linux/time.h>
 #include <linux/auxvec.h>
-#include <linux/fcntl.h> // for O_* and AT_*
-#include <linux/stat.h>  // for statx()
+#include <linux/fcntl.h> /* for O_* and AT_* */
+#include <linux/stat.h>  /* for statx() */
 
 #include "arch.h"
 #include "errno.h"
@@ -322,7 +322,7 @@ static __attribute__((noreturn,unused))
 void sys_exit(int status)
 {
        my_syscall1(__NR_exit, status & 255);
-       while(1); // shut the "noreturn" warnings.
+       while(1); /* shut the "noreturn" warnings. */
 }
 
 static __attribute__((noreturn,unused))
index e692be98973a4ce73c9066aa687fa948b45cf8ef..f06b38cfe38a29a090be7142d60a54d3063adf49 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 
 #define _GNU_SOURCE
 
@@ -46,8 +46,8 @@ char **environ;
 
 /* definition of a series of tests */
 struct test {
-       const char *name;              // test name
-       int (*func)(int min, int max); // handler
+       const char *name;              /* test name */
+       int (*func)(int min, int max); /* handler */
 };
 
 #ifndef _NOLIBC_STDLIB_H
@@ -494,7 +494,7 @@ int run_syscall(int min, int max)
        euid0 = geteuid() == 0;
 
        for (test = min; test >= 0 && test <= max; test++) {
-               int llen = 0; // line length
+               int llen = 0; /* line length */
 
                /* avoid leaving empty lines below, this will insert holes into
                 * test numbers.
@@ -584,7 +584,7 @@ int run_stdlib(int min, int max)
        void *p1, *p2;
 
        for (test = min; test >= 0 && test <= max; test++) {
-               int llen = 0; // line length
+               int llen = 0; /* line length */
 
                /* avoid leaving empty lines below, this will insert holes into
                 * test numbers.
@@ -731,7 +731,7 @@ static int run_vfprintf(int min, int max)
        void *p1, *p2;
 
        for (test = min; test >= 0 && test <= max; test++) {
-               int llen = 0; // line length
+               int llen = 0; /* line length */
 
                /* avoid leaving empty lines below, this will insert holes into
                 * test numbers.