diff options
| author | grischka <grischka> | 2017-10-11 18:13:43 +0200 |
|---|---|---|
| committer | grischka <grischka> | 2017-10-11 18:13:43 +0200 |
| commit | da8c62f75d893449e232944fc62566c020b4d010 (patch) | |
| tree | 977fec8d53d90ceb8c718f07f47c2bc9cbd6edfc /tccgen.c | |
| parent | faa9744f5d13c94c7298bf08e8d1eedca5db88a9 (diff) | |
| download | tinycc-da8c62f75d893449e232944fc62566c020b4d010.tar.gz tinycc-da8c62f75d893449e232944fc62566c020b4d010.tar.bz2 | |
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 38 |
1 files changed, 27 insertions, 11 deletions
@@ -116,6 +116,12 @@ ST_FUNC int ieee_finite(double d) return ((unsigned)((p[1] | 0x800fffff) + 1)) >> 31; } +/* compiling intel long double natively */ +#if (defined __i386__ || defined __x86_64__) \ + && (defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64) +# define TCC_IS_NATIVE_387 +#endif + ST_FUNC void test_lvalue(void) { if (!(vtop->r & VT_LVAL)) @@ -267,9 +273,6 @@ ST_FUNC int tccgen_compile(TCCState *s1) parse_flags = PARSE_FLAG_PREPROCESS | PARSE_FLAG_TOK_NUM | PARSE_FLAG_TOK_STR; next(); decl(VT_CONST); - if (tok != TOK_EOF) - expect("declaration"); - gen_inline_functions(s1); check_vstack(); /* end of translation unit info */ @@ -2411,6 +2414,9 @@ static void gen_cast(CType *type) df = is_float(dbt); c = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST; p = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == (VT_CONST | VT_SYM); +#if !defined TCC_IS_NATIVE && !defined TCC_IS_NATIVE_387 + c &= dbt != VT_LDOUBLE; +#endif if (c) { /* constant case: we can do it now */ /* XXX: in ISOC, cannot do it if error in convert */ @@ -3096,6 +3102,8 @@ ST_FUNC void vstore(void) /* ... and discard */ vpop(); } + } else if (dbt == VT_VOID) { + --vtop; } else { #ifdef CONFIG_TCC_BCHECK /* bound check case */ @@ -5925,7 +5933,10 @@ static void block(int *bsym, int *csym, int is_expr) if (tok != ';') { gexpr(); gen_assign_cast(&func_vt); - gfunc_return(&func_vt); + if ((func_vt.t & VT_BTYPE) == VT_VOID) + vtop--; + else + gfunc_return(&func_vt); } skip(';'); /* jump unless last stmt in top-level block */ @@ -6483,7 +6494,7 @@ static void init_putv(CType *type, Section *sec, unsigned long c) *(double *)ptr = vtop->c.d; break; case VT_LDOUBLE: -#if (defined __i386__ || defined __x86_64__) && (defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64) +#if defined TCC_IS_NATIVE_387 if (sizeof (long double) >= 10) /* zero pad ten-byte LD */ memcpy(ptr, &vtop->c.ld, 10); #ifdef __TINYC__ @@ -7091,17 +7102,22 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym) next(); continue; } - if (l == VT_CONST && - (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3)) { + if (l != VT_CONST) + break; + if (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3) { /* global asm block */ asm_global_instr(); continue; } - /* special test for old K&R protos without explicit int - type. Only accepted when defining global data */ - if (l != VT_CONST || tok < TOK_UIDENT) + if (tok >= TOK_UIDENT) { + /* special test for old K&R protos without explicit int + type. Only accepted when defining global data */ + btype.t = VT_INT; + } else { + if (tok != TOK_EOF) + expect("declaration"); break; - btype.t = VT_INT; + } } if (tok == ';') { if ((btype.t & VT_BTYPE) == VT_STRUCT) { |
