Skip to content

Commit 4d2f974

Browse files
committed
Dunder asm for Zephyr toolchain
1 parent 23be085 commit 4d2f974

1 file changed

Lines changed: 49 additions & 49 deletions

File tree

shared/runtime/gchelper_generic.c

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,25 @@
4343
#if defined(__x86_64__)
4444

4545
static void gc_helper_get_regs(gc_helper_regs_t arr) {
46-
register long rbx asm ("rbx");
47-
register long rbp asm ("rbp");
48-
register long r12 asm ("r12");
49-
register long r13 asm ("r13");
50-
register long r14 asm ("r14");
51-
register long r15 asm ("r15");
46+
register long rbx __asm__ ("rbx");
47+
register long rbp __asm__ ("rbp");
48+
register long r12 __asm__ ("r12");
49+
register long r13 __asm__ ("r13");
50+
register long r14 __asm__ ("r14");
51+
register long r15 __asm__ ("r15");
5252
#ifdef __clang__
5353
// TODO:
5454
// This is dirty workaround for Clang. It tries to get around
5555
// uncompliant (wrt to GCC) behavior of handling register variables.
5656
// Application of this patch here is random, and done only to unbreak
5757
// MacOS build. Better, cross-arch ways to deal with Clang issues should
5858
// be found.
59-
asm ("" : "=r" (rbx));
60-
asm ("" : "=r" (rbp));
61-
asm ("" : "=r" (r12));
62-
asm ("" : "=r" (r13));
63-
asm ("" : "=r" (r14));
64-
asm ("" : "=r" (r15));
59+
__asm__ ("" : "=r" (rbx));
60+
__asm__ ("" : "=r" (rbp));
61+
__asm__ ("" : "=r" (r12));
62+
__asm__ ("" : "=r" (r13));
63+
__asm__ ("" : "=r" (r14));
64+
__asm__ ("" : "=r" (r15));
6565
#endif
6666
arr[0] = rbx;
6767
arr[1] = rbp;
@@ -85,10 +85,10 @@ static void gc_helper_get_regs(gc_helper_regs_t arr) {
8585
// Application of this patch here is random, and done only to unbreak
8686
// MacOS build. Better, cross-arch ways to deal with Clang issues should
8787
// be found.
88-
asm ("" : "=r" (ebx));
89-
asm ("" : "=r" (esi));
90-
asm ("" : "=r" (edi));
91-
asm ("" : "=r" (ebp));
88+
__asm__ ("" : "=r" (ebx));
89+
__asm__ ("" : "=r" (esi));
90+
__asm__ ("" : "=r" (edi));
91+
__asm__ ("" : "=r" (ebp));
9292
#endif
9393
arr[0] = ebx;
9494
arr[1] = esi;
@@ -105,16 +105,16 @@ static void gc_helper_get_regs(gc_helper_regs_t arr) {
105105
#pragma clang diagnostic push
106106
#pragma clang diagnostic ignored "-Wuninitialized"
107107
#endif
108-
register long r4 asm ("r4");
109-
register long r5 asm ("r5");
110-
register long r6 asm ("r6");
111-
register long r7 asm ("r7");
112-
register long r8 asm ("r8");
113-
register long r9 asm ("r9");
114-
register long r10 asm ("r10");
115-
register long r11 asm ("r11");
116-
register long r12 asm ("r12");
117-
register long r13 asm ("r13");
108+
register long r4 __asm__ ("r4");
109+
register long r5 __asm__ ("r5");
110+
register long r6 __asm__ ("r6");
111+
register long r7 __asm__ ("r7");
112+
register long r8 __asm__ ("r8");
113+
register long r9 __asm__ ("r9");
114+
register long r10 __asm__ ("r10");
115+
register long r11 __asm__ ("r11");
116+
register long r12 __asm__ ("r12");
117+
register long r13 __asm__ ("r13");
118118
arr[0] = r4;
119119
arr[1] = r5;
120120
arr[2] = r6;
@@ -133,17 +133,17 @@ static void gc_helper_get_regs(gc_helper_regs_t arr) {
133133
#elif defined(__aarch64__)
134134

135135
static void gc_helper_get_regs(gc_helper_regs_t arr) {
136-
const register long x19 asm ("x19");
137-
const register long x20 asm ("x20");
138-
const register long x21 asm ("x21");
139-
const register long x22 asm ("x22");
140-
const register long x23 asm ("x23");
141-
const register long x24 asm ("x24");
142-
const register long x25 asm ("x25");
143-
const register long x26 asm ("x26");
144-
const register long x27 asm ("x27");
145-
const register long x28 asm ("x28");
146-
const register long x29 asm ("x29");
136+
const register long x19 __asm__ ("x19");
137+
const register long x20 __asm__ ("x20");
138+
const register long x21 __asm__ ("x21");
139+
const register long x22 __asm__ ("x22");
140+
const register long x23 __asm__ ("x23");
141+
const register long x24 __asm__ ("x24");
142+
const register long x25 __asm__ ("x25");
143+
const register long x26 __asm__ ("x26");
144+
const register long x27 __asm__ ("x27");
145+
const register long x28 __asm__ ("x28");
146+
const register long x29 __asm__ ("x29");
147147
arr[0] = x19;
148148
arr[1] = x20;
149149
arr[2] = x21;
@@ -163,18 +163,18 @@ static void gc_helper_get_regs(gc_helper_regs_t arr) {
163163
// for RV32I targets or gchelper_rv64i.s for RV64I targets.
164164

165165
static void gc_helper_get_regs(gc_helper_regs_t arr) {
166-
register uintptr_t s0 asm ("x8");
167-
register uintptr_t s1 asm ("x9");
168-
register uintptr_t s2 asm ("x18");
169-
register uintptr_t s3 asm ("x19");
170-
register uintptr_t s4 asm ("x20");
171-
register uintptr_t s5 asm ("x21");
172-
register uintptr_t s6 asm ("x22");
173-
register uintptr_t s7 asm ("x23");
174-
register uintptr_t s8 asm ("x24");
175-
register uintptr_t s9 asm ("x25");
176-
register uintptr_t s10 asm ("x26");
177-
register uintptr_t s11 asm ("x27");
166+
register uintptr_t s0 __asm__ ("x8");
167+
register uintptr_t s1 __asm__ ("x9");
168+
register uintptr_t s2 __asm__ ("x18");
169+
register uintptr_t s3 __asm__ ("x19");
170+
register uintptr_t s4 __asm__ ("x20");
171+
register uintptr_t s5 __asm__ ("x21");
172+
register uintptr_t s6 __asm__ ("x22");
173+
register uintptr_t s7 __asm__ ("x23");
174+
register uintptr_t s8 __asm__ ("x24");
175+
register uintptr_t s9 __asm__ ("x25");
176+
register uintptr_t s10 __asm__ ("x26");
177+
register uintptr_t s11 __asm__ ("x27");
178178
arr[0] = s0;
179179
arr[1] = s1;
180180
arr[2] = s2;

0 commit comments

Comments
 (0)