diff --git a/doc/types.md b/doc/types.md index 29f9163c4d..5c24006e72 100644 --- a/doc/types.md +++ b/doc/types.md @@ -126,6 +126,7 @@ func.strcasecmp.ret=int func.strcasecmp.cc=cdecl ``` +Note that the `.cc` part is optional and if it didn't exist the default calling convention for your target architecture will be used instead. Their is one extra optional key ``` diff --git a/libr/anal/d/Makefile b/libr/anal/d/Makefile index 904713a0c2..06b41e161a 100644 --- a/libr/anal/d/Makefile +++ b/libr/anal/d/Makefile @@ -9,21 +9,11 @@ F+= types F+= types-16 F+= types-32 F+= types-64 -F+= types-x86-32 -F+= types-x86-64 F+= types-windows F+= types-x86-windows-32 F+= types-x86-windows-64 F+= types-linux -F+= types-x86-linux-32 -F+= types-x86-linux-64 F+= types-x86-osx-64 -F+= types-arm-linux-32 -F+= types-arm-linux-64 -F+= types-arm-32 -F+= types-arm-64 -F+= types-riscv-64 -F+= types-riscv-linux-64 F+= cc-x86-64 F+= cc-x86-32 F+= cc-mips-32 diff --git a/libr/anal/d/types-arm-32 b/libr/anal/d/types-arm-32 deleted file mode 100644 index f13353d218..0000000000 --- a/libr/anal/d/types-arm-32 +++ /dev/null @@ -1,17 +0,0 @@ -func.calloc.cc=arm32 -func.fgetc.cc=arm32 -func.fgets.cc=arm32 -func.free.cc=arm32 -func.getc.cc=arm32 -func.getchar.cc=arm32 -func.getenv.cc=arm32 -func.getopt.cc=arm32 -func.getuid.cc=arm32 -func.ioctl.cc=arm32 -func.isatty.cc=arm32 -func.malloc.cc=arm32 -func.realloc.cc=arm32 -func.setlocale.cc=arm32 -func.strcpy.cc=arm32 -func.strncpycc=arm32 -func.ungetc.cc=arm32 diff --git a/libr/anal/d/types-arm-64 b/libr/anal/d/types-arm-64 deleted file mode 100644 index e5beabdfcc..0000000000 --- a/libr/anal/d/types-arm-64 +++ /dev/null @@ -1,17 +0,0 @@ -func.calloc.cc=arm64 -func.fgetc.cc=arm64 -func.fgets.cc=arm64 -func.free.cc=arm64 -func.getc.cc=arm64 -func.getchar.cc=arm64 -func.getenv.cc=arm64 -func.getopt.cc=arm64 -func.getuid.cc=arm64 -func.ioctl.cc=arm64 -func.isatty.cc=arm64 -func.malloc.cc=arm64 -func.realloc.cc=arm64 -func.setlocale.cc=arm64 -func.strcpy.cc=arm64 -func.strncpycc=arm64 -func.ungetc.cc=arm64 diff --git a/libr/anal/d/types-arm-linux-32 b/libr/anal/d/types-arm-linux-32 deleted file mode 100644 index a9b1e66af4..0000000000 --- a/libr/anal/d/types-arm-linux-32 +++ /dev/null @@ -1,9 +0,0 @@ -func.__assert_fail.cc=arm32 -func._exit.cc=arm32 -func._Exit.cc=arm32 -func.__libc_init.cc=arm32 -func.__libc_init_array.cc=arm32 -func.__libc_start_main.cc=arm32 -func.abort.cc=arm32 -func.atexit.cc=arm32 -func.exit.cc=arm32 diff --git a/libr/anal/d/types-arm-linux-64 b/libr/anal/d/types-arm-linux-64 deleted file mode 100644 index 43676c44ac..0000000000 --- a/libr/anal/d/types-arm-linux-64 +++ /dev/null @@ -1,9 +0,0 @@ -func.__assert_fail.cc=arm64 -func._exit.cc=arm64 -func._Exit.cc=arm64 -func.__libc_init.cc=arm64 -func.__libc_init_array.cc=arm64 -func.__libc_start_main.cc=arm64 -func.abort.cc=arm64 -func.atexit.cc=arm64 -func.exit.cc=arm64 diff --git a/libr/anal/d/types-riscv-64 b/libr/anal/d/types-riscv-64 deleted file mode 100644 index 274453fca7..0000000000 --- a/libr/anal/d/types-riscv-64 +++ /dev/null @@ -1,17 +0,0 @@ -func.calloc.cc=rvg -func.fgetc.cc=rvg -func.fgets.cc=rvg -func.free.cc=rvg -func.getc.cc=rvg -func.getchar.cc=rvg -func.getenv.cc=rvg -func.getopt.cc=rvg -func.getuid.cc=rvg -func.ioctl.cc=rvg -func.isatty.cc=rvg -func.malloc.cc=rvg -func.realloc.cc=rvg -func.setlocale.cc=rvg -func.strcpy.cc=rvg -func.strncpycc=rvg -func.ungetc.cc=rvg diff --git a/libr/anal/d/types-riscv-linux-64 b/libr/anal/d/types-riscv-linux-64 deleted file mode 100644 index d59c277266..0000000000 --- a/libr/anal/d/types-riscv-linux-64 +++ /dev/null @@ -1,9 +0,0 @@ -func.__assert_fail.cc=rvg -func._exit.cc=rvg -func._Exit.cc=rvg -func.__libc_init.cc=rvg -func.__libc_init_array=rvg -func.__libc_start_main.cc=rvg -func.abort.cc=rvg -func.abort.cc=rvg -func.exit.cc=rvg diff --git a/libr/anal/d/types-x86-32 b/libr/anal/d/types-x86-32 deleted file mode 100644 index 7f876e2fea..0000000000 --- a/libr/anal/d/types-x86-32 +++ /dev/null @@ -1,17 +0,0 @@ -func.calloc.cc=cdecl -func.fgetc.cc=cdecl -func.fgets.cc=cdecl -func.free.cc=cdecl -func.getc.cc=cdecl -func.getchar.cc=cdecl -func.getenv.cc=cdecl -func.getopt.cc=cdecl -func.getuid.cc=cdecl -func.ioctl.cc=cdecl -func.isatty.cc=cdecl -func.malloc.cc=cdecl -func.realloc.cc=cdecl -func.setlocale.cc=cdecl -func.strcpy.cc=cdecl -func.strncpycc=cdecl -func.ungetc.cc=cdecl diff --git a/libr/anal/d/types-x86-64 b/libr/anal/d/types-x86-64 deleted file mode 100644 index 8f810d88a3..0000000000 --- a/libr/anal/d/types-x86-64 +++ /dev/null @@ -1,17 +0,0 @@ -func.calloc.cc=amd64 -func.fgetc.cc=amd64 -func.fgets.cc=amd64 -func.free.cc=amd64 -func.getc.cc=amd64 -func.getchar.cc=amd64 -func.getenv.cc=amd64 -func.getopt.cc=amd64 -func.getuid.cc=amd64 -func.ioctl.cc=amd64 -func.isatty.cc=amd64 -func.malloc.cc=amd64 -func.realloc.cc=amd64 -func.setlocale.cc=amd64 -func.strcpy.cc=amd64 -func.strncpycc=amd64 -func.ungetc.cc=amd64 diff --git a/libr/anal/d/types-x86-linux-32 b/libr/anal/d/types-x86-linux-32 deleted file mode 100644 index 3206f1d8fe..0000000000 --- a/libr/anal/d/types-x86-linux-32 +++ /dev/null @@ -1,9 +0,0 @@ -func.__assert_fail.cc=cdecl -func._exit.cc=cdecl -func._Exit.cc=cdecl -func.__libc_init.cc=cdecl -func.__libc_init_array.cc=cdecl -func.__libc_start_main.cc=cdecl -func.abort.cc=cdecl -func.atexit.cc=cdecl -func.exit.cc=cdecl diff --git a/libr/anal/d/types-x86-linux-64 b/libr/anal/d/types-x86-linux-64 deleted file mode 100644 index 2dd386a30b..0000000000 --- a/libr/anal/d/types-x86-linux-64 +++ /dev/null @@ -1,9 +0,0 @@ -func.__assert_fail.cc=amd64 -func._exit.cc=amd64 -func._Exit.cc=amd64 -func.__libc_init.cc=amd64 -func.__libc_init_array.cc=amd64 -func.__libc_start_main.cc=amd64 -func.abort.cc=amd64 -func.atexit.cc=amd64 -func.exit.cc=amd64 diff --git a/libr/anal/types.c b/libr/anal/types.c index 2321df704d..ca68009044 100644 --- a/libr/anal/types.c +++ b/libr/anal/types.c @@ -297,7 +297,8 @@ R_API const char *r_anal_type_func_ret(RAnal *anal, const char *func_name){ R_API const char *r_anal_type_func_cc(RAnal *anal, const char *func_name) { const char *query = sdb_fmt (-1, "func.%s.cc", func_name); - return sdb_const_get (anal->sdb_types, query, 0); + const char *cc = sdb_const_get (anal->sdb_types, query, 0); + return cc ? cc : r_anal_cc_default (anal); } R_API int r_anal_type_func_args_count(RAnal *anal, const char *func_name) {