tccgen: nodata_wanted fix, default ONE_SOURCE, etc...

tccgen.c:
  doubles need to be aligned, on ARM.  The section_reserve()
  in init_putv does not do that.
-D ONE_SOURCE: is now the default and not longer needed. Also,
  tcc.h now sets the default native target.  These both make
  compiling tcc simple as "gcc tcc.c -o tcc -ldl" again.
arm-asm.c:
  enable pseudo asm also for inline asm
tests/tests2/Makefile:
  disable bitfield tests except on windows and x86_64
  and don't generate-always
tcc.c:
  fix a loop with -dt on errors
configure:
  print compiler version (as recognized)
tccpp.c:
  actually define symbols for tcc -dt
  clear static variables (needed for -dt or libtcc usage)
96_nodata_wanted.c:
  use __label__ instead of asm
lib/files:
  use native symbols (__i386__ etc.) instead of TCC_TARGET_...
master
grischka 2017-07-23 21:24:11 +02:00
parent fdc18d307a
commit 4b3c6e74ab
25 changed files with 351 additions and 164 deletions

View File

@ -173,11 +173,12 @@ ifeq ($(ONE_SOURCE),yes)
LIBTCC_OBJ = $(X)libtcc.o LIBTCC_OBJ = $(X)libtcc.o
LIBTCC_INC = $($T_FILES) LIBTCC_INC = $($T_FILES)
TCC_FILES = $(X)tcc.o TCC_FILES = $(X)tcc.o
$(X)libtcc.o $T-tcc$(EXESUF) : DEFINES += -DONE_SOURCE tcc.o : DEFINES += -DONE_SOURCE=0
else else
LIBTCC_OBJ = $(patsubst %.c,$(X)%.o,$(LIBTCC_SRC)) LIBTCC_OBJ = $(patsubst %.c,$(X)%.o,$(LIBTCC_SRC))
LIBTCC_INC = $(filter %.h %-gen.c %-link.c,$($T_FILES)) LIBTCC_INC = $(filter %.h %-gen.c %-link.c,$($T_FILES))
TCC_FILES = $(X)tcc.o $(LIBTCC_OBJ) TCC_FILES = $(X)tcc.o $(LIBTCC_OBJ)
$(TCC_FILES) : DEFINES += -DONE_SOURCE=0
endif endif
# target specific object rule # target specific object rule
@ -200,7 +201,7 @@ $(CROSS_TARGET)-tcc$(EXESUF): $(TCC_FILES)
# profiling version # profiling version
tcc_p$(EXESUF): $($T_FILES) tcc_p$(EXESUF): $($T_FILES)
$(CC) -o $@ $< $(DEFINES) -DONE_SOURCE $(CFLAGS_P) $(LIBS_P) $(LDFLAGS_P) $(CC) -o $@ $< $(DEFINES) $(CFLAGS_P) $(LIBS_P) $(LDFLAGS_P)
# static libtcc library # static libtcc library
libtcc.a: $(LIBTCC_OBJ) libtcc.a: $(LIBTCC_OBJ)

View File

@ -70,7 +70,6 @@ ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands,
uint8_t *clobber_regs, uint8_t *clobber_regs,
int out_reg) int out_reg)
{ {
asm_error();
} }
ST_FUNC void asm_compute_constraints(ASMOperand *operands, ST_FUNC void asm_compute_constraints(ASMOperand *operands,
@ -78,7 +77,6 @@ ST_FUNC void asm_compute_constraints(ASMOperand *operands,
const uint8_t *clobber_regs, const uint8_t *clobber_regs,
int *pout_reg) int *pout_reg)
{ {
asm_error();
} }
ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str) ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str)

2
configure vendored
View File

@ -410,7 +410,7 @@ echo "Info directory $infodir"
echo "Doc directory $docdir" echo "Doc directory $docdir"
fcho "Target root prefix " "$sysroot" fcho "Target root prefix " "$sysroot"
echo "Source path $source_path" echo "Source path $source_path"
echo "C compiler $cc" echo "C compiler $cc ($gcc_major.$gcc_minor)"
echo "Target OS $targetos" echo "Target OS $targetos"
echo "CPU $cpu" echo "CPU $cpu"
fcho "Triplet " "$triplet" fcho "Triplet " "$triplet"

View File

@ -29,7 +29,7 @@ endif
# only for native compiler # only for native compiler
$(X)BCHECK_O = bcheck.o $(X)BCHECK_O = bcheck.o
ifeq ($(CONFIG_musl),yes) ifeq ($(CONFIG_musl)$(CONFIG_uClibc),yes)
BCHECK_O = BCHECK_O =
endif endif
@ -61,10 +61,10 @@ $(BIN) : $(patsubst %.o,$(X)%.o,$(OBJ-$T))
$(XAR) rcs $@ $^ $(XAR) rcs $@ $^
$(X)%.o : %.c $(X)%.o : %.c
$(XCC) -c $< -o $@ $(DEFINES) $(XFLAGS) $(XCC) -c $< -o $@ $(XFLAGS)
$(X)%.o : %.S $(X)%.o : %.S
$(XCC) -c $< -o $@ $(DEFINES) $(XFLAGS) $(XCC) -c $< -o $@ $(XFLAGS)
$(X)crt1w.o : crt1.c $(X)crt1w.o : crt1.c
$(X)wincrt1w.o : wincrt1.c $(X)wincrt1w.o : wincrt1.c

View File

@ -11,7 +11,7 @@ __bound_alloca:
and $-4,%eax and $-4,%eax
jz p6 jz p6
#ifdef TCC_TARGET_PE #ifdef _WIN32
p4: p4:
cmp $4096,%eax cmp $4096,%eax
jbe p5 jbe p5

View File

@ -10,7 +10,7 @@ alloca:
and $-4,%eax and $-4,%eax
jz p3 jz p3
#ifdef TCC_TARGET_PE #ifdef _WIN32
p1: p1:
cmp $4096,%eax cmp $4096,%eax
jbe p2 jbe p2

View File

@ -4,7 +4,7 @@
.globl __bound_alloca .globl __bound_alloca
__bound_alloca: __bound_alloca:
#ifdef TCC_TARGET_PE #ifdef _WIN32
# bound checking is not implemented # bound checking is not implemented
pop %rdx pop %rdx
mov %rcx,%rax mov %rcx,%rax

