On Sun, Nov 24, 2024 at 05:51:59PM -0300, Brian Mayer wrote: > Hello again. > > > Very long ago I did similar tries. As a workaround, I rewrote the > > syscall wrapper in musl[1]. > > > > For the reason, I think there's something wrong in x86-64 asm constraint > > computation, since r10 is always in a register. satisfying the > > constraint. > > > > Cheers, > > Yao Zi > Thanks for the help, but It didn't work, I got the same error message. > But I wasn't able to apply your change in exactly the same way, > because I didn't find the file src/internal/x86_64/syscall.S, so I
Just create one ;) > changed the file arch/x86_64/syscall_arch.h to add your assembly. So > the function becomes: > > static __inline long __syscall6(long n, long a1, long a2, long a3, > long a4, long a5, long a6) > { > unsigned long ret; > __asm__ __volatile__ ( > "movq %%rdi, %%rax\n" > "movq %%rsi, %%rdi\n" > "movq %%rdx, %%rsi\n" > "movq %%rcx, %%rdx\n" > "movq %%r8, %%r10\n" > "movq %%r9, %%r8\n" > "movq 8(%%rsp), %%r9\n" > "syscall\n" > : "=a"(ret) > : "r"(n), "r"(a1), "r"(a2), > "r"(a3), "r"(a4), "r"(a5), "r"(a6) > : "rcx", "r11", "memory" // clobbers: rcx, > r11 > ); // <- line 69 > return ret; > } > > I got the same error but now in line 69. Is this function correct? I think there's something wrong with the register allocator and using inline assembly hits the bug again and doesn't help. That's why I added a seperate x86_64/syscall.S to work around it. Cheers, Yao Zi _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel