Add bin.s390 to meson build and fix linkage with RMagic

* Exposes from_ebcdic() api, but must be moved to RUtil maybe
This commit is contained in:
pancake 2022-05-09 03:31:48 +02:00 committed by pancake
parent ca12052f3c
commit 5a9e0a19ba
5 changed files with 9 additions and 6 deletions

View File

@ -15,6 +15,7 @@ r_bin_sources = [
join_paths('p','bin_art.c'),
join_paths('p','bin_xalz.c'),
join_paths('p','bin_avr.c'),
join_paths('p','bin_s390.c'),
join_paths('p','bin_bf.c'),
join_paths('p','bin_bflt.c'),
join_paths('p','bin_bios.c'),

View File

@ -1,7 +1,7 @@
/* radare - LGPL3 - 2021-2022 - Jose_Ant_Romero */
#include <r_bin.h>
#include <magic/ascmagic.c>
#include <r_magic.h>
#define S390_BADDR 0xa5000
// #define S390_BADDR 0
@ -226,7 +226,7 @@ static RList *sections(RBinFile *bf) {
return NULL;
}
ut8 cad[8];
from_ebcdic (hdr20d.Symbol, sizeof (hdr20d.Symbol), cad);
r_magic_from_ebcdic (hdr20d.Symbol, sizeof (hdr20d.Symbol), cad);
ut32 a;
ut32 b;
a = (hdr20d.Address[0] * 65536) + (hdr20d.Address[1] * 256) + (hdr20d.Address[2]);

View File

@ -9,7 +9,7 @@
extern "C" {
#endif
R_LIB_VERSION_HEADER(r_magic);
R_LIB_VERSION_HEADER (r_magic);
#ifdef R_API
@ -282,6 +282,7 @@ R_API const char *r_magic_buffer(RMagic*, const void *, size_t);
R_API const char *r_magic_error(RMagic*);
R_API void r_magic_setflags(RMagic*, int);
R_API void r_magic_from_ebcdic(const ut8 *, size_t, ut8 *);
R_API bool r_magic_load(RMagic*, const char *);
R_API bool r_magic_load_buffer(RMagic*, const ut8 *, size_t);

View File

@ -59,7 +59,7 @@ int file_looks_utf8(const ut8 *, size_t, unichar *, size_t *);
static int looks_ucs16(const ut8 *, size_t, unichar *, size_t *);
static int looks_latin1(const ut8 *, size_t, unichar *, size_t *);
static int looks_extended(const ut8 *, size_t, unichar *, size_t *);
static void from_ebcdic(const ut8 *, size_t, ut8 *);
R_API void r_magic_from_ebcdic(const ut8 *, size_t, ut8 *);
static int ascmatch(const ut8 *, const unichar *, size_t);
static ut8 *encode_utf8(ut8 *, size_t, unichar *, size_t);
@ -146,7 +146,7 @@ return 0;
type = "text";
code_mime = "unknown";
} else {
from_ebcdic(buf, nbytes, nbuf);
r_magic_from_ebcdic(buf, nbytes, nbuf);
if (looks_ascii(nbuf, nbytes, ubuf, &ulen)) {
code = "EBCDIC";
@ -808,7 +808,7 @@ static ut8 ebcdic_1047_to_8859[] = {
/*
* Copy buf[0 ... nbytes-1] into out[], translating EBCDIC to ASCII.
*/
static void from_ebcdic(const ut8 *buf, size_t nbytes, ut8 *out) {
R_API void r_magic_from_ebcdic(const ut8 *buf, size_t nbytes, ut8 *out) {
size_t i;
for (i = 0; i < nbytes; i++) {
out[i] = ebcdic_to_ascii[buf[i]];

View File

@ -259,6 +259,7 @@ bin_plugins += [
'art',
'avr',
'bf',
's390',
'bflt',
'bios',
'bootimg',