View File

@ -5,7 +5,7 @@
alloca: alloca:
pop %rdx pop %rdx
#ifdef TCC_TARGET_PE #ifdef _WIN32
mov %rcx,%rax mov %rcx,%rax
#else #else
mov %rdi,%rax mov %rdi,%rax
@ -14,7 +14,7 @@ alloca:
and $-16,%rax and $-16,%rax
jz p3 jz p3
#ifdef TCC_TARGET_PE #ifdef _WIN32
p1: p1:
cmp $4096,%rax cmp $4096,%rax
jbe p2 jbe p2

View File

@ -21,10 +21,15 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) \
&& !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) #if !defined(__FreeBSD__) \
&& !defined(__FreeBSD_kernel__) \
&& !defined(__DragonFly__) \
&& !defined(__OpenBSD__) \
&& !defined(__NetBSD__)
#include <malloc.h> #include <malloc.h>
#endif #endif
#if !defined(_WIN32) #if !defined(_WIN32)
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -45,10 +50,13 @@
#define CONFIG_TCC_MALLOC_HOOKS #define CONFIG_TCC_MALLOC_HOOKS
#define HAVE_MEMALIGN #define HAVE_MEMALIGN
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \ #if defined(__FreeBSD__) \
|| defined(__DragonFly__) || defined(__dietlibc__) \ || defined(__FreeBSD_kernel__) \
|| defined(__UCLIBC__) || defined(__OpenBSD__) || defined(__NetBSD__) \ || defined(__DragonFly__) \
|| defined(_WIN32) || defined(TCC_UCLIBC) || defined(TCC_MUSL) || defined(__OpenBSD__) \
|| defined(__NetBSD__) \
|| defined(__dietlibc__) \
|| defined(_WIN32)
//#warning Bound checking does not support malloc (etc.) in this environment. //#warning Bound checking does not support malloc (etc.) in this environment.
#undef CONFIG_TCC_MALLOC_HOOKS #undef CONFIG_TCC_MALLOC_HOOKS
#undef HAVE_MEMALIGN #undef HAVE_MEMALIGN

View File

@ -107,10 +107,10 @@ union float_long {
}; };
/* XXX: we don't support several builtin supports for now */ /* XXX: we don't support several builtin supports for now */
#if !defined(TCC_TARGET_X86_64) && !defined(TCC_TARGET_ARM) #if !defined __x86_64__ && !defined __arm__
/* XXX: use gcc/tcc intrinsic ? */ /* XXX: use gcc/tcc intrinsic ? */
#if defined(TCC_TARGET_I386) #if defined __i386__
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
__asm__ ("subl %5,%1\n\tsbbl %3,%0" \ __asm__ ("subl %5,%1\n\tsbbl %3,%0" \
: "=r" ((USItype) (sh)), \ : "=r" ((USItype) (sh)), \
@ -589,7 +589,7 @@ long long __fixdfdi (double a1)
return s ? ret : -ret; return s ? ret : -ret;
} }
#ifndef TCC_TARGET_ARM #ifndef __arm__
unsigned long long __fixunsxfdi (long double a1) unsigned long long __fixunsxfdi (long double a1)
{ {
register union ldouble_long dl1; register union ldouble_long dl1;

View File

@ -1,6 +1,6 @@
/* va_list.c - tinycc support for va_list on X86_64 */ /* va_list.c - tinycc support for va_list on X86_64 */
#if defined TCC_TARGET_X86_64 #if defined __x86_64__
/* Avoid include files, they may not be available when cross compiling */ /* Avoid include files, they may not be available when cross compiling */
extern void *memset(void *s, int c, __SIZE_TYPE__ n); extern void *memset(void *s, int c, __SIZE_TYPE__ n);

View File

@ -36,7 +36,7 @@ static int nb_states;
/********************************************************/ /********************************************************/
#ifdef ONE_SOURCE #if ONE_SOURCE
#include "tccpp.c" #include "tccpp.c"
#include "tccgen.c" #include "tccgen.c"
#include "tccelf.c" #include "tccelf.c"
@ -58,6 +58,7 @@ static int nb_states;
#ifdef TCC_TARGET_C67 #ifdef TCC_TARGET_C67
#include "c67-gen.c" #include "c67-gen.c"
#include "c67-link.c" #include "c67-link.c"
#include "tcccoff.c"
#endif #endif
#ifdef TCC_TARGET_X86_64 #ifdef TCC_TARGET_X86_64
#include "x86_64-gen.c" #include "x86_64-gen.c"
@ -67,9 +68,6 @@ static int nb_states;
#ifdef CONFIG_TCC_ASM #ifdef CONFIG_TCC_ASM
#include "tccasm.c" #include "tccasm.c"
#endif #endif
#ifdef TCC_TARGET_COFF
#include "tcccoff.c"
#endif
#ifdef TCC_TARGET_PE #ifdef TCC_TARGET_PE
#include "tccpe.c" #include "tccpe.c"
#endif #endif

15
tcc.c
View File

@ -18,10 +18,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifdef ONE_SOURCE
#include "libtcc.c"
#else
#include "tcc.h" #include "tcc.h"
#if ONE_SOURCE
# include "libtcc.c"
#endif #endif
#include "tcctools.c" #include "tcctools.c"
@ -335,12 +334,14 @@ redo:
} }
s->filetype = 0; s->filetype = 0;
s->alacarte_link = 1; s->alacarte_link = 1;
if (ret || --n == 0 if (--n == 0 || ret
|| (s->output_type == TCC_OUTPUT_OBJ && !s->option_r)) || (s->output_type == TCC_OUTPUT_OBJ && !s->option_r))
break; break;
} }
if (s->output_type == TCC_OUTPUT_PREPROCESS) { if (s->run_test) {
t = 0;
} else if (s->output_type == TCC_OUTPUT_PREPROCESS) {
; ;
} else if (0 == ret) { } else if (0 == ret) {
if (s->output_type == TCC_OUTPUT_MEMORY) { if (s->output_type == TCC_OUTPUT_MEMORY) {
@ -357,10 +358,6 @@ redo:
} }
} }
if (t)
ret = 0;
if (s->run_test)
t = 0;
if (s->do_bench && (n | t | ret) == 0) if (s->do_bench && (n | t | ret) == 0)
tcc_print_stats(s, getclock_ms() - start_time); tcc_print_stats(s, getclock_ms() - start_time);
tcc_delete(s); tcc_delete(s);

