Fix TinyCC build ##build
This commit is contained in:
parent
ae0b5e503f
commit
aa7de006e6
|
@ -0,0 +1,48 @@
|
|||
name: Radare2 CI - build with TinyCC compiler
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# “At 00:00 on every Tuesday, Thursday, and Saturday”
|
||||
- cron: '0 13 * * 2,4,6'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ubuntu-tcc-test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout TinyCC repository
|
||||
run: |
|
||||
git clone https://repo.or.cz/tinycc.git
|
||||
cd tinycc
|
||||
git checkout mob
|
||||
|
||||
- name: Compiling and installing TinyCC
|
||||
working-directory: tinycc
|
||||
run: |
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
sudo make install
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
- name: Checkout our Testsuite Binaries
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: radareorg/radare2-testbins
|
||||
path: test/bins
|
||||
|
||||
- name: Configure, build and install
|
||||
env:
|
||||
CC: tcc
|
||||
run: |
|
||||
./configure --prefix=/usr --with-compiler=tcc
|
||||
make
|
||||
sudo make install
|
||||
|
||||
- name: Install test dependencies
|
||||
run: python3 -m pip install --user 'git+https://github.com/radareorg/radare2-r2pipe#egg=r2pipe&subdirectory=python'
|
||||
|
||||
- name: Run tests
|
||||
run: cd test && make
|
||||
working-directory: radare2
|
||||
env:
|
||||
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig
|
|
@ -2,7 +2,7 @@ include ../config.mk
|
|||
include ../../global.mk
|
||||
|
||||
NAME=r_bin
|
||||
R2DEPS=r_util r_io r_socket r_magic r_hash r_syscall
|
||||
R2DEPS=r_util r_io r_socket r_magic r_hash r_syscall r_cons
|
||||
|
||||
.PHONY: pre
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ static int countOnes(ut32 val) {
|
|||
return 0;
|
||||
}
|
||||
/* visual studio doesnt supports __buitin_clz */
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__TINYC__)
|
||||
int count = 0;
|
||||
val = val - ((val >> 1) & 0x55555555);
|
||||
val = (val & 0x33333333) + ((val >> 2) & 0x33333333);
|
||||
|
|
|
@ -125,7 +125,7 @@ void aes_expkey (const struct aes_state *st, ut32 expkey[2][Nr_AES256 + 1][Nb])
|
|||
// in - The plaintext
|
||||
// result - The ciphertext generated from a plaintext using the key
|
||||
void aes_encrypt (struct aes_state *st, ut8 *in, ut8 *result) {
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__TINYC__)
|
||||
ut32 expkey[2][Nr_AES256 + 1][Nb];
|
||||
#else
|
||||
ut32 expkey[2][st->rounds + 1][Nb];
|
||||
|
@ -207,12 +207,12 @@ void aes_encrypt (struct aes_state *st, ut8 *in, ut8 *result) {
|
|||
// in - The ciphertext.
|
||||
// result - The plaintext generated from a ciphertext using the session key.
|
||||
void aes_decrypt (struct aes_state *st, ut8 *in, ut8 *result) {
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__TINYC__)
|
||||
ut32 expkey[2][Nr_AES256 + 1][Nb];
|
||||
#else
|
||||
ut32 expkey[2][st->rounds + 1][Nb];
|
||||
#endif
|
||||
|
||||
|
||||
aes_expkey(st, expkey);
|
||||
|
||||
ut32 t0, t1, t2, t3, tt;
|
||||
|
|
|
@ -1335,7 +1335,7 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if __i386__ || __x86_64
|
||||
#if __i386__ || __x86_64__
|
||||
static int get_xsave_size(RDebug *dbg, int pid) {
|
||||
#ifdef PTRACE_GETREGSET
|
||||
struct iovec local;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include ../config.mk
|
||||
|
||||
NAME=r_egg
|
||||
R2DEPS=r_asm r_syscall r_util r_parse r_reg
|
||||
R2DEPS=r_asm r_syscall r_util r_parse r_reg r_lang
|
||||
R2DEPS+=r_flag r_cons
|
||||
|
||||
OBJS=egg.o egg_lang.o
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
NAME=r_fs
|
||||
R2DEPS=r_util r_io
|
||||
R2DEPS=r_util r_io r_socket
|
||||
CFLAGS+=-DR2_PLUGIN_INCORE -Iarch/include -Iarch
|
||||
|
||||
SHLR=../../shlr/
|
||||
|
@ -22,7 +22,7 @@ OBJS=${STATIC_OBJS} fs.o fs_file.o shell.o
|
|||
#p/grub/libgrubfs.a:
|
||||
# cd p/grub && ${MAKE} libgrubfs.a CC="${CC}"
|
||||
|
||||
pre:
|
||||
pre:
|
||||
cd d && ${MAKE}
|
||||
# @if [ ! -e libr_fs.${EXT_SO} ]; then if [ ! -e libr_fs.${EXT_AR} ]; then rm -f ${STATIC_OBJS} ; fi ; fi
|
||||
|
||||
|
|
|
@ -169,6 +169,17 @@ typedef struct _utX {
|
|||
#define NAN (0.0f/0.0f)
|
||||
#endif
|
||||
|
||||
/* A workaround against libc headers redefinition of __attribute__:
|
||||
* Standard include has lines like
|
||||
* #if (GCC_VERSION < 2007)
|
||||
* # define __attribute__(x)
|
||||
* #endif
|
||||
* So we have do remove this define for TinyCC compiler
|
||||
*/
|
||||
#if defined(__TINYC__) && (GCC_VERSION < 2007)
|
||||
#undef __attribute__
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define R_PACKED( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )
|
||||
#undef INFINITY
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CC=tcc
|
||||
CC=tcc -D__LITTLE_ENDIAN__=1
|
||||
RANLIB?=ranlib
|
||||
ONELIB=0
|
||||
AR?=ar
|
||||
|
@ -16,13 +16,14 @@ LD?=ld
|
|||
ifeq ($(OSTYPE),darwin)
|
||||
PARTIALLD=${LD} -r -all_load
|
||||
LDFLAGS_LIB=-dynamiclib
|
||||
LDFLAGS_SONAME=-Wl,-install_name,
|
||||
LDFLAGS_SONAME=-soname
|
||||
# LDFLAGS_SONAME=-Wl,-install_name,
|
||||
else
|
||||
PARTIALLD=${LD} -r --whole-archive
|
||||
LDFLAGS_LIB=-shared
|
||||
LDFLAGS_LIB+=-Dxx
|
||||
#Wl,-soname,lib${NAME}.${EXT_SO}.${VERSION}
|
||||
LDFLAGS_SONAME=-Dxx
|
||||
LDFLAGS_SONAME=-soname
|
||||
#Wl,-soname=
|
||||
endif
|
||||
|
||||
|
|
|
@ -742,7 +742,7 @@ the_end:
|
|||
LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename, const char *directory)
|
||||
{
|
||||
if (directory) {
|
||||
dirname = strdup (directory);
|
||||
dir_name = strdup (directory);
|
||||
}
|
||||
|
||||
if (s->output_type == TCC_OUTPUT_PREPROCESS) {
|
||||
|
|
|
@ -1002,7 +1002,7 @@ ST_DATA CType func_vt; /* current function return type (used by return instructi
|
|||
ST_DATA int func_vc;
|
||||
ST_DATA int last_line_num, last_ind, func_ind; /* debug last line number and pc */
|
||||
ST_DATA char *funcname;
|
||||
ST_DATA char *dirname;
|
||||
ST_DATA char *dir_name;
|
||||
|
||||
ST_INLN bool is_structured(CType *t);
|
||||
ST_INLN bool is_struct(CType *t);
|
||||
|
|
|
@ -66,7 +66,7 @@ ST_DATA CType func_vt; /* current function return type (used by return instructi
|
|||
ST_DATA int func_vc;
|
||||
ST_DATA int last_line_num, last_ind, func_ind; /* debug last line number and pc */
|
||||
ST_DATA char *funcname;
|
||||
ST_DATA char *dirname;
|
||||
ST_DATA char *dir_name;
|
||||
|
||||
ST_DATA CType char_pointer_type, func_old_type;
|
||||
ST_DATA CType int8_type, int16_type, int32_type, int64_type, size_type;
|
||||
|
|
|
@ -1600,10 +1600,10 @@ include_trynext:
|
|||
memcpy (filepath, file->filename, filepath_len);
|
||||
strcpy (filepath + filepath_len, buf);
|
||||
if (tcc_open (s1, filepath) < 0) {
|
||||
if (!dirname) {
|
||||
dirname = "/usr/include";
|
||||
if (!dir_name) {
|
||||
dir_name = "/usr/include";
|
||||
}
|
||||
int len = snprintf (filepath, sizeof (filepath), "%s/%s", dirname, buf);
|
||||
int len = snprintf (filepath, sizeof (filepath), "%s/%s", dir_name, buf);
|
||||
if (len >= sizeof (filepath) || tcc_open (s1, filepath) < 0) {
|
||||
tcc_error ("include file '%s' not found", filepath);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue