diff --git a/libr/anal/fcn.c b/libr/anal/fcn.c index 41f89b3ef023c..81f594a0c4110 100644 --- a/libr/anal/fcn.c +++ b/libr/anal/fcn.c @@ -624,11 +624,7 @@ static int fcn_recurse(RAnal *anal, RAnalFunction *fcn, ut64 addr, ut64 len, int }; const char *arch = anal->config? anal->config->arch: R_SYS_ARCH; bool arch_destroys_dst = does_arch_destroys_dst (arch); -#if R2_USE_NEW_ABI const bool flagends = anal->opt.flagends; -#else - const bool flagends = anal->coreb.cfggeti (anal->coreb.core, "anal.flagends"); -#endif const bool is_arm = r_str_startswith (arch, "arm"); const bool is_mips = !is_arm && r_str_startswith (arch, "mips"); const bool is_v850 = is_arm ? false: (arch && (!strncmp (arch, "v850", 4) || !strncmp (anal->coreb.cfgGet (anal->coreb.core, "asm.cpu"), "v850", 4))); @@ -1122,10 +1118,7 @@ static int fcn_recurse(RAnal *anal, RAnalFunction *fcn, ut64 addr, ut64 len, int // R2R db/anal/arm db/esil/apple //v1 = UT64_MAX; // reset v1 jmptable pointer value for mips only // on stm8 this must be disabled.. but maybe we need a global option to disable icod refs - bool want_icods = true; -#if R2_USE_NEW_ABI - // want_icods = anal->opt.icods; -#endif + bool want_icods = anal->opt.icods; { const char *arch = R_UNWRAP3 (anal, config, arch); if (r_str_startswith (arch, "stm8")) { diff --git a/libr/bin/bin.c b/libr/bin/bin.c index 90497ad2b72b8..ab57ddaeb2c29 100644 --- a/libr/bin/bin.c +++ b/libr/bin/bin.c @@ -1687,13 +1687,7 @@ R_API char *r_bin_attr_tostring(ut64 attr, bool singlechar) { return r_strbuf_drain (sb); } -// TODO : not implemented yet -#if R2_USE_NEW_ABI R_API ut64 r_bin_attr_fromstring(const char *s, bool compact) { -#else -R_API ut64 r_bin_attr_fromstring(const char *s) { - const bool compact = false; -#endif size_t i; ut64 bits = 0LL; const char *word; diff --git a/libr/bin/dbginfo.c b/libr/bin/dbginfo.c index 11c6383bd9043..263def29e3180 100644 --- a/libr/bin/dbginfo.c +++ b/libr/bin/dbginfo.c @@ -130,13 +130,11 @@ R_API R_NULLABLE char *r_bin_addr2text(RBin *bin, ut64 addr, int origin) { } char *res = NULL; char *filename = strdup (di->file); -#if R2_USE_NEW_ABI if (R_STR_ISNOTEMPTY (bin->srcdir_base) && r_str_startswith (filename, bin->srcdir_base)) { char *fn = strdup (filename + strlen (bin->srcdir_base)); free (filename); filename = fn; } -#endif char *basename = strdup (r_file_basename (di->file)); #if __APPLE__ // early optimization because mac's home is slow diff --git a/libr/bin/p/bin_mach0.c b/libr/bin/p/bin_mach0.c index 0725d6f28006e..b8066a17b2069 100644 --- a/libr/bin/p/bin_mach0.c +++ b/libr/bin/p/bin_mach0.c @@ -587,11 +587,7 @@ static RList* patch_relocs(RBinFile *bf) { static RBuffer *swizzle_io_read(RBinFile *bf, struct MACH0_(obj_t) *obj, RIO *io) { R_RETURN_VAL_IF_FAIL (io && io->desc && io->desc->plugin, NULL); RFixupRebaseContext ctx = {0}; -#if R2_USE_NEW_ABI RBuffer *nb = r_buf_new_with_cache (obj->b, false); -#else - RBuffer *nb = r_buf_new_with_buf (obj->b); -#endif RBuffer *ob = obj->b; obj->b = nb; ut64 count = r_buf_size (obj->b); diff --git a/libr/core/canal.c b/libr/core/canal.c index b4a393dfa8072..ea608ccb73bd4 100644 --- a/libr/core/canal.c +++ b/libr/core/canal.c @@ -6,6 +6,9 @@ #include #include +// 128M +#define MAX_SCAN_SIZE 0x7ffffff + HEAPTYPE (ut64); R_VEC_TYPE (RVecAnalRef, RAnalRef); @@ -17,8 +20,6 @@ enum { R2_ARCH_ARM64, R2_ARCH_MIPS }; -// 128M -#define MAX_SCAN_SIZE 0x7ffffff static void loganal(ut64 from, ut64 to, int depth) { r_cons_clear_line (1); diff --git a/libr/core/cconfig.c b/libr/core/cconfig.c index 9b5210cd71c00..e91860d1862fa 100644 --- a/libr/core/cconfig.c +++ b/libr/core/cconfig.c @@ -240,11 +240,16 @@ static bool cb_debug_hitinfo(void *user, void *data) { } static bool cb_anal_flagends(void *user, void *data) { -#if R2_USE_NEW_ABI RCore *core = (RCore*) user; RConfigNode *node = (RConfigNode*) data; core->anal->opt.flagends = node->i_value; -#endif + return true; +} + +static bool cb_anal_icods(void *user, void *data) { + RCore *core = (RCore*) user; + RConfigNode *node = (RConfigNode*) data; + core->anal->opt.icods = node->i_value; return true; } @@ -1422,7 +1427,6 @@ static bool cb_dirsrc(void *user, void *data) { return true; } -#if R2_USE_NEW_ABI static bool cb_dirsrc_base(void *user, void *data) { RConfigNode *node = (RConfigNode*) data; RCore *core = (RCore *)user; @@ -1434,7 +1438,6 @@ static bool cb_dirsrc_base(void *user, void *data) { } return true; } -#endif static bool cb_cfgsanbox_grain(void *user, void *data) { RConfigNode *node = (RConfigNode*) data; @@ -3552,6 +3555,7 @@ R_API int r_core_config_init(RCore *core) { NULL); SETI ("anal.timeout", 0, "stop analyzing after a couple of seconds"); SETCB ("anal.flagends", "true", &cb_anal_flagends, "end function when a flag is found"); + SETCB ("anal.icods", "true", &cb_anal_icods, "analyze indirect code references"); SETCB ("anal.jmp.retpoline", "true", &cb_anal_jmpretpoline, "analyze retpolines, may be slower if not needed"); SETCB ("anal.jmp.tailcall", "true", &cb_anal_jmptailcall, "consume a branch as a call if delta is a function"); SETICB ("anal.jmp.tailcall.delta", 0, &cb_anal_jmptailcall_delta, "consume a branch as a call if delta is big"); @@ -3995,9 +3999,7 @@ R_API int r_core_config_init(RCore *core) { SETPREF ("dir.plugins", path, "path to plugin files to be loaded at startup"); free (path); } -#if R2_USE_NEW_ABI SETCB ("dir.source.base", "", &cb_dirsrc_base, "path to trim out from the one in dwarf"); -#endif SETCB ("dir.source", "", &cb_dirsrc, "path to find source files"); SETPREF ("dir.types", "/usr/include", "default colon-separated list of paths to find C headers to cparse types"); SETPREF ("dir.libs", "", "specify path to find libraries to load when bin.libs=true"); diff --git a/libr/core/cmd.c b/libr/core/cmd.c index 383688b8c27fb..f91584984f5f2 100644 --- a/libr/core/cmd.c +++ b/libr/core/cmd.c @@ -6349,10 +6349,9 @@ R_API int r_core_cmd(RCore *core, const char *cstr, bool log) { return ret; } -// R2_600 return bool -R_API int r_core_cmd_lines(RCore *core, const char *lines) { +R_API bool r_core_cmd_lines(RCore *core, const char *lines) { R_RETURN_VAL_IF_FAIL (core && lines, false); - int r, ret = true; + int r; char *data, *odata; if (R_STR_ISEMPTY (lines)) { @@ -6362,6 +6361,7 @@ R_API int r_core_cmd_lines(RCore *core, const char *lines) { if (!odata) { return false; } + bool ret = true; size_t line_count = r_str_char_count (lines, '\n'); const bool istty = r_cons_is_tty (); const bool show_progress_bar = core->print->enable_progressbar \ @@ -6384,13 +6384,13 @@ R_API int r_core_cmd_lines(RCore *core, const char *lines) { r = r_core_cmd (core, data, 0); if (r < 0) { data = nl + 1; - ret = -1; + ret = true; // -1; break; } r_cons_flush (); if (data[0] == 'q') { if (data[1] == '!') { - ret = -1; + ret = true; // -1; } else { R_LOG_WARN ("'q': quit ignored. Use 'q!'"); } @@ -6406,7 +6406,7 @@ R_API int r_core_cmd_lines(RCore *core, const char *lines) { r_cons_newline (); } } - if (ret >= 0 && R_STR_ISNOTEMPTY (data)) { + if (ret && R_STR_ISNOTEMPTY (data)) { r_core_cmd (core, data, 0); r_cons_flush (); r_core_task_yield (&core->tasks); @@ -6415,8 +6415,7 @@ R_API int r_core_cmd_lines(RCore *core, const char *lines) { return ret; } -// R2_600 - return bool -R_API int r_core_cmd_file(RCore *core, const char *file) { +R_API bool r_core_cmd_file(RCore *core, const char *file) { R_RETURN_VAL_IF_FAIL (core && file, false); char *data = r_file_abspath (file); if (!data) { @@ -6436,16 +6435,16 @@ R_API int r_core_cmd_file(RCore *core, const char *file) { return true; } -R_API int r_core_cmd_command(RCore *core, const char *command) { +R_API bool r_core_cmd_command(RCore *core, const char *command) { R_RETURN_VAL_IF_FAIL (core && command, -1); char *cmd = r_core_sysenv_begin (core, command); int len; char *buf = r_sys_cmd_str (cmd, 0, &len); if (!buf) { free (cmd); - return -1; + return false; } - int ret = r_core_cmd_lines (core, buf); + bool ret = r_core_cmd_lines (core, buf); r_core_sysenv_end (core, command); free (buf); return ret; diff --git a/libr/core/cmd_info.inc.c b/libr/core/cmd_info.inc.c index 1da6bc47f3954..7b43b18719e56 100644 --- a/libr/core/cmd_info.inc.c +++ b/libr/core/cmd_info.inc.c @@ -2164,8 +2164,10 @@ static int cmd_info(void *data, const char *input) { } input = input + strlen (input) - 1; break; - case 'a': // "iA" - if (input[1] == 'j') { + case 'a': // "ia" + if (r_str_startswith (input, "iaito")) { + R_LOG_ERROR ("Missing plugin. Run: r2pm -ci r2iaito"); + } else if (input[1] == 'j') { pj_o (pj); // weird r_bin_list_archs (core->bin, pj, 'j'); pj_end (pj); diff --git a/libr/core/disasm.c b/libr/core/disasm.c index 18922fe7330f5..4c1b8bb4beee3 100644 --- a/libr/core/disasm.c +++ b/libr/core/disasm.c @@ -2235,22 +2235,18 @@ static void ds_show_functions(RDisasmState *ds) { RAnalVar *var; RListIter *iter; -#if R2_USE_NEW_ABI int skipped = 0; if (f->addr == core->offset) { skipped = core->skiplines; } -#endif RList *all_vars = vars_cache.rvars; r_list_join (all_vars, vars_cache.bvars); r_list_join (all_vars, vars_cache.svars); r_list_foreach (all_vars, iter, var) { -#if R2_USE_NEW_ABI if (skipped > 0) { skipped--; continue; } -#endif ds_begin_line (ds); int idx; RAnal *anal = ds->core->anal; diff --git a/libr/include/r_bin.h b/libr/include/r_bin.h index d6f3e150aeda1..ff5c23a792001 100644 --- a/libr/include/r_bin.h +++ b/libr/include/r_bin.h @@ -463,9 +463,7 @@ struct r_bin_t { char strfilter; // string filtering char *strpurge; // purge false positive strings char *srcdir; // dir.source -#if R2_USE_NEW_ABI char *srcdir_base; // dir.source.base -#endif char *prefix; // bin.prefix char *strenc; ut64 filter_rules; @@ -603,14 +601,9 @@ typedef struct r_bin_class_t { int index; // should be unsigned? ut64 addr; char *ns; // namespace // maybe RBinName? -#if R2_USE_NEW_ABI - // Use RVec here - RList *methods; // - RList *fields; // -#else + // R2_600 - Use RVec here RList *methods; // RList *fields; // -#endif // RList *interfaces; // RBinAttribute attr; ut64 lang; @@ -914,11 +907,7 @@ R_API void r_bin_name_filtered(RBinName *bn, const char *fname); R_API void r_bin_name_free(RBinName *bn); R_API char *r_bin_attr_tostring(ut64 attr, bool singlechar); -#if R2_USE_NEW_ABI R_API ut64 r_bin_attr_fromstring(const char *s, bool compact); -#else -R_API ut64 r_bin_attr_fromstring(const char *s); -#endif /* filter.c */ typedef struct HtSU_t HtSU; diff --git a/libr/include/r_core.h b/libr/include/r_core.h index f79a5decaa5f9..6763378d3ae61 100644 --- a/libr/include/r_core.h +++ b/libr/include/r_core.h @@ -302,9 +302,7 @@ typedef struct { int y; } VisualMark; -#if R2_USE_NEW_ABI typedef struct RCorePriv RCorePriv; -#endif struct r_core_t { RBin *bin; @@ -514,9 +512,9 @@ R_API R_MUSTUSE char *r_core_cmd_strf(RCore *core, const char *fmt, ...) R_PRINT R_API R_MUSTUSE char *r_core_cmd_strf_at(RCore *core, ut64 addr, const char *fmt, ...) R_PRINTF_CHECK(3, 4); R_API R_MUSTUSE char *r_core_cmd_str_pipe(RCore *core, const char *cmd); R_API R_MUSTUSE RBuffer *r_core_cmd_tobuf(RCore *core, const char *cmd); -R_API int r_core_cmd_file(RCore *core, const char *file); -R_API int r_core_cmd_lines(RCore *core, const char *lines); -R_API int r_core_cmd_command(RCore *core, const char *command); +R_API bool r_core_cmd_file(RCore *core, const char *file); +R_API bool r_core_cmd_lines(RCore *core, const char *lines); +R_API bool r_core_cmd_command(RCore *core, const char *command); R_API void r_core_af(RCore *core, ut64 addr, const char *name, bool anal_calls); R_API bool r_core_run_script(RCore *core, const char *file); R_API bool r_core_seek(RCore *core, ut64 addr, bool rb); diff --git a/libr/include/r_core_priv.h b/libr/include/r_core_priv.h index 253a37a1a3b71..39939d0243457 100644 --- a/libr/include/r_core_priv.h +++ b/libr/include/r_core_priv.h @@ -5,7 +5,6 @@ #ifndef R2_CORE_PRIV_H #define R2_CORE_PRIV_H -#if R2_USE_NEW_ABI #ifdef __cplusplus extern "C" { #endif @@ -19,5 +18,3 @@ typedef struct { #endif #endif - -#endif diff --git a/libr/include/r_list.h b/libr/include/r_list.h index e9c154c42c813..17528729bacb0 100644 --- a/libr/include/r_list.h +++ b/libr/include/r_list.h @@ -97,23 +97,8 @@ R_API void r_list_split(RList *list, void *ptr); R_API void r_list_split_iter(RList *list, RListIter *iter); R_API int r_list_join(RList *list1, RList *list2); R_API void *r_list_get_n(const RList *list, int n); -#if R2_USE_NEW_ABI R_API RListIter *r_list_get_nth(const RList *list, int n); -#else -static inline RListIter *r_list_get_nth(const RList *list, int n) { - RListIter *it; - int i; - for (it = list->head, i = 0; it && it->data; it = it->n, i++) { - if (i == n) { - return it; - } - } - return NULL; -} -#endif R_API int r_list_del_n(RList *list, int n); -R_DEPRECATE R_API void *r_list_get_top(const RList *list); -R_DEPRECATE R_API void *r_list_get_bottom(const RList *list); R_API void r_list_iter_to_top(RList *list, RListIter *iter); R_API void *r_list_pop(RList *list); R_API void *r_list_pop_head(RList *list); diff --git a/libr/include/r_socket.h b/libr/include/r_socket.h index ed99596490681..75eea586384a2 100644 --- a/libr/include/r_socket.h +++ b/libr/include/r_socket.h @@ -258,9 +258,7 @@ typedef struct r_run_profile_t { int _timeout; int _timeout_sig; int _nice; -#if R2_USE_NEW_ABI bool _stderrout; -#endif } RRunProfile; R_API RRunProfile *r_run_new(R_NULLABLE const char *str); diff --git a/libr/include/r_util.h b/libr/include/r_util.h index 522cac0807821..ef40ebeedb83c 100644 --- a/libr/include/r_util.h +++ b/libr/include/r_util.h @@ -88,10 +88,8 @@ int gettimeofday (struct timeval* p, void* tz); #include "r_util/r_axml.h" // requires io, core, ... #include "r_util/r_print.h" -#if R2_USE_NEW_ABI R_API int r_lz4_compress(ut8 *obuf, ut8 *buf, size_t buf_size, const int max_chain); R_API ut8 *r_lz4_decompress(const ut8* input, size_t input_size, size_t *output_size); -#endif #ifdef __cplusplus extern "C" { diff --git a/libr/include/r_util/r_base32.h b/libr/include/r_util/r_base32.h index 69672a5cb9fcd..ac37f9b5bf5a1 100644 --- a/libr/include/r_util/r_base32.h +++ b/libr/include/r_util/r_base32.h @@ -5,15 +5,12 @@ extern "C" { #endif -#if R2_USE_NEW_ABI - #include R_API char *r_base32_encode(const ut8 *data, size_t input_length, size_t *output_length); R_API ut8 *r_base32_decode(const char *data, size_t input_length, size_t *output_length); R_API char *base32_encode_ut64(ut64 input); R_API ut64 base32_decode_ut64(const char *input); -#endif #ifdef __cplusplus } diff --git a/libr/socket/run.c b/libr/socket/run.c index 236c61f50849f..534f93b03580d 100644 --- a/libr/socket/run.c +++ b/libr/socket/run.c @@ -645,13 +645,8 @@ R_API bool r_run_parseline(RRunProfile *p, const char *b) { p->_seteuid = strdup (e); } else if (!strcmp (b, "setgid")) { p->_setgid = strdup (e); -#if R2_USE_NEW_ABI } else if (!strcmp (b, "stderrout")) { p->_stderrout = r_str_is_true (e); -#else - } else if (!strcmp (b, "stderrout")) { - R_LOG_ERROR ("stderrout directive is only supported in the new abi"); -#endif } else if (!strcmp (b, "setegid")) { p->_setegid = strdup (e); } else if (!strcmp (b, "nice")) { @@ -1090,7 +1085,6 @@ R_API bool r_run_config_env(RRunProfile *p) { return false; } } -#if R2_USE_NEW_ABI if (p->_stderrout) { #if __wasi__ R_LOG_WARN ("Directive 'stderrout' not supported in wasm"); @@ -1100,7 +1094,6 @@ R_API bool r_run_config_env(RRunProfile *p) { } #endif } -#endif if (p->_setgid) { #if __wasi__ R_LOG_WARN ("Directive 'setgid' not supported in wasm"); diff --git a/libr/util/base32.c b/libr/util/base32.c index 3d1fe763ac194..4f1a58850514c 100644 --- a/libr/util/base32.c +++ b/libr/util/base32.c @@ -1,8 +1,8 @@ /* radare - LGPL - Copyright 2024 - pancake */ +#include #include -#if R2_USE_NEW_ABI static const char base32_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; static const char base32_padding = '='; @@ -119,5 +119,3 @@ R_API ut64 base32_decode_ut64(const char *input) { } return decoded_value; } - -#endif diff --git a/libr/util/list.c b/libr/util/list.c index a4b0a895503b8..834cfad7c51bc 100644 --- a/libr/util/list.c +++ b/libr/util/list.c @@ -343,18 +343,6 @@ R_API int r_list_del_n(RList *list, int n) { return false; } -R_DEPRECATE R_API void *r_list_get_top(const RList *list) { - R_RETURN_VAL_IF_FAIL (list, NULL); - - return list->tail ? list->tail->data : NULL; -} - -R_DEPRECATE R_API void *r_list_get_bottom(const RList *list) { - R_RETURN_VAL_IF_FAIL (list, NULL); - - return list->head ? list->head->data : NULL; -} - // Moves an iter to the top(tail) of the list // There is an underlying assumption here, that iter is an RListIter of this RList R_API void r_list_iter_to_top(RList *list, RListIter *iter) { @@ -463,7 +451,6 @@ R_API int r_list_set_n(RList *list, int n, void *p) { return false; } -#if R2_USE_NEW_ABI R_API RListIter *r_list_get_nth(const RList *list, int n) { R_RETURN_VAL_IF_FAIL (list, NULL); RListIter *it; @@ -475,7 +462,6 @@ R_API RListIter *r_list_get_nth(const RList *list, int n) { } return NULL; } -#endif R_API void *r_list_get_n(const RList *list, int n) { RListIter *it = r_list_get_nth (list, n); diff --git a/libr/util/log.c b/libr/util/log.c index 1cff96d343566..34e003d1fccf5 100644 --- a/libr/util/log.c +++ b/libr/util/log.c @@ -246,11 +246,6 @@ R_API void r_log_add_callback(RLogCallback cb, void *user) { if (!rlog->cbs) { rlog->cbs = r_list_newf (free); } -#if !R2_USE_NEW_ABI - if (user) { - rlog->user = user; - } -#endif RLogCallbackUser *cbu = R_NEW (RLogCallbackUser); cbu->cb = cb; cbu->user = user; diff --git a/libr/util/rlz4.c b/libr/util/rlz4.c index 5f9352fd2d558..d60c79d56283f 100644 --- a/libr/util/rlz4.c +++ b/libr/util/rlz4.c @@ -4,7 +4,6 @@ #include -#if R2_USE_NEW_ABI // R2_600 - replace shlr/smallz4 with this code which also supports compressing #define BLOCK_SIZE (1024*8) /* 8K */ @@ -152,7 +151,7 @@ static int lz4_compress(ut8 *g_buf, const int uc_length, int max_chain) { } static int lz4_decompress(ut8 *g_buf, const int comp_len, int *pp) { - int i, s, len, error, run, p = 0; + int i, s, len, run, p = 0; int ip = BLOCK_SIZE; int ip_end = ip + comp_len; @@ -246,17 +245,13 @@ R_API ut8 *r_lz4_decompress(const ut8* input, size_t input_size, size_t *output_ input += comp_len; } *output_size = r_buf_size (b); - return r_buf_tostring (b); + return (ut8*)r_buf_tostring (b); } R_API int r_lz4_compress(ut8 *obuf, ut8 *buf, size_t buf_size, const int max_chain) { - int i, n; + int i; ut8 *obuf0 = obuf; - - int ipos = 0; - int opos = 0; ut8 g_buf[(BLOCK_SIZE + BLOCK_SIZE + EXCESS) * sizeof (ut8)]; - for (i = 0; i < buf_size; i += BLOCK_SIZE) { int n = R_MIN (BLOCK_SIZE, buf_size - i); memcpy (g_buf, buf + i, n); @@ -294,5 +289,3 @@ int main() { #endif } #endif - -#endif diff --git a/test/unit/test_buf.c b/test/unit/test_buf.c index f2a48bb9a975f..f9d8cd0fdc43a 100644 --- a/test/unit/test_buf.c +++ b/test/unit/test_buf.c @@ -100,7 +100,6 @@ bool test_buf(RBuffer *b) { return MU_PASSED; } -#if R2_USE_NEW_ABI bool test_r_buf_cache(void) { const char bytes[] = "ABCDEFGHIJKLMNOP"; RBuffer *b0 = r_buf_new_with_bytes ((const ut8*)bytes, sizeof (bytes)); @@ -118,7 +117,6 @@ bool test_r_buf_cache(void) { r_buf_free (b1); mu_end; } -#endif bool test_r_buf_file(void) { RBuffer *b; @@ -425,9 +423,7 @@ bool test_r_buf_slice_too_big(void) { } int all_tests(void) { -#if R2_USE_NEW_ABI mu_run_test (test_r_buf_cache); -#endif mu_run_test (test_r_buf_file); mu_run_test (test_r_buf_bytes); mu_run_test (test_r_buf_mmap);