59
tcc.h
View File

@ -81,6 +81,14 @@ extern long double strtold (const char *__nptr, char **__endptr);
# define O_BINARY 0 # define O_BINARY 0
#endif #endif
#ifndef offsetof
#define offsetof(type, field) ((size_t) &((type *)0)->field)
#endif
#ifndef countof
#define countof(tab) (sizeof(tab) / sizeof((tab)[0]))
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
# define NORETURN __declspec(noreturn) # define NORETURN __declspec(noreturn)
# define ALIGNED(x) __declspec(align(x)) # define ALIGNED(x) __declspec(align(x))
@ -99,12 +107,6 @@ extern long double strtold (const char *__nptr, char **__endptr);
# define PATHCMP strcmp # define PATHCMP strcmp
#endif #endif
#ifdef TCC_TARGET_PE
#define PATHSEP ';'
#else
#define PATHSEP ':'
#endif
/* -------------------------------------------- */ /* -------------------------------------------- */
/* parser debug */ /* parser debug */
@ -129,12 +131,20 @@ extern long double strtold (const char *__nptr, char **__endptr);
#if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_ARM) && \ #if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_ARM) && \
!defined(TCC_TARGET_ARM64) && !defined(TCC_TARGET_C67) && \ !defined(TCC_TARGET_ARM64) && !defined(TCC_TARGET_C67) && \
!defined(TCC_TARGET_X86_64) !defined(TCC_TARGET_X86_64)
#define TCC_TARGET_I386 # if defined __x86_64__ || defined _AMD64_
#endif # define TCC_TARGET_X86_64
# elif defined __arm__
/* object format selection */ # define TCC_TARGET_ARM
#if defined(TCC_TARGET_C67) # define TCC_ARM_EABI
#define TCC_TARGET_COFF # define TCC_ARM_HARDFLOAT
# elif defined __aarch64__
# define TCC_TARGET_ARM64
# else
# define TCC_TARGET_I386
# endif
# ifdef _WIN32
# define TCC_TARGET_PE 1
# endif
#endif #endif
/* only native compiler supports -run */ /* only native compiler supports -run */
@ -164,7 +174,7 @@ extern long double strtold (const char *__nptr, char **__endptr);
# define CONFIG_SYSROOT "" # define CONFIG_SYSROOT ""
#endif #endif
#ifndef CONFIG_TCCDIR #ifndef CONFIG_TCCDIR
# define CONFIG_TCCDIR "." # define CONFIG_TCCDIR "/usr/local/lib/tcc"
#endif #endif
#ifndef CONFIG_LDDIR #ifndef CONFIG_LDDIR
# define CONFIG_LDDIR "lib" # define CONFIG_LDDIR "lib"
@ -266,6 +276,12 @@ extern long double strtold (const char *__nptr, char **__endptr);
#define TCC_LIBGCC USE_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) "/libgcc_s.so.1" #define TCC_LIBGCC USE_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) "/libgcc_s.so.1"
#endif #endif
#ifdef TCC_TARGET_PE
#define PATHSEP ';'
#else
#define PATHSEP ':'
#endif
/* -------------------------------------------- */ /* -------------------------------------------- */
#include "libtcc.h" #include "libtcc.h"
@ -278,7 +294,11 @@ extern long double strtold (const char *__nptr, char **__endptr);
# define PUB_FUNC # define PUB_FUNC
#endif #endif
#ifdef ONE_SOURCE #ifndef ONE_SOURCE
# define ONE_SOURCE 1
#endif
#if ONE_SOURCE
#define ST_INLN static inline #define ST_INLN static inline
#define ST_FUNC static #define ST_FUNC static
#define ST_DATA static #define ST_DATA static
@ -314,6 +334,7 @@ extern long double strtold (const char *__nptr, char **__endptr);
# include "arm64-link.c" # include "arm64-link.c"
#endif #endif
#ifdef TCC_TARGET_C67 #ifdef TCC_TARGET_C67
# define TCC_TARGET_COFF
# include "coff.h" # include "coff.h"
# include "c67-gen.c" # include "c67-gen.c"
# include "c67-link.c" # include "c67-link.c"
@ -965,14 +986,6 @@ struct filespec {
#define TOK_A_SHL 0x81 #define TOK_A_SHL 0x81
#define TOK_A_SAR 0x82 #define TOK_A_SAR 0x82
#ifndef offsetof
#define offsetof(type, field) ((size_t) &((type *)0)->field)
#endif
#ifndef countof
#define countof(tab) (sizeof(tab) / sizeof((tab)[0]))
#endif
#define TOK_EOF (-1) /* end of file */ #define TOK_EOF (-1) /* end of file */
#define TOK_LINEFEED 10 /* line feed */ #define TOK_LINEFEED 10 /* line feed */
@ -1641,7 +1654,7 @@ ST_FUNC void gen_makedeps(TCCState *s, const char *target, const char *filename)
/********************************************************/ /********************************************************/
#undef ST_DATA #undef ST_DATA
#ifdef ONE_SOURCE #if ONE_SOURCE
#define ST_DATA static #define ST_DATA static
#else #else
#define ST_DATA #define ST_DATA

View File

@ -1218,12 +1218,16 @@ ST_FUNC int gv(int rc)
} else { } else {
if (is_float(vtop->type.t) && if (is_float(vtop->type.t) &&
(vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) { (vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
unsigned long offset;
/* CPUs usually cannot use float constants, so we store them /* CPUs usually cannot use float constants, so we store them
generically in data segment */ generically in data segment */
size = type_size(&vtop->type, &align); size = type_size(&vtop->type, &align);
vpush_ref(&vtop->type, data_section, data_section->data_offset, size); if (NODATA_WANTED)
size = 0, align = 1;
offset = section_add(data_section, size, align);
vpush_ref(&vtop->type, data_section, offset, size);
vswap(); vswap();
init_putv(&vtop->type, data_section, data_section->data_offset); init_putv(&vtop->type, data_section, offset);
vtop->r |= VT_LVAL; vtop->r |= VT_LVAL;
} }
#ifdef CONFIG_TCC_BCHECK #ifdef CONFIG_TCC_BCHECK
@ -3518,8 +3522,11 @@ static void struct_layout(CType *type, AttributeDef *ad)
/* In PCC layout named bit-fields influence the alignment /* In PCC layout named bit-fields influence the alignment
of the containing struct using the base types alignment, of the containing struct using the base types alignment,
except for packed fields (which here have correct align). */ except for packed fields (which here have correct align). */
if (f->v & SYM_FIRST_ANOM) if (f->v & SYM_FIRST_ANOM
// && bit_size // ??? gcc on ARM/rpi does that
)
align = 1; align = 1;
} else { } else {
bt = f->type.t & VT_BTYPE; bt = f->type.t & VT_BTYPE;
if ((bit_pos + bit_size > size * 8) if ((bit_pos + bit_size > size * 8)
@ -3610,7 +3617,7 @@ static void struct_layout(CType *type, AttributeDef *ad)
if (a < maxalign) if (a < maxalign)
a = maxalign; a = maxalign;
type->ref->r = a; type->ref->r = a;
if (pragma_pack && pragma_pack < maxalign) { if (pragma_pack && pragma_pack < maxalign && 0 == pcc) {
/* can happen if individual align for some member was given. In /* can happen if individual align for some member was given. In
this case MSVC ignores maxalign when aligning the size */ this case MSVC ignores maxalign when aligning the size */
a = pragma_pack; a = pragma_pack;

23
tccpp.c
View File

@ -49,6 +49,7 @@ static unsigned char isidnum_table[256 - CH_EOF];
static int pp_debug_tok, pp_debug_symv; static int pp_debug_tok, pp_debug_symv;
static int pp_once; static int pp_once;
static int pp_expr; static int pp_expr;
static int pp_counter;
static void tok_print(const char *msg, const int *str); static void tok_print(const char *msg, const int *str);
static struct TinyAlloc *toksym_alloc; static struct TinyAlloc *toksym_alloc;
@ -1409,7 +1410,7 @@ ST_FUNC void label_pop(Sym **ptop, Sym *slast, int keep)
} }
/* fake the nth "#if defined test_..." for tcc -dt -run */ /* fake the nth "#if defined test_..." for tcc -dt -run */
static void maybe_run_test(TCCState *s, int *c) static void maybe_run_test(TCCState *s)
{ {
const char *p; const char *p;
if (s->include_stack_ptr != s->include_stack) if (s->include_stack_ptr != s->include_stack)
@ -1420,7 +1421,7 @@ static void maybe_run_test(TCCState *s, int *c)
if (0 != --s->run_test) if (0 != --s->run_test)
return; return;
fprintf(s->ppfp, "\n[%s]\n" + !(s->dflag & 32), p), fflush(s->ppfp); fprintf(s->ppfp, "\n[%s]\n" + !(s->dflag & 32), p), fflush(s->ppfp);
*c = 1; define_push(tok, MACRO_OBJ, NULL, NULL);
} }
/* eval an expression for #if/#elif */ /* eval an expression for #if/#elif */
@ -1440,9 +1441,9 @@ static int expr_preprocess(void)
next_nomacro(); next_nomacro();
if (tok < TOK_IDENT) if (tok < TOK_IDENT)
expect("identifier"); expect("identifier");
c = define_find(tok) != 0;
if (tcc_state->run_test) if (tcc_state->run_test)
maybe_run_test(tcc_state, &c); maybe_run_test(tcc_state);
c = define_find(tok) != 0;
if (t == '(') { if (t == '(') {
next_nomacro(); next_nomacro();
if (tok != ')') if (tok != ')')
@ -3222,18 +3223,17 @@ static int macro_subst_tok(
Sym *s) Sym *s)
{ {
Sym *args, *sa, *sa1; Sym *args, *sa, *sa1;
int parlevel, *mstr, t, t1, spc; int parlevel, t, t1, spc;
TokenString str; TokenString str;
char *cstrval; char *cstrval;
CValue cval; CValue cval;
CString cstr; CString cstr;
char buf[32]; char buf[32];
static int counter;
/* if symbol is a macro, prepare substitution */ /* if symbol is a macro, prepare substitution */
/* special macros */ /* special macros */
if (tok == TOK___LINE__ || tok == TOK___COUNTER__) { if (tok == TOK___LINE__ || tok == TOK___COUNTER__) {
t = tok == TOK___LINE__ ? file->line_num : counter++; t = tok == TOK___LINE__ ? file->line_num : pp_counter++;
snprintf(buf, sizeof(buf), "%d", t); snprintf(buf, sizeof(buf), "%d", t);
cstrval = buf; cstrval = buf;
t1 = TOK_PPNUM; t1 = TOK_PPNUM;
@ -3264,11 +3264,11 @@ static int macro_subst_tok(
cval.str.data = cstr.data; cval.str.data = cstr.data;
tok_str_add2(tok_str, t1, &cval); tok_str_add2(tok_str, t1, &cval);
cstr_free(&cstr); cstr_free(&cstr);
} else { } else if (s->d) {
int saved_parse_flags = parse_flags; int saved_parse_flags = parse_flags;
int *joined_str = NULL; int *joined_str = NULL;
int *mstr = s->d;
mstr = s->d;
if (s->type.t == MACRO_FUNC) { if (s->type.t == MACRO_FUNC) {
/* whitespace between macro name and argument list */ /* whitespace between macro name and argument list */
TokenString ws_str; TokenString ws_str;
@ -3523,6 +3523,9 @@ ST_FUNC void preprocess_start(TCCState *s1, int is_asm)
s1->include_stack_ptr = s1->include_stack; s1->include_stack_ptr = s1->include_stack;
s1->ifdef_stack_ptr = s1->ifdef_stack; s1->ifdef_stack_ptr = s1->ifdef_stack;
file->ifdef_stack_ptr = s1->ifdef_stack_ptr; file->ifdef_stack_ptr = s1->ifdef_stack_ptr;
pp_expr = 0;
pp_counter = 0;
pp_debug_tok = pp_debug_symv = 0;
pp_once++; pp_once++;
pvtop = vtop = vstack - 1; pvtop = vtop = vstack - 1;
s1->pack_stack[0] = 0; s1->pack_stack[0] = 0;

View File

@ -55,7 +55,7 @@ ifdef CONFIG_WIN32
PATH := $(CURDIR)/$(TOP)$(SEP)$(PATH) # for libtcc_test to find libtcc.dll PATH := $(CURDIR)/$(TOP)$(SEP)$(PATH) # for libtcc_test to find libtcc.dll
endif endif
RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOPSRC)/tcc.c $(TCCFLAGS) RUN_TCC = $(NATIVE_DEFINES) -run $(TOPSRC)/tcc.c $(TCCFLAGS)
DISAS = objdump -d DISAS = objdump -d
DUMPTCC = (set -x; $(TOP)/tcc -vv; ldd $(TOP)/tcc; exit 1) DUMPTCC = (set -x; $(TOP)/tcc -vv; ldd $(TOP)/tcc; exit 1)
@ -129,23 +129,23 @@ test4: tcctest.c test.ref
# use tcc to create libtcc.so/.dll and the tcc(.exe) frontend and run them # use tcc to create libtcc.so/.dll and the tcc(.exe) frontend and run them
dlltest: dlltest:
@echo ------------ $@ ------------ @echo ------------ $@ ------------
$(TCC) -DONE_SOURCE $(NATIVE_DEFINES) -DLIBTCC_AS_DLL $(TOPSRC)/libtcc.c $(LIBS) -shared -o libtcc2$(DLLSUF) $(TCC) $(NATIVE_DEFINES) -DLIBTCC_AS_DLL $(TOPSRC)/libtcc.c $(LIBS) -shared -o libtcc2$(DLLSUF)
$(TCC) $(NATIVE_DEFINES) $(TOPSRC)/tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF) $(TCC) $(NATIVE_DEFINES) -DONE_SOURCE=0 $(TOPSRC)/tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c ./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c
ifndef CONFIG_WIN32 ifndef CONFIG_WIN32
@echo ------------ $@ with PIC ------------ @echo ------------ $@ with PIC ------------
$(CC) $(CFLAGS) -fPIC -DONE_SOURCE $(NATIVE_DEFINES) -DLIBTCC_AS_DLL -c $(TOPSRC)/libtcc.c $(CC) $(CFLAGS) -fPIC $(NATIVE_DEFINES) -DLIBTCC_AS_DLL -c $(TOPSRC)/libtcc.c
$(TCC) libtcc.o $(LIBS) -shared -o libtcc2$(DLLSUF) $(TCC) libtcc.o $(LIBS) -shared -o libtcc2$(DLLSUF)
$(TCC) $(NATIVE_DEFINES) $(TOPSRC)/tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF) $(TCC) $(NATIVE_DEFINES) -DONE_SOURCE=0 $(TOPSRC)/tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c ./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c
endif endif
@rm tcc2$(EXESUF) libtcc2$(DLLSUF) @rm tcc2$(EXESUF) libtcc2$(DLLSUF)
memtest: memtest:
@echo ------------ $@ ------------ @echo ------------ $@ ------------
$(CC) $(CFLAGS) $(NATIVE_DEFINES) -DONE_SOURCE -DMEM_DEBUG=2 $(TOPSRC)/tcc.c $(LIBS) -o memtest-tcc$(EXESUF) $(CC) $(CFLAGS) $(NATIVE_DEFINES) -DMEM_DEBUG=2 $(TOPSRC)/tcc.c $(LIBS) -o memtest-tcc$(EXESUF)
./memtest-tcc$(EXESUF) $(TCCFLAGS) $(NATIVE_DEFINES) -DONE_SOURCE $(TOPSRC)/tcc.c $(LIBS) ./memtest-tcc$(EXESUF) $(TCCFLAGS) $(NATIVE_DEFINES) $(TOPSRC)/tcc.c $(LIBS)
./memtest-tcc$(EXESUF) $(TCCFLAGS) $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOPSRC)/tcc.c $(TCCFLAGS) $(TOPSRC)/tests/tcctest.c ./memtest-tcc$(EXESUF) $(TCCFLAGS) $(NATIVE_DEFINES) -run $(TOPSRC)/tcc.c $(TCCFLAGS) $(TOPSRC)/tests/tcctest.c
# memory and bound check auto test # memory and bound check auto test
@ -210,7 +210,7 @@ abitest-cc$(EXESUF): abitest.c $(LIBTCC)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) -w $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -w
abitest-tcc$(EXESUF): abitest.c libtcc.c abitest-tcc$(EXESUF): abitest.c libtcc.c
$(TCC) -o $@ $^ $(NATIVE_DEFINES) -DONE_SOURCE $(LIBS) $(TCC) -o $@ $^ $(NATIVE_DEFINES) $(LIBS)
ABITESTS := abitest-cc$(EXESUF) ABITESTS := abitest-cc$(EXESUF)
ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float

View File

@ -87,8 +87,10 @@
# define P # define P
#endif #endif
printf("\n\n" + 2*top);
#define TEST 1 #define TEST 1
#include SELF #include SELF
top = 0;
#define TEST 2 #define TEST 2
#include SELF #include SELF
#define TEST 3 #define TEST 3
@ -99,7 +101,6 @@
#include SELF #include SELF
#define TEST 6 #define TEST 6
#include SELF #include SELF
printf("\n\n");
#if PACK #if PACK
# pragma pack(pop) # pragma pack(pop)
@ -174,7 +175,7 @@ void dump(void *p, int s)
#define TEST_STRUCT(v1,v2,v3,v4,v5) { \ #define TEST_STRUCT(v1,v2,v3,v4,v5) { \
struct __s _s, *s = & _s; \ struct __s _s, *s = & _s; \
printf("---- TEST %d%s%s%s ----\n", \ printf("\n---- TEST %d%s%s%s ----\n" + top, \
TEST, MS_BF?" - MS-BITFIELDS":"", \ TEST, MS_BF?" - MS-BITFIELDS":"", \
PACK?" - PACKED":"", \ PACK?" - PACKED":"", \
ALIGN?" - WITH ALIGN":""); \ ALIGN?" - WITH ALIGN":""); \
@ -184,7 +185,7 @@ void dump(void *p, int s)
s->x = v1, s->y = v2, s->z = v3, s->a += v4, ++s->a, s->b = v5; \ s->x = v1, s->y = v2, s->z = v3, s->a += v4, ++s->a, s->b = v5; \
printf("bits as set : "), dump(s, sizeof *s); \ printf("bits as set : "), dump(s, sizeof *s); \
printf("values :"), pv(x), pv(y), pv(z), pv(a), pv(b), printf("\n"); \ printf("values :"), pv(x), pv(y), pv(z), pv(a), pv(b), printf("\n"); \
printf("align/size : %d %d\n\n", alignof(struct __s),sizeof(struct __s)); \ printf("align/size : %d %d\n", alignof(struct __s),sizeof(struct __s)); \
} }
#ifdef _MSC_VER #ifdef _MSC_VER
@ -203,6 +204,8 @@ void dump(void *p, int s)
#define SELF "95_bitfields.c" #define SELF "95_bitfields.c"
int top = 1;
int main() int main()
{ {
#define MS_BF MS_BITFIELDS #define MS_BF MS_BITFIELDS

View File

@ -0,0 +1,149 @@
---- TEST 1 ----
bits in use : 0000001FFFFFFFFF007F0FFF
bits as set : 000000076055555500440333
values : 333 44 555555 06 07
align/size : 4 12
---- TEST 2 ----
bits in use : 000000000000003F7FFFFFFFFFFFFFFF00000000003F0FFF
bits as set : 0000000000000025123456789ABCDEF000000000001E0003
values : 03 1e 123456789abcdef0 05 fffffffe
align/size : 8 24
---- TEST 3 ----
bits in use : 001F1F1F000003FF
bits as set : 000E0619000002F5
values : 15 17 19 06 0e
align/size : 4 8
---- TEST 4 ----
bits in use : 0007FFFF00000027
bits as set : 00078F0F00000023
values : 03 ffffffff 0f fffffff8 78
align/size : 4 8
---- TEST 5 ----
bits in use : FFFFFF3FFFFFFFFF000000003FFFFFFF00001FFFFFFFFFFF
bits as set : 007744000000007800000000300000000000000123456789
values : 0000000123456789 f0000000 0000000000000078 44 77
align/size : 8 24
---- TEST 6 ----
bits in use : 0000007000FFFFFFFFFFFFFF
bits as set : 00000030002001FD00000004
values : 01 02 03 04 fffffffd
align/size : 4 12
---- TEST 1 - PACKED ----
bits in use : FFFFFFFFFFFFFF
bits as set : 3B02AAAAAC4333
values : 333 44 555555 06 07
align/size : 1 7
---- TEST 2 - PACKED ----
bits in use : 7FFFFFFFFFFFFFFFFFFFFF
bits as set : 4A48D159E26AF37BC1E003
values : 03 1e 123456789abcdef0 05 fffffffe
align/size : 1 11
---- TEST 3 - PACKED ----
bits in use : 7FFF000003FF
bits as set : 38D9000002F5
values : 15 17 19 06 0e
align/size : 1 6
---- TEST 4 - PACKED ----
bits in use : 07FFFF00000027
bits as set : 078F0F00000023
values : 03 ffffffff 0f fffffff8 78
align/size : 1 7
---- TEST 5 - PACKED ----
bits in use : FFFFFF07FFFFFFFFFFFFFFFF9FFFFFFFFFFF
bits as set : 007744000000000F18000000000123456789
values : 0000000123456789 f0000000 0000000000000078 44 77
align/size : 1 18
---- TEST 6 - PACKED ----
bits in use : 007000FFFFFFFFFFFFFF
bits as set : 0030002001FD00000004
values : 01 02 03 04 fffffffd
align/size : 1 10
---- TEST 1 - WITH ALIGN ----
bits in use : 000000000000001FFFFFFFFF007F0FFF
bits as set : 00000000000000076055555500440333
values : 333 44 555555 06 07
align/size : 16 16
---- TEST 2 - WITH ALIGN ----
bits in use : 0000000000000000000000000000003F7FFFFFFFFFFFFFFF00000000003F0FFF
bits as set : 00000000000000000000000000000025123456789ABCDEF000000000001E0003
values : 03 1e 123456789abcdef0 05 fffffffe
align/size : 16 32
---- TEST 3 - WITH ALIGN ----
bits in use : 0000000000000000000000000000001F000000000000000000001F1F000003FF
bits as set : 0000000000000000000000000000000E000000000000000000000619000002F5
values : 15 17 19 06 0e
align/size : 16 32
---- TEST 4 - WITH ALIGN ----
bits in use : 0007FFFF00000027
bits as set : 00078F0F00000023
values : 03 ffffffff 0f fffffff8 78
align/size : 4 8
---- TEST 5 - WITH ALIGN ----
bits in use : FFFFFF3FFFFFFFFF000000003FFFFFFF00001FFFFFFFFFFF
bits as set : 007744000000007800000000300000000000000123456789
values : 0000000123456789 f0000000 0000000000000078 44 77
align/size : 8 24
---- TEST 6 - WITH ALIGN ----
bits in use : 0000007000FFFFFFFFFFFFFF
bits as set : 00000030002001FD00000004
values : 01 02 03 04 fffffffd
align/size : 4 12
---- TEST 1 - PACKED - WITH ALIGN ----
bits in use : 000000000000000000FFFFFFFFFFFFFF
bits as set : 0000000000000000003B02AAAAAC4333
values : 333 44 555555 06 07
align/size : 16 16
---- TEST 2 - PACKED - WITH ALIGN ----
bits in use : 3F01FFFFFFFFFFFFFFFFFFFF
bits as set : 250048D159E26AF37BC1E003
values : 03 1e 123456789abcdef0 05 fffffffe
align/size : 1 12
---- TEST 3 - PACKED - WITH ALIGN ----
bits in use : 1F03FF000003FF
bits as set : 0E00D9000002F5
values : 15 17 19 06 0e
align/size : 1 7
---- TEST 4 - PACKED - WITH ALIGN ----
bits in use : 07FFFF00000027
bits as set : 078F0F00000023
values : 03 ffffffff 0f fffffff8 78
align/size : 1 7
---- TEST 5 - PACKED - WITH ALIGN ----
bits in use : FFFFFF07FFFFFFFFFFFFFFFF9FFFFFFFFFFF
bits as set : 007744000000000F18000000000123456789
values : 0000000123456789 f0000000 0000000000000078 44 77
align/size : 1 18
---- TEST 6 - PACKED - WITH ALIGN ----
bits in use : 007000FFFFFFFFFFFFFF
bits as set : 0030002001FD00000004
values : 01 02 03 04 fffffffd
align/size : 1 10

View File

@ -147,6 +147,3 @@ bits in use : 00000000700000FFFFFFFFFFFFFF
bits as set : 000000003000002001FD00000004 bits as set : 000000003000002001FD00000004
values : 01 02 03 04 fffffffd values : 01 02 03 04 fffffffd
align/size : 1 14 align/size : 1 14

View File

@ -25,50 +25,60 @@ void foo() {
short w = &foo; /* 2 cast warnings */ short w = &foo; /* 2 cast warnings */
} }
#elif defined test_data_suppression #elif defined test_data_suppression_off || defined test_data_suppression_on
#if defined test_data_suppression_on
# define SKIP 1
#else
# define SKIP 0
#endif
#include <stdio.h> #include <stdio.h>
/* some gcc headers #define __attribute__ to empty if it's not gcc */
#define ASMLABELS(s) \ #undef __attribute__
__asm__(".global d"#s",t"#s"\n.data\nd"#s":\n.text\nt"#s":\n")
#define PROG \
static void *p = (void*)&main;\
static char cc[] = "static string";\
static double d = 8.0;\
static struct __attribute__((packed)) {\
unsigned x : 12;\
unsigned char y : 7;\
unsigned z : 28, a: 4, b: 5;\
} s = { 0x333,0x44,0x555555,6,7 };\
printf(" static data: %d - %.1f - %.1f - %s - %s\n",\
sizeof 8.0, 8.0, d, __FUNCTION__, cc);\
printf(" static bitfields: %x %x %x %x %x\n", s.x, s.y, s.z, s.a, s.b);
int main() int main()
{ {
extern char ds1[],ts1[]; __label__ ts0, te0, ts1, te1;
extern char ds2[],ts2[]; int tl, dl;
extern char de1[],te1[];
extern char de2[],te2[];
printf("suppression off\n"); static char ds0 = 0;
if (1) { static char de0 = 0;
ASMLABELS(s1); /* get reference size of empty jmp */
PROG ts0:;
ASMLABELS(e1); if (!SKIP) {}
} te0:;
printf(" data length is %s\n", de1 - ds1 ? "not 0":"0"); dl = -(&de0 - &ds0);
printf(" text length is %s\n", te1 - ts1 ? "not 0":"0"); tl = -(&&te0 - &&ts0);
printf("suppression on\n"); /* test data and code suppression */
if (0) { static char ds1 = 0;
ASMLABELS(s2); ts1:;
PROG if (!SKIP) {
ASMLABELS(e2); static void *p = (void*)&main;
static char cc[] = "static string";
static double d = 8.0;
static struct __attribute__((packed)) {
unsigned x : 12;
unsigned char y : 7;
unsigned z : 28, a: 4, b: 5;
} s = { 0x333,0x44,0x555555,6,7 };
printf("data:\n");
printf(" %d - %.1f - %.1f - %s - %s\n",
sizeof 8.0, 8.0, d, __FUNCTION__, cc);
printf(" %x %x %x %x %x\n",
s.x, s.y, s.z, s.a, s.b);
} }
printf(" data length is %x\n", de2 - ds2); te1:;
printf(" text length is %X\n", te2 - ts2); static char de1 = 0;
return 0;
dl += &de1 - &ds1;
tl += &&te1 - &&ts1;
printf("size of data/text:\n %s/%s\n",
dl ? "non-zero":"zero", tl ? "non-zero":"zero");
printf("# %d/%d\n", dl, tl);
} }
#endif #endif

View File

@ -11,12 +11,15 @@
96_nodata_wanted.c:25: warning: assignment makes integer from pointer without a cast 96_nodata_wanted.c:25: warning: assignment makes integer from pointer without a cast
96_nodata_wanted.c:25: warning: nonportable conversion from pointer to char/short 96_nodata_wanted.c:25: warning: nonportable conversion from pointer to char/short
[test_data_suppression] [test_data_suppression_off]
suppression off data:
static data: 8 - 8.0 - 8.0 - main - static string 8 - 8.0 - 8.0 - main - static string
static bitfields: 333 44 555555 6 7 333 44 555555 6 7
data length is not 0 size of data/text:
text length is not 0 non-zero/non-zero
suppression on # 111/193
data length is 0
text length is 0 [test_data_suppression_on]
size of data/text:
zero/zero
# 0/0

View File

@ -24,7 +24,7 @@ ifeq (-$(findstring gcc,$(CC))-,--)
SKIP += $(patsubst %.expect,%.test,$(GEN-ALWAYS)) SKIP += $(patsubst %.expect,%.test,$(GEN-ALWAYS))
endif endif
ifeq (-$(CONFIG_WIN32)-$(CONFIG_i386)$(CONFIG_arm)-,--yes-) ifeq (-$(CONFIG_WIN32)-$(CONFIG_i386)$(CONFIG_arm)-,--yes-)
SKIP += 95_bitfields_ms.test # type_align is differnt on 32bit-non-windows SKIP += 95_bitfields%.test # type_align is differnt on 32bit-non-windows
endif endif
# Some tests might need arguments # Some tests might need arguments
@ -46,7 +46,7 @@ FLAGS =
# Always generate certain .expects (don't put these in the GIT), # Always generate certain .expects (don't put these in the GIT),
GEN-ALWAYS = GEN-ALWAYS =
GEN-ALWAYS += 95_bitfields.expect # GEN-ALWAYS += 95_bitfields.expect # does not work
# using the ms compiler for the really ms-compatible bitfields # using the ms compiler for the really ms-compatible bitfields
95_bitfields_ms.test : GEN = $(GEN-MSC) 95_bitfields_ms.test : GEN = $(GEN-MSC)
@ -67,7 +67,7 @@ all test tests2.all: $(filter-out $(SKIP),$(TESTS)) ;
T1 = $(TCC) $(FLAGS) $< -o a.exe && ./a.exe $(ARGS) T1 = $(TCC) $(FLAGS) $< -o a.exe && ./a.exe $(ARGS)
T2 = $(TCC) $(FLAGS) -run $< $(ARGS) T2 = $(TCC) $(FLAGS) -run $< $(ARGS)
T3 = $(FILTER) >$*.output 2>&1 || true \ T3 = $(FILTER) >$*.output 2>&1 || true \
&& diff -Nbu $(filter %.expect,$^) $*.output \ && diff -Nbu -I "^\#" $(filter %.expect,$^) $*.output \
&& rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS)) && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS))
# run single test and update .expect file, e.g. "make tests2.37+" # run single test and update .expect file, e.g. "make tests2.37+"

View File

@ -111,10 +111,10 @@ echo>> ..\config.h #endif
for %%f in (*tcc.exe *tcc.dll) do @del %%f for %%f in (*tcc.exe *tcc.dll) do @del %%f
:compiler :compiler
%CC% -o libtcc.dll -shared ..\libtcc.c %D% -DONE_SOURCE -DLIBTCC_AS_DLL %CC% -o libtcc.dll -shared ..\libtcc.c %D% -DLIBTCC_AS_DLL
@if errorlevel 1 goto :the_end @if errorlevel 1 goto :the_end
%CC% -o tcc.exe ..\tcc.c libtcc.dll %D% %CC% -o tcc.exe ..\tcc.c libtcc.dll %D% -DONE_SOURCE=0
%CC% -o %PX%-tcc.exe ..\tcc.c %DX% -DONE_SOURCE %CC% -o %PX%-tcc.exe ..\tcc.c %DX%
@if (%TCC_FILES%)==(no) goto :files-done @if (%TCC_FILES%)==(no) goto :files-done
@ -131,30 +131,30 @@ copy>nul tcc-win32.txt doc
:libtcc1.a :libtcc1.a
@set O1=libtcc1.o crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o chkstk.o bcheck.o @set O1=libtcc1.o crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o chkstk.o bcheck.o
.\tcc -m32 %D32% -c ../lib/libtcc1.c .\tcc -m32 -c ../lib/libtcc1.c
.\tcc -m32 %D32% -c lib/crt1.c .\tcc -m32 -c lib/crt1.c
.\tcc -m32 %D32% -c lib/crt1w.c .\tcc -m32 -c lib/crt1w.c
.\tcc -m32 %D32% -c lib/wincrt1.c .\tcc -m32 -c lib/wincrt1.c
.\tcc -m32 %D32% -c lib/wincrt1w.c .\tcc -m32 -c lib/wincrt1w.c
.\tcc -m32 %D32% -c lib/dllcrt1.c .\tcc -m32 -c lib/dllcrt1.c
.\tcc -m32 %D32% -c lib/dllmain.c .\tcc -m32 -c lib/dllmain.c
.\tcc -m32 %D32% -c lib/chkstk.S .\tcc -m32 -c lib/chkstk.S
.\tcc -m32 %D32% -w -c ../lib/bcheck.c .\tcc -m32 -w -c ../lib/bcheck.c
.\tcc -m32 %D32% -c ../lib/alloca86.S .\tcc -m32 -c ../lib/alloca86.S
.\tcc -m32 %D32% -c ../lib/alloca86-bt.S .\tcc -m32 -c ../lib/alloca86-bt.S
.\tcc -m32 -ar lib/libtcc1-32.a %O1% alloca86.o alloca86-bt.o .\tcc -m32 -ar lib/libtcc1-32.a %O1% alloca86.o alloca86-bt.o
@if errorlevel 1 goto :the_end @if errorlevel 1 goto :the_end
.\tcc -m64 %D64% -c ../lib/libtcc1.c .\tcc -m64 -c ../lib/libtcc1.c
.\tcc -m64 %D64% -c lib/crt1.c .\tcc -m64 -c lib/crt1.c
.\tcc -m64 %D64% -c lib/crt1w.c .\tcc -m64 -c lib/crt1w.c
.\tcc -m64 %D64% -c lib/wincrt1.c .\tcc -m64 -c lib/wincrt1.c
.\tcc -m64 %D64% -c lib/wincrt1w.c .\tcc -m64 -c lib/wincrt1w.c
.\tcc -m64 %D64% -c lib/dllcrt1.c .\tcc -m64 -c lib/dllcrt1.c
.\tcc -m64 %D64% -c lib/dllmain.c .\tcc -m64 -c lib/dllmain.c
.\tcc -m64 %D64% -c lib/chkstk.S .\tcc -m64 -c lib/chkstk.S
.\tcc -m64 %D64% -w -c ../lib/bcheck.c .\tcc -m64 -w -c ../lib/bcheck.c
.\tcc -m64 %D64% -c ../lib/alloca86_64.S .\tcc -m64 -c ../lib/alloca86_64.S
.\tcc -m64 %D64% -c ../lib/alloca86_64-bt.S .\tcc -m64 -c ../lib/alloca86_64-bt.S
.\tcc -m64 -ar lib/libtcc1-64.a %O1% alloca86_64.o alloca86_64-bt.o .\tcc -m64 -ar lib/libtcc1-64.a %O1% alloca86_64.o alloca86_64-bt.o
@if errorlevel 1 goto :the_end @if errorlevel 1 goto :the_end

View File

@ -2,7 +2,7 @@
/* chkstk86.s */ /* chkstk86.s */
/* ---------------------------------------------- */ /* ---------------------------------------------- */
#ifndef TCC_TARGET_X86_64 #ifndef __x86_64__
/* ---------------------------------------------- */ /* ---------------------------------------------- */
.globl __chkstk .globl __chkstk
@ -68,7 +68,7 @@ tinyc_getbp:
/* ---------------------------------------------- */ /* ---------------------------------------------- */
#ifndef TCC_TARGET_X86_64 #ifndef __x86_64__
/* ---------------------------------------------- */ /* ---------------------------------------------- */
/* /*