From: "Paul E. McKenney" <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], [email protected],
Ammar Faizi <[email protected]>,
Alviro Iskandar Setiawan <[email protected]>,
Willy Tarreau <[email protected]>,
"Paul E . McKenney" <[email protected]>
Subject: [PATCH nolibc 54/61] tools/nolibc: Replace `asm` with `__asm__`
Date: Mon, 18 Apr 2022 17:42:18 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <20220419004219.GA3952301@paulmck-ThinkPad-P17-Gen-1>
From: Ammar Faizi <[email protected]>
Replace `asm` with `__asm__` to support compilation with -std flag.
Using `asm` with -std flag makes GCC think `asm()` is a function call
instead of an inline assembly.
GCC doc says:
For the C language, the `asm` keyword is a GNU extension. When
writing C code that can be compiled with `-ansi` and the `-std`
options that select C dialects without GNU extensions, use
`__asm__` instead of `asm`.
Link: https://gcc.gnu.org/onlinedocs/gcc/Basic-Asm.html
Reported-by: Alviro Iskandar Setiawan <[email protected]>
Acked-by: Willy Tarreau <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
---
tools/include/nolibc/arch-aarch64.h | 74 ++++++++++++++---------------
tools/include/nolibc/arch-arm.h | 58 +++++++++++-----------
tools/include/nolibc/arch-i386.h | 56 +++++++++++-----------
tools/include/nolibc/arch-mips.h | 62 ++++++++++++------------
tools/include/nolibc/arch-riscv.h | 74 ++++++++++++++---------------
tools/include/nolibc/arch-x86_64.h | 72 ++++++++++++++--------------
6 files changed, 198 insertions(+), 198 deletions(-)
diff --git a/tools/include/nolibc/arch-aarch64.h b/tools/include/nolibc/arch-aarch64.h
index 87d9e434820c..b68443f63980 100644
--- a/tools/include/nolibc/arch-aarch64.h
+++ b/tools/include/nolibc/arch-aarch64.h
@@ -64,10 +64,10 @@ struct sys_stat_struct {
#define my_syscall0(num) \
({ \
- register long _num asm("x8") = (num); \
- register long _arg1 asm("x0"); \
+ register long _num __asm__ ("x8") = (num); \
+ register long _arg1 __asm__ ("x0"); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r"(_arg1) \
: "r"(_num) \
@@ -78,10 +78,10 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \
({ \
- register long _num asm("x8") = (num); \
- register long _arg1 asm("x0") = (long)(arg1); \
+ register long _num __asm__ ("x8") = (num); \
+ register long _arg1 __asm__ ("x0") = (long)(arg1); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r"(_arg1) \
: "r"(_arg1), \
@@ -93,11 +93,11 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \
({ \
- register long _num asm("x8") = (num); \
- register long _arg1 asm("x0") = (long)(arg1); \
- register long _arg2 asm("x1") = (long)(arg2); \
+ register long _num __asm__ ("x8") = (num); \
+ register long _arg1 __asm__ ("x0") = (long)(arg1); \
+ register long _arg2 __asm__ ("x1") = (long)(arg2); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), \
@@ -109,12 +109,12 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \
({ \
- register long _num asm("x8") = (num); \
- register long _arg1 asm("x0") = (long)(arg1); \
- register long _arg2 asm("x1") = (long)(arg2); \
- register long _arg3 asm("x2") = (long)(arg3); \
+ register long _num __asm__ ("x8") = (num); \
+ register long _arg1 __asm__ ("x0") = (long)(arg1); \
+ register long _arg2 __asm__ ("x1") = (long)(arg2); \
+ register long _arg3 __asm__ ("x2") = (long)(arg3); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), \
@@ -126,13 +126,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \
- register long _num asm("x8") = (num); \
- register long _arg1 asm("x0") = (long)(arg1); \
- register long _arg2 asm("x1") = (long)(arg2); \
- register long _arg3 asm("x2") = (long)(arg3); \
- register long _arg4 asm("x3") = (long)(arg4); \
+ register long _num __asm__ ("x8") = (num); \
+ register long _arg1 __asm__ ("x0") = (long)(arg1); \
+ register long _arg2 __asm__ ("x1") = (long)(arg2); \
+ register long _arg3 __asm__ ("x2") = (long)(arg3); \
+ register long _arg4 __asm__ ("x3") = (long)(arg4); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
@@ -144,14 +144,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \
- register long _num asm("x8") = (num); \
- register long _arg1 asm("x0") = (long)(arg1); \
- register long _arg2 asm("x1") = (long)(arg2); \
- register long _arg3 asm("x2") = (long)(arg3); \
- register long _arg4 asm("x3") = (long)(arg4); \
- register long _arg5 asm("x4") = (long)(arg5); \
+ register long _num __asm__ ("x8") = (num); \
+ register long _arg1 __asm__ ("x0") = (long)(arg1); \
+ register long _arg2 __asm__ ("x1") = (long)(arg2); \
+ register long _arg3 __asm__ ("x2") = (long)(arg3); \
+ register long _arg4 __asm__ ("x3") = (long)(arg4); \
+ register long _arg5 __asm__ ("x4") = (long)(arg5); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r" (_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
@@ -163,15 +163,15 @@ struct sys_stat_struct {
#define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \
({ \
- register long _num asm("x8") = (num); \
- register long _arg1 asm("x0") = (long)(arg1); \
- register long _arg2 asm("x1") = (long)(arg2); \
- register long _arg3 asm("x2") = (long)(arg3); \
- register long _arg4 asm("x3") = (long)(arg4); \
- register long _arg5 asm("x4") = (long)(arg5); \
- register long _arg6 asm("x5") = (long)(arg6); \
+ register long _num __asm__ ("x8") = (num); \
+ register long _arg1 __asm__ ("x0") = (long)(arg1); \
+ register long _arg2 __asm__ ("x1") = (long)(arg2); \
+ register long _arg3 __asm__ ("x2") = (long)(arg3); \
+ register long _arg4 __asm__ ("x3") = (long)(arg4); \
+ register long _arg5 __asm__ ("x4") = (long)(arg5); \
+ register long _arg6 __asm__ ("x5") = (long)(arg6); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r" (_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
@@ -182,7 +182,7 @@ struct sys_stat_struct {
})
/* startup code */
-asm(".section .text\n"
+__asm__ (".section .text\n"
".weak _start\n"
".global _start\n"
"_start:\n"
diff --git a/tools/include/nolibc/arch-arm.h b/tools/include/nolibc/arch-arm.h
index 001a3c8c9ad5..55fd9439b2e2 100644
--- a/tools/include/nolibc/arch-arm.h
+++ b/tools/include/nolibc/arch-arm.h
@@ -77,10 +77,10 @@ struct sys_stat_struct {
#define my_syscall0(num) \
({ \
- register long _num asm("r7") = (num); \
- register long _arg1 asm("r0"); \
+ register long _num __asm__ ("r7") = (num); \
+ register long _arg1 __asm__ ("r0"); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r"(_arg1) \
: "r"(_num) \
@@ -91,10 +91,10 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \
({ \
- register long _num asm("r7") = (num); \
- register long _arg1 asm("r0") = (long)(arg1); \
+ register long _num __asm__ ("r7") = (num); \
+ register long _arg1 __asm__ ("r0") = (long)(arg1); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r"(_arg1) \
: "r"(_arg1), \
@@ -106,11 +106,11 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \
({ \
- register long _num asm("r7") = (num); \
- register long _arg1 asm("r0") = (long)(arg1); \
- register long _arg2 asm("r1") = (long)(arg2); \
+ register long _num __asm__ ("r7") = (num); \
+ register long _arg1 __asm__ ("r0") = (long)(arg1); \
+ register long _arg2 __asm__ ("r1") = (long)(arg2); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), \
@@ -122,12 +122,12 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \
({ \
- register long _num asm("r7") = (num); \
- register long _arg1 asm("r0") = (long)(arg1); \
- register long _arg2 asm("r1") = (long)(arg2); \
- register long _arg3 asm("r2") = (long)(arg3); \
+ register long _num __asm__ ("r7") = (num); \
+ register long _arg1 __asm__ ("r0") = (long)(arg1); \
+ register long _arg2 __asm__ ("r1") = (long)(arg2); \
+ register long _arg3 __asm__ ("r2") = (long)(arg3); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), \
@@ -139,13 +139,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \
- register long _num asm("r7") = (num); \
- register long _arg1 asm("r0") = (long)(arg1); \
- register long _arg2 asm("r1") = (long)(arg2); \
- register long _arg3 asm("r2") = (long)(arg3); \
- register long _arg4 asm("r3") = (long)(arg4); \
+ register long _num __asm__ ("r7") = (num); \
+ register long _arg1 __asm__ ("r0") = (long)(arg1); \
+ register long _arg2 __asm__ ("r1") = (long)(arg2); \
+ register long _arg3 __asm__ ("r2") = (long)(arg3); \
+ register long _arg4 __asm__ ("r3") = (long)(arg4); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
@@ -157,14 +157,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \
- register long _num asm("r7") = (num); \
- register long _arg1 asm("r0") = (long)(arg1); \
- register long _arg2 asm("r1") = (long)(arg2); \
- register long _arg3 asm("r2") = (long)(arg3); \
- register long _arg4 asm("r3") = (long)(arg4); \
- register long _arg5 asm("r4") = (long)(arg5); \
+ register long _num __asm__ ("r7") = (num); \
+ register long _arg1 __asm__ ("r0") = (long)(arg1); \
+ register long _arg2 __asm__ ("r1") = (long)(arg2); \
+ register long _arg3 __asm__ ("r2") = (long)(arg3); \
+ register long _arg4 __asm__ ("r3") = (long)(arg4); \
+ register long _arg5 __asm__ ("r4") = (long)(arg5); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"svc #0\n" \
: "=r" (_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
@@ -175,7 +175,7 @@ struct sys_stat_struct {
})
/* startup code */
-asm(".section .text\n"
+__asm__ (".section .text\n"
".weak _start\n"
".global _start\n"
"_start:\n"
diff --git a/tools/include/nolibc/arch-i386.h b/tools/include/nolibc/arch-i386.h
index d7e4d53325a3..136d5739e456 100644
--- a/tools/include/nolibc/arch-i386.h
+++ b/tools/include/nolibc/arch-i386.h
@@ -66,9 +66,9 @@ struct sys_stat_struct {
#define my_syscall0(num) \
({ \
long _ret; \
- register long _num asm("eax") = (num); \
+ register long _num __asm__ ("eax") = (num); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"int $0x80\n" \
: "=a" (_ret) \
: "0"(_num) \
@@ -80,10 +80,10 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \
({ \
long _ret; \
- register long _num asm("eax") = (num); \
- register long _arg1 asm("ebx") = (long)(arg1); \
+ register long _num __asm__ ("eax") = (num); \
+ register long _arg1 __asm__ ("ebx") = (long)(arg1); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"int $0x80\n" \
: "=a" (_ret) \
: "r"(_arg1), \
@@ -96,11 +96,11 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \
({ \
long _ret; \
- register long _num asm("eax") = (num); \
- register long _arg1 asm("ebx") = (long)(arg1); \
- register long _arg2 asm("ecx") = (long)(arg2); \
+ register long _num __asm__ ("eax") = (num); \
+ register long _arg1 __asm__ ("ebx") = (long)(arg1); \
+ register long _arg2 __asm__ ("ecx") = (long)(arg2); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"int $0x80\n" \
: "=a" (_ret) \
: "r"(_arg1), "r"(_arg2), \
@@ -113,12 +113,12 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \
({ \
long _ret; \
- register long _num asm("eax") = (num); \
- register long _arg1 asm("ebx") = (long)(arg1); \
- register long _arg2 asm("ecx") = (long)(arg2); \
- register long _arg3 asm("edx") = (long)(arg3); \
+ register long _num __asm__ ("eax") = (num); \
+ register long _arg1 __asm__ ("ebx") = (long)(arg1); \
+ register long _arg2 __asm__ ("ecx") = (long)(arg2); \
+ register long _arg3 __asm__ ("edx") = (long)(arg3); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"int $0x80\n" \
: "=a" (_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), \
@@ -131,13 +131,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \
long _ret; \
- register long _num asm("eax") = (num); \
- register long _arg1 asm("ebx") = (long)(arg1); \
- register long _arg2 asm("ecx") = (long)(arg2); \
- register long _arg3 asm("edx") = (long)(arg3); \
- register long _arg4 asm("esi") = (long)(arg4); \
+ register long _num __asm__ ("eax") = (num); \
+ register long _arg1 __asm__ ("ebx") = (long)(arg1); \
+ register long _arg2 __asm__ ("ecx") = (long)(arg2); \
+ register long _arg3 __asm__ ("edx") = (long)(arg3); \
+ register long _arg4 __asm__ ("esi") = (long)(arg4); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"int $0x80\n" \
: "=a" (_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
@@ -150,14 +150,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \
long _ret; \
- register long _num asm("eax") = (num); \
- register long _arg1 asm("ebx") = (long)(arg1); \
- register long _arg2 asm("ecx") = (long)(arg2); \
- register long _arg3 asm("edx") = (long)(arg3); \
- register long _arg4 asm("esi") = (long)(arg4); \
- register long _arg5 asm("edi") = (long)(arg5); \
+ register long _num __asm__ ("eax") = (num); \
+ register long _arg1 __asm__ ("ebx") = (long)(arg1); \
+ register long _arg2 __asm__ ("ecx") = (long)(arg2); \
+ register long _arg3 __asm__ ("edx") = (long)(arg3); \
+ register long _arg4 __asm__ ("esi") = (long)(arg4); \
+ register long _arg5 __asm__ ("edi") = (long)(arg5); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"int $0x80\n" \
: "=a" (_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
@@ -174,7 +174,7 @@ struct sys_stat_struct {
* 2) The deepest stack frame should be set to zero
*
*/
-asm(".section .text\n"
+__asm__ (".section .text\n"
".weak _start\n"
".global _start\n"
"_start:\n"
diff --git a/tools/include/nolibc/arch-mips.h b/tools/include/nolibc/arch-mips.h
index c9a6aac87c6d..cd587e539d7d 100644
--- a/tools/include/nolibc/arch-mips.h
+++ b/tools/include/nolibc/arch-mips.h
@@ -69,10 +69,10 @@ struct sys_stat_struct {
#define my_syscall0(num) \
({ \
- register long _num asm("v0") = (num); \
- register long _arg4 asm("a3"); \
+ register long _num __asm__ ("v0") = (num); \
+ register long _arg4 __asm__ ("a3"); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \
"syscall\n" \
"addiu $sp, $sp, 32\n" \
@@ -86,11 +86,11 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \
({ \
- register long _num asm("v0") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
- register long _arg4 asm("a3"); \
+ register long _num __asm__ ("v0") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
+ register long _arg4 __asm__ ("a3"); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \
"syscall\n" \
"addiu $sp, $sp, 32\n" \
@@ -105,12 +105,12 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \
({ \
- register long _num asm("v0") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
- register long _arg2 asm("a1") = (long)(arg2); \
- register long _arg4 asm("a3"); \
+ register long _num __asm__ ("v0") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
+ register long _arg2 __asm__ ("a1") = (long)(arg2); \
+ register long _arg4 __asm__ ("a3"); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \
"syscall\n" \
"addiu $sp, $sp, 32\n" \
@@ -125,13 +125,13 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \
({ \
- register long _num asm("v0") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
- register long _arg2 asm("a1") = (long)(arg2); \
- register long _arg3 asm("a2") = (long)(arg3); \
- register long _arg4 asm("a3"); \
+ register long _num __asm__ ("v0") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
+ register long _arg2 __asm__ ("a1") = (long)(arg2); \
+ register long _arg3 __asm__ ("a2") = (long)(arg3); \
+ register long _arg4 __asm__ ("a3"); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \
"syscall\n" \
"addiu $sp, $sp, 32\n" \
@@ -146,13 +146,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \
- register long _num asm("v0") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
- register long _arg2 asm("a1") = (long)(arg2); \
- register long _arg3 asm("a2") = (long)(arg3); \
- register long _arg4 asm("a3") = (long)(arg4); \
+ register long _num __asm__ ("v0") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
+ register long _arg2 __asm__ ("a1") = (long)(arg2); \
+ register long _arg3 __asm__ ("a2") = (long)(arg3); \
+ register long _arg4 __asm__ ("a3") = (long)(arg4); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \
"syscall\n" \
"addiu $sp, $sp, 32\n" \
@@ -167,14 +167,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \
- register long _num asm("v0") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
- register long _arg2 asm("a1") = (long)(arg2); \
- register long _arg3 asm("a2") = (long)(arg3); \
- register long _arg4 asm("a3") = (long)(arg4); \
+ register long _num __asm__ ("v0") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
+ register long _arg2 __asm__ ("a1") = (long)(arg2); \
+ register long _arg3 __asm__ ("a2") = (long)(arg3); \
+ register long _arg4 __asm__ ("a3") = (long)(arg4); \
register long _arg5 = (long)(arg5); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \
"sw %7, 16($sp)\n" \
"syscall\n " \
@@ -189,7 +189,7 @@ struct sys_stat_struct {
})
/* startup code, note that it's called __start on MIPS */
-asm(".section .text\n"
+__asm__ (".section .text\n"
".weak __start\n"
".set nomips16\n"
".global __start\n"
diff --git a/tools/include/nolibc/arch-riscv.h b/tools/include/nolibc/arch-riscv.h
index bc10b7b5706d..8ec4c05fa69b 100644
--- a/tools/include/nolibc/arch-riscv.h
+++ b/tools/include/nolibc/arch-riscv.h
@@ -66,10 +66,10 @@ struct sys_stat_struct {
#define my_syscall0(num) \
({ \
- register long _num asm("a7") = (num); \
- register long _arg1 asm("a0"); \
+ register long _num __asm__ ("a7") = (num); \
+ register long _arg1 __asm__ ("a0"); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"ecall\n\t" \
: "=r"(_arg1) \
: "r"(_num) \
@@ -80,10 +80,10 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \
({ \
- register long _num asm("a7") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
+ register long _num __asm__ ("a7") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"ecall\n" \
: "+r"(_arg1) \
: "r"(_num) \
@@ -94,11 +94,11 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \
({ \
- register long _num asm("a7") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
- register long _arg2 asm("a1") = (long)(arg2); \
+ register long _num __asm__ ("a7") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
+ register long _arg2 __asm__ ("a1") = (long)(arg2); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"ecall\n" \
: "+r"(_arg1) \
: "r"(_arg2), \
@@ -110,12 +110,12 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \
({ \
- register long _num asm("a7") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
- register long _arg2 asm("a1") = (long)(arg2); \
- register long _arg3 asm("a2") = (long)(arg3); \
+ register long _num __asm__ ("a7") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
+ register long _arg2 __asm__ ("a1") = (long)(arg2); \
+ register long _arg3 __asm__ ("a2") = (long)(arg3); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"ecall\n\t" \
: "+r"(_arg1) \
: "r"(_arg2), "r"(_arg3), \
@@ -127,13 +127,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \
- register long _num asm("a7") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
- register long _arg2 asm("a1") = (long)(arg2); \
- register long _arg3 asm("a2") = (long)(arg3); \
- register long _arg4 asm("a3") = (long)(arg4); \
+ register long _num __asm__ ("a7") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
+ register long _arg2 __asm__ ("a1") = (long)(arg2); \
+ register long _arg3 __asm__ ("a2") = (long)(arg3); \
+ register long _arg4 __asm__ ("a3") = (long)(arg4); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"ecall\n" \
: "+r"(_arg1) \
: "r"(_arg2), "r"(_arg3), "r"(_arg4), \
@@ -145,14 +145,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \
- register long _num asm("a7") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
- register long _arg2 asm("a1") = (long)(arg2); \
- register long _arg3 asm("a2") = (long)(arg3); \
- register long _arg4 asm("a3") = (long)(arg4); \
- register long _arg5 asm("a4") = (long)(arg5); \
+ register long _num __asm__ ("a7") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
+ register long _arg2 __asm__ ("a1") = (long)(arg2); \
+ register long _arg3 __asm__ ("a2") = (long)(arg3); \
+ register long _arg4 __asm__ ("a3") = (long)(arg4); \
+ register long _arg5 __asm__ ("a4") = (long)(arg5); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"ecall\n" \
: "+r"(_arg1) \
: "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
@@ -164,15 +164,15 @@ struct sys_stat_struct {
#define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \
({ \
- register long _num asm("a7") = (num); \
- register long _arg1 asm("a0") = (long)(arg1); \
- register long _arg2 asm("a1") = (long)(arg2); \
- register long _arg3 asm("a2") = (long)(arg3); \
- register long _arg4 asm("a3") = (long)(arg4); \
- register long _arg5 asm("a4") = (long)(arg5); \
- register long _arg6 asm("a5") = (long)(arg6); \
+ register long _num __asm__ ("a7") = (num); \
+ register long _arg1 __asm__ ("a0") = (long)(arg1); \
+ register long _arg2 __asm__ ("a1") = (long)(arg2); \
+ register long _arg3 __asm__ ("a2") = (long)(arg3); \
+ register long _arg4 __asm__ ("a3") = (long)(arg4); \
+ register long _arg5 __asm__ ("a4") = (long)(arg5); \
+ register long _arg6 __asm__ ("a5") = (long)(arg6); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"ecall\n" \
: "+r"(_arg1) \
: "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), "r"(_arg6), \
@@ -183,7 +183,7 @@ struct sys_stat_struct {
})
/* startup code */
-asm(".section .text\n"
+__asm__ (".section .text\n"
".weak _start\n"
".global _start\n"
"_start:\n"
diff --git a/tools/include/nolibc/arch-x86_64.h b/tools/include/nolibc/arch-x86_64.h
index a7b70ea51b68..490530429ac9 100644
--- a/tools/include/nolibc/arch-x86_64.h
+++ b/tools/include/nolibc/arch-x86_64.h
@@ -68,9 +68,9 @@ struct sys_stat_struct {
#define my_syscall0(num) \
({ \
long _ret; \
- register long _num asm("rax") = (num); \
+ register long _num __asm__ ("rax") = (num); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"syscall\n" \
: "=a"(_ret) \
: "0"(_num) \
@@ -82,10 +82,10 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \
({ \
long _ret; \
- register long _num asm("rax") = (num); \
- register long _arg1 asm("rdi") = (long)(arg1); \
+ register long _num __asm__ ("rax") = (num); \
+ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"syscall\n" \
: "=a"(_ret) \
: "r"(_arg1), \
@@ -98,11 +98,11 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \
({ \
long _ret; \
- register long _num asm("rax") = (num); \
- register long _arg1 asm("rdi") = (long)(arg1); \
- register long _arg2 asm("rsi") = (long)(arg2); \
+ register long _num __asm__ ("rax") = (num); \
+ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
+ register long _arg2 __asm__ ("rsi") = (long)(arg2); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"syscall\n" \
: "=a"(_ret) \
: "r"(_arg1), "r"(_arg2), \
@@ -115,12 +115,12 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \
({ \
long _ret; \
- register long _num asm("rax") = (num); \
- register long _arg1 asm("rdi") = (long)(arg1); \
- register long _arg2 asm("rsi") = (long)(arg2); \
- register long _arg3 asm("rdx") = (long)(arg3); \
+ register long _num __asm__ ("rax") = (num); \
+ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
+ register long _arg2 __asm__ ("rsi") = (long)(arg2); \
+ register long _arg3 __asm__ ("rdx") = (long)(arg3); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"syscall\n" \
: "=a"(_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), \
@@ -133,13 +133,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \
long _ret; \
- register long _num asm("rax") = (num); \
- register long _arg1 asm("rdi") = (long)(arg1); \
- register long _arg2 asm("rsi") = (long)(arg2); \
- register long _arg3 asm("rdx") = (long)(arg3); \
- register long _arg4 asm("r10") = (long)(arg4); \
+ register long _num __asm__ ("rax") = (num); \
+ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
+ register long _arg2 __asm__ ("rsi") = (long)(arg2); \
+ register long _arg3 __asm__ ("rdx") = (long)(arg3); \
+ register long _arg4 __asm__ ("r10") = (long)(arg4); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"syscall\n" \
: "=a"(_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
@@ -152,14 +152,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \
long _ret; \
- register long _num asm("rax") = (num); \
- register long _arg1 asm("rdi") = (long)(arg1); \
- register long _arg2 asm("rsi") = (long)(arg2); \
- register long _arg3 asm("rdx") = (long)(arg3); \
- register long _arg4 asm("r10") = (long)(arg4); \
- register long _arg5 asm("r8") = (long)(arg5); \
+ register long _num __asm__ ("rax") = (num); \
+ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
+ register long _arg2 __asm__ ("rsi") = (long)(arg2); \
+ register long _arg3 __asm__ ("rdx") = (long)(arg3); \
+ register long _arg4 __asm__ ("r10") = (long)(arg4); \
+ register long _arg5 __asm__ ("r8") = (long)(arg5); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"syscall\n" \
: "=a"(_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
@@ -172,15 +172,15 @@ struct sys_stat_struct {
#define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \
({ \
long _ret; \
- register long _num asm("rax") = (num); \
- register long _arg1 asm("rdi") = (long)(arg1); \
- register long _arg2 asm("rsi") = (long)(arg2); \
- register long _arg3 asm("rdx") = (long)(arg3); \
- register long _arg4 asm("r10") = (long)(arg4); \
- register long _arg5 asm("r8") = (long)(arg5); \
- register long _arg6 asm("r9") = (long)(arg6); \
+ register long _num __asm__ ("rax") = (num); \
+ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
+ register long _arg2 __asm__ ("rsi") = (long)(arg2); \
+ register long _arg3 __asm__ ("rdx") = (long)(arg3); \
+ register long _arg4 __asm__ ("r10") = (long)(arg4); \
+ register long _arg5 __asm__ ("r8") = (long)(arg5); \
+ register long _arg6 __asm__ ("r9") = (long)(arg6); \
\
- asm volatile ( \
+ __asm__ volatile ( \
"syscall\n" \
: "=a"(_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
@@ -197,7 +197,7 @@ struct sys_stat_struct {
* 2) The deepest stack frame should be zero (the %rbp).
*
*/
-asm(".section .text\n"
+__asm__ (".section .text\n"
".weak _start\n"
".global _start\n"
"_start:\n"
--
2.31.1.189.g2e36527f23
next prev parent reply other threads:[~2022-04-19 0:42 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-19 0:42 [PATCH nolibc 0/61] nolibc updates for v5.19 Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 01/61] tools/nolibc: use pselect6 on RISCV Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 02/61] tools/nolibc: guard the main file against multiple inclusion Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 03/61] tools/nolibc/std: move the standard type definitions to std.h Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 04/61] tools/nolibc/types: split syscall-specific definitions into their own files Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 05/61] tools/nolibc/arch: split arch-specific code into individual files Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 06/61] tools/nolibc/sys: split the syscall definitions into their own file Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 07/61] tools/nolibc/stdlib: extract the stdlib-specific functions to " Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 08/61] tools/nolibc/string: split the string functions into string.h Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 09/61] tools/nolibc/ctype: split the is* functions to ctype.h Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 10/61] tools/nolibc/ctype: add the missing is* functions Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 11/61] tools/nolibc/types: move the FD_* functions to macros in types.h Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 12/61] tools/nolibc/types: make FD_SETSIZE configurable Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 13/61] tools/nolibc/types: move makedev to types.h and make it a macro Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 14/61] tools/nolibc/stdlib: move ltoa() to stdlib.h Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 15/61] tools/nolibc/stdlib: replace the ltoa() function with more efficient ones Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 16/61] tools/nolibc/stdlib: add i64toa() and u64toa() Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 17/61] tools/nolibc/stdlib: add utoh() and u64toh() Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 18/61] tools/nolibc/stdio: add a minimal set of stdio functions Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 19/61] tools/nolibc/stdio: add stdin/stdout/stderr and fget*/fput* functions Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 20/61] tools/nolibc/stdio: add fwrite() to stdio Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 21/61] tools/nolibc/stdio: add a minimal [vf]printf() implementation Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 22/61] tools/nolibc/types: define EXIT_SUCCESS and EXIT_FAILURE Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 23/61] tools/nolibc/stdio: add perror() to report the errno value Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 24/61] tools/nolibc/sys: make open() take a vararg on the 3rd argument Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 25/61] tools/nolibc/stdlib: avoid a 64-bit shift in u64toh_r() Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 26/61] tools/nolibc/stdlib: make raise() use the lower level syscalls only Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 27/61] tools/nolibc/sys: make getpgrp(), getpid(), gettid() not set errno Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 28/61] tools/nolibc/string: use unidirectional variants for memcpy() Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 29/61] tools/nolibc/string: slightly simplify memmove() Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 30/61] tools/nolibc/string: add strncpy() and strlcpy() Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 31/61] tools/nolibc/string: add tiny versions of strncat() and strlcat() Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 32/61] tools/nolibc: move exported functions to their own section Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 33/61] tools/nolibc/arch: mark the _start symbol as weak Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 34/61] tools/nolibc/types: define PATH_MAX and MAXPATHLEN Paul E. McKenney
2022-04-19 0:41 ` [PATCH nolibc 35/61] tools/nolibc/string: export memset() and memmove() Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 36/61] tools/nolibc/errno: extract errno.h from sys.h Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 37/61] tools/nolibc/unistd: extract msleep(), sleep(), tcsetpgrp() to unistd.h Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 38/61] tools/nolibc/unistd: add usleep() Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 39/61] tools/nolibc/signal: move raise() to signal.h Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 40/61] tools/nolibc/time: create time.h with time() Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 41/61] tools/nolibc: also mention how to build by just setting the include path Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 42/61] tools/nolibc/stdlib: implement abort() Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 43/61] tools/nolibc/stdio: make printf(%s) accept NULL Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 44/61] tools/nolibc/stdlib: add a simple getenv() implementation Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 45/61] tools/nolibc/stdio: add support for '%p' to vfprintf() Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 46/61] tools/nolibc/string: add strcmp() and strncmp() Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 47/61] tools/nolibc/sys: add syscall definition for getppid() Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 48/61] tools/nolibc/types: add poll() and waitpid() flag definitions Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 49/61] tools/nolibc: add a makefile to install headers Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 50/61] tools/nolibc: add the nolibc subdir to the common Makefile Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 51/61] tools/nolibc/string: do not use __builtin_strlen() at -O0 Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 52/61] tools/nolibc/stdlib: only reference the external environ when inlined Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 53/61] tools/nolibc: x86-64: Update System V ABI document link Paul E. McKenney
2022-04-19 0:42 ` Paul E. McKenney [this message]
2022-04-19 0:42 ` [PATCH nolibc 55/61] tools/nolibc: Remove .global _start from the entry point code Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 56/61] tools/nolibc: i386: Implement syscall with 6 arguments Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 57/61] tools/nolibc/sys: Implement `mmap()` and `munmap()` Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 58/61] tools/nolibc/types: Implement `offsetof()` and `container_of()` macro Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 59/61] tools/nolibc/stdlib: Implement `malloc()`, `calloc()`, `realloc()` and `free()` Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 60/61] tools/nolibc/string: Implement `strnlen()` Paul E. McKenney
2022-04-19 0:42 ` [PATCH nolibc 61/61] tools/nolibc/string: Implement `strdup()` and `strndup()` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox