rizin/test/db/cmd/cmd_tcc
NOT XVilka 155ead6822
librz/reg: derive CC with more than four argument registers (#6600)
rz_reg_profile_to_cc() only emitted the first four argument registers
(A0-A3), so architectures that pass more arguments in registers -- the
C6000 EABI uses ten, and x86-64/riscv/ppc all declare more than four --
got a truncated convention. Walk the whole A0-A9 role range, stopping at
the first role the profile leaves undefined, and build the cc string with
RzStrBuf. Covered by a new test_reg unit test.

Co-authored-by agent: Claude/claude-opus-4-8

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-07-06 03:35:41 +08:00

89 lines
1.6 KiB
Text

NAME=tcc-star
FILE=bins/elf/ls
CMDS=<<EOF
tcc
tcc-*
tcc
EOF
EXPECT=<<EOF
amd64
amd64syscall
ms
reg
swift
EOF
RUN
NAME=tcc
FILE=bins/elf/ls
CMDS=tcc
EXPECT=<<EOF
amd64
amd64syscall
ms
reg
swift
EOF
RUN
NAME=tccj, tccl, tcc* outputs
FILE=bins/elf/ls
CMDS=<<EOF
tccj
tccl
EOF
EXPECT=<<EOF
[{"name":"amd64","ret":"rax","args":["rdi","rsi","rdx","rcx","r8","r9","xmm0","xmm1","xmm2","xmm3","xmm4"]},{"name":"amd64syscall","ret":"rax","args":["rdi","rsi","rdx","r10","r8","r9"]},{"name":"ms","ret":"rax","args":["rcx","rdx","r8","r9"]},{"name":"reg","ret":"rdi","args":["rdi","rsi","rdx","rcx","r8","r9","r10","r11"]},{"name":"swift","ret":"rax","args":["rdi","rsi","rdx","rcx","r8","r9","xmm0","xmm1","xmm2","xmm3","xmm4"],"self":"r13","error":"r12"}]
rax amd64 (rdi, rsi, rdx, rcx, r8, r9, xmm0, xmm1, xmm2, xmm3, xmm4);
rax amd64syscall (rdi, rsi, rdx, r10, r8, r9);
rax ms (rcx, rdx, r8, r9, stack);
rdi reg (rdi, rsi, rdx, rcx, r8, r9, r10, r11);
rax r13.swift (rdi, rsi, rdx, rcx, r8, r9, xmm0, xmm1, xmm2, xmm3, xmm4) r12;
EOF
RUN
NAME=tcc
FILE==
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
echo 1
tcc "eax jeje(ebx, ecx)"
tcc jeje
tcc- jeje
echo 2
tcc "eax jeje(ebx, ecx)"
tcc jeje
tcc- jeje
echo 3
tcc "eax jeje (ebx, ecx)"
tcc jeje
tcc- jeje
echo 4
tcc "eax jeje (ebx, ecx)"
tcc jeje
tcc- jeje
echo 5
tcc " eax jeje ( ebx, ecx )"
tcc jeje
tcc- jeje
echo 6
tcc " eax jeje ( ebx , ecx )"
tcc jeje
tcc- jeje
EOF
EXPECT=<<EOF
1
eax jeje (ebx, ecx);
2
eax jeje (ebx, ecx);
3
eax jeje (ebx, ecx);
4
eax jeje (ebx, ecx);
5
eax jeje (ebx, ecx);
6
eax jeje (ebx, ecx);
EOF
RUN