* Added 'mad' compiler support to crosscompile to maemo6 with QtCreator

- ./configure --with-compiler=mad --with-ostype=gnulinux
* Fix various warnings reported by maemo toolchain
This commit is contained in:
pancake 2011-06-14 01:44:28 +02:00
parent 6201634a2f
commit adcefe78fe
15 changed files with 51 additions and 27 deletions

View File

@ -21,6 +21,12 @@ WINDOWS
$ ./configure --with-compiler=i486-mingw32-gcc --with-ostype=windows
$ make
MAEMO
=====
$ ./configure --with-compiler=mad --with-ostype=gnulinux
$ make
$ make deb # TODO
CONFIGURATION
=============

View File

@ -6,8 +6,8 @@ OBJS=shellcodes.o test.o
preall: shellcodes.c
${MAKE} all
xorhex: xorhex.o
${CC} xorhex.o -o xorhex
xorhex:
gcc xorhex.c -o xorhex
shellcodes.c: xorhex
./xorhex < shellcodes.c.src > shellcodes.c

View File

@ -2,6 +2,7 @@ RELEASE=1
DESTDIR=
COMPILER?=gcc
#COMPILER=maemo
#COMPILER=mingw32-gcc
#tcc

View File

@ -562,7 +562,7 @@ static void own(struct state *s)
}
#endif
static int arch_csr_disasm(char *str, unsigned char *buf, ut64 seek) {
static int arch_csr_disasm(char *str, const unsigned char *buf, ut64 seek) {
struct state *s = get_state();
struct directive *d;
memset(s, 0, sizeof(*s));

View File

@ -42,7 +42,7 @@ struct state {
char *s_fname;
int s_u;
unsigned int s_labelno;
unsigned char * s_buf;
const unsigned char * s_buf;
struct directive s_dirs;
struct label s_labels;
FILE *s_out;
@ -52,7 +52,7 @@ struct state {
int s_ff_quirk;
};
static int arch_csr_disasm(char *str, unsigned char *b, ut64 seek);
static int arch_csr_disasm(char *str, const unsigned char *b, ut64 seek);
#define MODE_MASK 3
#define REG_SHIFT 2

View File

@ -18,19 +18,16 @@ DisasMSIL is a free/open disasm engine for the Microsoft Intermediate Language (
#define ut32 unsigned int
#endif
static ut32 hi_dword(ut64 Q)
{
static ut32 hi_dword(ut64 Q) {
ut64 qwBuf = Q >> 32;
return (ut32) qwBuf;
}
static ut32 lo_dword(ut64 Q)
{
static ut32 lo_dword(ut64 Q) {
return (ut32) Q;
}
int GetSingleMSILInstr(const u8 *pMemory, ut32 MemorySize, DISASMSIL_OFFSET CodeBase, ILOPCODE_STRUCT *ilop)
{
int GetSingleMSILInstr(const u8 *pMemory, ut32 MemorySize, DISASMSIL_OFFSET CodeBase, ILOPCODE_STRUCT *ilop) {
u8 *pCurInstr = (u8 *) pMemory;
DISASMSIL_OFFSET Base = CodeBase;
ut32 CurInstr;
@ -1075,8 +1072,7 @@ getinstr:
return 1;
}
int DisasMSIL(const u8 *pMemory, ut32 MemorySize, DISASMSIL_OFFSET CodeBase, ILOPCODE_STRUCT *iloparray, ut32 nOpcodeStructs, ut32 *nDisassembledInstr)
{
int DisasMSIL(const u8 *pMemory, ut32 MemorySize, DISASMSIL_OFFSET CodeBase, ILOPCODE_STRUCT *iloparray, ut32 nOpcodeStructs, ut32 *nDisassembledInstr) {
const u8 *pCurMem = pMemory;
ut32 x, RemSize = MemorySize;
DISASMSIL_OFFSET CurBase = CodeBase;
@ -1101,4 +1097,3 @@ int DisasMSIL(const u8 *pMemory, ut32 MemorySize, DISASMSIL_OFFSET CodeBase, ILO
return 1;
}

View File

@ -100,8 +100,8 @@ static int nresult; // Current length of disassembly
static int addcomment; // Comment value of operand
// Copy of input parameters of function Disasm()
static unsigned char *cmd; // Pointer to binary data
static unsigned char *pfixup; // Pointer to possible fixups or NULL
static const unsigned char *cmd; // Pointer to binary data
static const unsigned char *pfixup; // Pointer to possible fixups or NULL
static ulong size; // Remaining size of the command buffer
static t_disasm *da; // Pointer to disassembly results
static int mode; // Disassembly mode (DISASM_xxx)
@ -794,7 +794,7 @@ int Checkcondition(int code,ulong flags) {
else return (cond==0); // Invert condition
};
ulong Disasm(unsigned char *src,ulong srcsize,ulong srcip,
ulong Disasm(const unsigned char *src,ulong srcsize,ulong srcip,
t_disasm *disasm,int disasmmode) {
int i,j,isprefix,is3dnow,repeated,operand,mnemosize,arg;
ulong u,code;

View File

@ -357,7 +357,7 @@ int Assemble(char *cmd,ulong ip,t_asmmodel *model,int attempt,
int constsize,char *errtext);
int Checkcondition(int code,ulong flags);
int Decodeaddress(ulong addr,char *symb,int nsymb,char *comment);
ulong Disasm(unsigned char *src,ulong srcsize,ulong srcip,
ulong Disasm(const unsigned char *src,ulong srcsize,ulong srcip,
t_disasm *disasm,int disasmmode);
ulong Disassembleback(unsigned char *block,ulong base,ulong size,ulong ip,int n);
ulong Disassembleforward(unsigned char *block,ulong base,ulong size,ulong ip,int n);

View File

@ -42,7 +42,7 @@ extern void ud_set_pc(struct ud*, uint64_t);
extern void ud_set_input_hook(struct ud*, int (*)(struct ud*));
extern void ud_set_input_buffer(struct ud*, uint8_t*, size_t);
extern void ud_set_input_buffer(struct ud*, const uint8_t*, size_t);
#ifndef __UD_STANDALONE__
extern void ud_set_input_file(struct ud*, FILE*);

View File

@ -79,7 +79,7 @@ ud_get_user_opaque_data( struct ud * u )
* =============================================================================
*/
extern void
ud_set_input_buffer(register struct ud* u, uint8_t* buf, size_t len)
ud_set_input_buffer(register struct ud* u, const uint8_t* buf, size_t len)
{
u->inp_hook = inp_buff_hook;
u->inp_buff = buf;

View File

@ -177,8 +177,8 @@ struct ud
FILE* inp_file;
#endif
uint8_t inp_ctr;
uint8_t* inp_buff;
uint8_t* inp_buff_end;
const uint8_t* inp_buff;
const uint8_t* inp_buff_end;
uint8_t inp_end;
void (*translator)(struct ud*);
uint64_t insn_offset;

View File

@ -8,7 +8,7 @@
#include <r_asm.h>
#include "msil/demsil.c"
static int arch_msil_disasm(char *str, unsigned char *buf, ut64 seek) {
static int arch_msil_disasm(char *str, const ut8 *buf, ut64 seek) {
ut32 n;
DISASMSIL_OFFSET CodeBase = seek;

View File

@ -51,9 +51,9 @@ KERNOBJS=$(subst .c,.o,${KERNFILES})
CFLAGS=-Iinclude -g -fPIC
CFLAGS+=-I../../../include -DGRUB_TARGET_NO_MODULES
ifeq ($(OSTYPE),Darwin)
CFLAGS+=-DAPPLE_CC
endif
#ifeq ($(OSTYPE),Darwin)
#CFLAGS+=-DAPPLE_CC
#endif
BIN=test${EXT_EXE}

View File

@ -5,7 +5,7 @@ deps="$@"
[ -z "$deps" ] && exit 0
getext() {
u=$(cat ../../config-user.mk| grep HOST_OS |cut -d = -f 2)
u=$(cat ../../config-user.mk| grep OSTYPE |cut -d = -f 2)
case $u in
windows)
echo dll

22
mk/mad.mk Normal file
View File

@ -0,0 +1,22 @@
CC=mad gcc
LINK=
RANLIB=mad ranlib
ONELIB=0
CC_AR=mad ar qf ${LIBAR}
PIC_CFLAGS=-fPIC
CFLAGS+=-MD
CFLAGS_INCLUDE=-I
LDFLAGS_LINK=-l
LDFLAGS_LINKPATH=-L
CFLAGS_OPT0=-O0
CFLAGS_OPT1=-O1
CFLAGS_OPT2=-O2
CFLAGS_OPT3=-O3
CFLAGS_DEBUG=-g
OSTYPE=gnulinux
LDFLAGS_LIB=-shared
LDFLAGS_LIB+=-Wl,-soname,lib${NAME}.${EXT_SO}.${VERSION}
LDFLAGS_SONAME=-Wl,-soname=
CC_LIB=${CC} ${LDFLAGS_LIB} -o ${LIBSO}