Skip to content

Commit

Permalink
macos install and more build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Dec 4, 2023
1 parent 085b197 commit e2d79f0
Show file tree
Hide file tree
Showing 21 changed files with 49 additions and 46 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
uses: actions/checkout@v3
- name: Configure, build and install
run: |
pwd ; ls -l
./configure --prefix=/usr
make -j
sudo make install
Expand Down Expand Up @@ -56,8 +55,7 @@ jobs:
uses: actions/checkout@v3
- name: Configure, build and install
run: |
pwd ; ls -l
./configure --prefix=/usr
./configure
make -j
sudo make install
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion src/analyze.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define MAX_FUN_SIZE 1023

/* code analyzer */
int (*arch_aop)(ut64 addr, const u8 *bytes, struct aop_t *aop);
// int (*arch_aop)(ut64 addr, const u8 *bytes, struct aop_t *aop);

int section_is_x (ut64 addr)
{
Expand Down
7 changes: 4 additions & 3 deletions src/arch/csr/code.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,10 @@ int arch_csr_aop(ut64 addr, const unsigned char *bytes, struct aop_t *aop)
aop->type = AOP_TYPE_XOR;
break;
case 0xe:
if (in->in_mode == ADDR_MODE_RELATIVE)
if (in->in_mode == ADDR_MODE_RELATIVE) {
rel = 1;
switch(in->in_reg) {
}
switch (in->in_reg) {
case 0: // BRA
aop->type = AOP_TYPE_JMP;
aop->jump = label_off(&d)+4;
Expand Down Expand Up @@ -249,7 +250,7 @@ int arch_csr_aop(ut64 addr, const unsigned char *bytes, struct aop_t *aop)
aop->type = AOP_TYPE_CJMP;
rel = 0;
aop->jump = label_off(&d);
if (aop->jump&1)aop->jump+=3;
if (aop->jump&1) aop->jump+=3;
aop->fail = addr+2;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/arch/ppc/ppc_disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ static void trap(struct DisasmPara_PPC *dp,ppc_word in,unsigned char dmode)
char *cnd;
int to = (int)PPCGETD(in);

if (cnd = trap_condition[to]) {
if ((cnd = trap_condition[to])) {
dp->flags |= dmode;
sprintf(dp->opcode,"t%c%s",dmode?'d':'w',cnd);
ra_rb(dp->operands,in);
Expand Down
2 changes: 1 addition & 1 deletion src/bytepat.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ int do_byte_pat(int patlen)
int pcnt, cnt=0, k=0;
ut64 intaddr;
/* end addr */
ut64 bytes;
ut64 bytes = 0;
/* start addr */
ut64 bact = config.seek;

Expand Down
2 changes: 1 addition & 1 deletion src/cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -2924,7 +2924,7 @@ CMD_DECL(help)
} else {
char buf[1024];
int len;
len = hexstr2binstr(input+1, buf);
len = hexstr2binstr(input+1, (u8*)buf);
if (len>0)
print_data(0, "", (u8*)buf, len, FMT_ASC);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef struct command {
#define COMMAND(sn,opt,help,hook) {sn, (char*)opt, help, cmd_ ## hook}

int commands_parse(const char *cmdline);
void show_help_message();
void show_help_message(void);

CMD_DECL(gotoxy);
CMD_DECL(menu);
Expand Down
2 changes: 1 addition & 1 deletion src/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ int gnu_disparc_str(char *str, const u8 *inst, ut64 offset);
int z80_udis (char *str, ut8 *bytes, int len, ut64 seek);

struct aop_t *pas_aop(int arch, ut64 seek, const u8 *bytes, int len, struct aop_t *aop, char *newstr, int pseudo);
struct reflines_t *code_lines_init();
struct reflines_t *code_lines_init(int );
void code_lines_free(struct list_head *list);
void code_lines_print(struct reflines_t *list, ut64 addr, int expand);
void metadata_comment_add(ut64 offset, const char *str);
Expand Down
4 changes: 2 additions & 2 deletions src/cons.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ char cons_palette[CONS_PALETTE_SIZE][8] = {
/* FF */
};

const char *cons_color_names[CONS_COLORS_SIZE+1] = {
static const char *cons_color_names[CONS_COLORS_SIZE+1] = {
"black",
"gray",
"white",
Expand Down Expand Up @@ -128,7 +128,7 @@ void cons_invert(int set)
else cons_strcat("\x1b[0m");
}

const char *cons_colors[CONS_COLORS_SIZE+1] = {
static const char *cons_colors[CONS_COLORS_SIZE+1] = {
C_BLACK, // 0
C_GRAY, // 1
C_WHITE, // 2
Expand Down
2 changes: 1 addition & 1 deletion src/cons.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ enum {
};

extern const char *cons_palette_default;
const char *cons_colors[CONS_COLORS_SIZE+1];
// const char *cons_colors[CONS_COLORS_SIZE+1];
extern char cons_palette[CONS_PALETTE_SIZE][8];
const char *cons_get_buffer();
extern int cons_floodprot;
Expand Down
3 changes: 0 additions & 3 deletions src/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,6 @@ int data_var_type_add(const char *typename, int size, const char *fmt)
int data_var_type_del(const char *typename)
{
struct list_head *pos;
ut64 ret = 0;

if (*typename==' ')typename=typename+1;

Expand Down Expand Up @@ -861,8 +860,6 @@ int data_var_type_list(const char *mask)
struct var_type_t *data_var_type_get(const char *datatype)
{
struct list_head *pos;
ut64 ret = 0;

list_for_each(pos, &vartypes) {
struct var_type_t *d = (struct var_type_t *)list_entry(pos, struct var_type_t, list);
//eprintf("---(%s)(%s)\n", d->name, datatype);
Expand Down
3 changes: 2 additions & 1 deletion src/javasm/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
include ../../config.mk

OBJ=../rabin/javasm.o main.o
OBJ=main.o
BIN=javasm${BINSFX}
CFLAGS+=-DHAVE_MAIN=1

all: ${BIN}

Expand Down
3 changes: 2 additions & 1 deletion src/javasm/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@

//int radare_output = 0;
extern int radare_output;
int java_assemble(unsigned char *bytes, char *string);
// int java_assemble(unsigned char *bytes, char *string);
#include "../rabin/javasm.c"

void eprintf(const char *format, ...)
{
Expand Down
7 changes: 4 additions & 3 deletions src/rabin/aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ ut64 get_offset(const char *orig)
if (arg[0]=='\'' && arg[0+2]=='\'')
return arg[0+1];

for(;*arg==' ';arg=arg+1);
for(i=0;arg[i]==' ';i++);
for(;arg[i]=='\\';i++); i++;
for(;*arg==' ';arg=arg+1) {}
for(i=0;arg[i]==' ';i++) {}
for(;arg[i]=='\\';i++) {}
i++;

if (arg[i] == 'x' && i>0 && arg[i-1]=='0') {
sscanf(arg, "0x"OFF_FMTx, &ret);
Expand Down
4 changes: 3 additions & 1 deletion src/rabin/javasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ int hexstr2binstr(const char *in, unsigned char *out) // 0A 3B 4E A0

return (int)len;
}

#if HAVE_MAIN
static int show_help()
{
printf("Usage: javasm [-hV] [-a 'opcode'] [-d 'hexpairstring'] [-r][-c 'classfile']\n");
Expand Down Expand Up @@ -831,3 +831,5 @@ int main(int argc, char **argv)
return 0;
}
#endif

#endif
4 changes: 2 additions & 2 deletions src/radiff/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ int radiff_hexdump(const char *a, const char *b)
snprintf(cmd, 1023, "cat '%s' | ired - > b.hex", b);
system(cmd);
snprintf(cmd, 1023, "diff -u a.hex b.hex");
system(cmd);
int rc = system(cmd);
unlink("a.hex");
unlink("b.hex");

return rc;
}

int main(int argc, char **argv)
Expand Down
8 changes: 4 additions & 4 deletions src/radiff/rdbdiff_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

int udis86_color = 1;

void show_help_message(int v)
static void helpmsg(int v)
{
printf("Usage: rdbdiff [-hV] [-i fmt] [-o fmt] [file_0] [file_1]\n");
if (v) {
Expand Down Expand Up @@ -89,7 +89,7 @@ int main(int argc, char **argv)
{
switch( c ) {
case 'h':
show_help_message(1);
helpmsg(1);
case 'V':
show_version();
break;
Expand All @@ -98,12 +98,12 @@ int main(int argc, char **argv)
case 'o':
break;
default:
show_help_message(0);
helpmsg(0);
}
}

if ((argc-optind) != 2)
show_help_message(0);
helpmsg(0);

return main_rdb_diff(argv[optind], argv[optind+1]);
}
18 changes: 9 additions & 9 deletions src/rahash/sha2.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
}

/* Clean up state data: */
MEMSET_BZERO(context, sizeof(context));
MEMSET_BZERO(&context, sizeof(context));
usedspace = 0;
}

Expand All @@ -646,7 +646,7 @@ char *SHA256_End(SHA256_CTX* context, char buffer[]) {
}
*buffer = (char)0;
} else {
MEMSET_BZERO(context, sizeof(context));
MEMSET_BZERO(&context, sizeof(context));
}
MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH);
return buffer;
Expand All @@ -667,7 +667,7 @@ void SHA512_Init(SHA512_CTX* context) {
return;
}
MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH);
MEMSET_BZERO(&context->buffer, SHA512_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0;
}

Expand Down Expand Up @@ -955,7 +955,7 @@ void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
}

/* Zero out state data */
MEMSET_BZERO(context, sizeof(context));
MEMSET_BZERO(&context, sizeof(context));
}

char *SHA512_End(SHA512_CTX* context, char buffer[]) {
Expand All @@ -975,7 +975,7 @@ char *SHA512_End(SHA512_CTX* context, char buffer[]) {
}
*buffer = (char)0;
} else {
MEMSET_BZERO(context, sizeof(context));
MEMSET_BZERO(&context, sizeof(context));
}
MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
return buffer;
Expand All @@ -996,7 +996,7 @@ void SHA384_Init(SHA384_CTX* context) {
return;
}
MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH);
MEMSET_BZERO(context->buffer, SHA384_BLOCK_LENGTH);
MEMSET_BZERO(&context->buffer, SHA384_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0;
}

Expand Down Expand Up @@ -1030,7 +1030,7 @@ void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
}

/* Zero out state data */
MEMSET_BZERO(context, sizeof(context));
MEMSET_BZERO(&context, sizeof(context));
}

char *SHA384_End(SHA384_CTX* context, char buffer[]) {
Expand All @@ -1050,9 +1050,9 @@ char *SHA384_End(SHA384_CTX* context, char buffer[]) {
}
*buffer = (char)0;
} else {
MEMSET_BZERO(context, sizeof(context));
MEMSET_BZERO(&context, sizeof(context));
}
MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
MEMSET_BZERO(&digest, SHA384_DIGEST_LENGTH);
return buffer;
}

Expand Down
2 changes: 1 addition & 1 deletion src/rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ int program_serialize(struct program_t *program, char *file)
int program_free(struct program_t *prg)
{
//printf("program_free: MEMORY LEAK!\n");
#warning program_free: must be implemented
// #warning program_free: not implemented
return 0;
}

Expand Down
13 changes: 7 additions & 6 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,10 @@ ut64 get_offset(const char *orig)
if (arg[0]=='\'' && arg[0+2]=='\'')
return arg[0+1];

for(;*arg==' ';arg=arg+1);
for(i=0;arg[i]==' ';i++);
for(;arg[i]=='\\';i++); i++;
for (;*arg==' ';arg=arg+1) {}
for (i=0;arg[i]==' ';i++) {}
for (;arg[i]=='\\';i++) {}
i++;

#if RADARE_CORE
#if 0
Expand Down Expand Up @@ -584,14 +585,14 @@ ut64 get_math(const char* text)
/* remove whitespaces and dupped '=' */
for(tmp = txt = strdup(text); txt && txt[0] && txt[1]; txt = txt+1) {
#if 1
if ((txt[0]=='!' && txt[1]=='='))
if (txt[0] == '!' && txt[1]=='=')
str_cpy(txt+1, txt+2);
else
#endif
if ((txt[0]=='=' && txt[1]=='='))
if (txt[0] == '=' && txt[1]=='=')
txt[0]=' ';
else
if ((txt[0]==' '))
if (txt[0] == ' ')
str_cpy(txt, txt+1);
}
txt = tmp;
Expand Down
1 change: 1 addition & 0 deletions src/xrefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ match value ffffffad (ffffad) at offset 0x454
/* setup 64 bit environment! */
#include "radare.h"

#undef __UNIX__
#if __FreeBSD__ || __linux__ || __NetBSD__ || __OpenBSD__
#define __UNIX__ 1
#else
Expand Down

0 comments on commit e2d79f0

Please sign in to comment.