aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tiny_impldef.exe was not built by MakefileChristian Jullien2017-02-161-140/+142
|
* Fix wrong name for 85 test.Christian Jullien2017-02-151-1/+1
|
* win32: build-tcc.bat: figure out correct bitness of cl.exeVlad Vissoultchev2017-02-141-6/+21
|
* Improve cygwin Makefile that now support TARGET=32/64 to force final version ↵Christian Jullien2017-02-142-11/+30
| | | | for 32/64 platform
* updates & cleanups (tcc-doc/Changelog/TODO ...)grischka2017-02-1329-771/+221
| | | | | | | | | | | | | | | - tcc-doc.texi: commandline option info update - Changelog/TODO: update - tests/tcctest.py: removed - tests/Makefile: weaktest fixed - tests/tests2: some files renamed and/or converted to unix LF - configure/Makefile: --enable-static option (no dll on win32) - win32/build-tcc.bat: msvc support - win32/tcc-win32.txt: build info update - win32/vs2015/: VS solution removed - win32/include/tcc/tcc_libm.h: #include statement fixed - tcc.c: -include <file> option help info - .gitignore: cleanup
* mems & leaksgrischka2017-02-134-14/+38
| | | | | | | | | | | | - define_start: set above preprocess_start because now preprocess_start is defining macros. - free "cmd_include_files" - free defines always (after error-longjmps) - close all files (after error-longjmps) - tccpe.c: free imports always - libtcc.c: call tcc_memstats only after all states have been deleted.
* fixes & cleanupsgrischka2017-02-1313-90/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - tccgen.c/tcc.h: allow function declaration after use: int f() { return g(); } int g() { return 1; } may be a warning but not an error see also 76cb1144ef91924c53c57ea71e6f67ce73ce1cc6 - tccgen.c: redundant code related to inline functions removed (functions used anywhere have sym->c set automatically) - tccgen.c: make 32bit llop non-equal test portable (probably not on C67) - dynarray_add: change prototype to possibly avoid aliasing problems or at least warnings - lib/alloca*.S: ".section .note.GNU-stack,"",%progbits" removed (has no effect) - tccpe: set SizeOfCode field (for correct upx decompression) - libtcc.c: fixed alternative -run invocation tcc "-run -lxxx ..." file.c (meant to load the library after file). Also supported now: tcc files ... options ... -run @ arguments ...
* Detect native version from default gcc target.Christian Jullien2017-02-121-8/+9
|
* tccgen: yet another nocode_wanted fixgrischka2017-02-121-4/+2
| | | | | | | | | | | Some code in gen_opl was depending on a gvtst label which in nocode_wanted mode is not set. This was causing vstack leaks and crashes with for example long long ll; if (0) return ll - 10 < 0;
* Add Makefile to build native tcc 32/64 on Windows using cygwinChristian Jullien2017-02-121-0/+130
|
* arm64: Fix 42_function_testMichael Matz2017-02-111-2/+2
| | | | | | Like in 77d7ea04a some relocs need to be handled as possibly needing a PLT/GOT slot in TCC until TCC can transfer dynamic relocs to executables.
* Fix testsuite invocationsMichael Matz2017-02-111-2/+2
| | | | | | The return code of $(FILTER) clobbers the return code of TCC itself. So just prepend messages to the generated output file and ignore return codes.
* libtcc: support multiple -Wl,-rpath=...'sgrischka2017-02-111-7/+11
|
* arm: libtcc1.a needs gcc with -fPICgrischka2017-02-111-7/+3
|
* Add pre-build step in VS2015 projects to generate config.h from VERSIONVlad Vissoultchev2017-02-093-0/+61
|
* update VERSION to 0.9.27grischka2017-02-083-6/+6
| | | | | | | | | Also: - in tests: generate .expect files only if not yet present, because 1) some files were adjusted manually 2) switching git branche might change timestamps and cause unwanted update
* win32: build-tcc.bat: add some optionsgrischka2017-02-081-52/+134
| | | | | | | | | | | | | | | | | | In particular: -c <compiler> : Allow using tcc to compile itself -i <dir> : Create installation in dir Summary: usage: build-tcc.bat [ options ... ] options: -c prog use prog (gcc or tcc) to compile tcc -c "prog options" use prog with options to compile tcc -t 32/64 force 32/64 bit default target -v "version" set tcc version -i dir install tcc into dir -d create tcc-doc.html too (needs makeinfo)
* win32: include/winapi: remove more filesgrischka2017-02-0811-1500/+10
| | | | Also: use _assert, older msvcrt does not have _wassert
* tcc: don't use pstrcpy, fix win32 spanwn quotinggrischka2017-02-083-25/+57
| | | | | | | | | | | | - we're now exporting tcc_prefixed symbols from libtcc only - On windows, the msvcrt startup code would remove backslashes from commandline arguments such as -DFOO=\"foo\" which would appear in argv as -DFOO="foo" Therefor before passing these to spawnvp, we need to restore the backslashes.
* tccgen: factor out gfunc_returngrischka2017-02-085-212/+199
| | | | | | | Also: - on windows i386 and x86-64, structures of size <= 8 are NOT returned in registers if size is not one of 1,2,4,8. - cleanup: put all tv-push/pop/swap/rot into one place
* tccgen: gen_cast: cast FLOAT to DOUBLEgrischka2017-02-051-0/+9
| | | | | ... to avoid precision loss when casting to int, also when saving FLOATs to stack
* Revert "partial revert of the commit 4ad186c5ef61"grischka2017-02-053-23/+0
| | | | | | | | | | | | | | | | | | There seems nothing wrong. With int t1 = 176401255; float f = 0.25; int t2 = t1 * f; // 176401255 * 0.25 = 44100313.75 according to the arithmetic conversion rules, the number 176401255 needs to be converted to float, and the compiler can choose either the nearest higher or nearest lower representable number "in an implementation-defined manner". Which may be 176401248 or 176401264. So as result both 44100312 and 44100313 are correct. This reverts commit 664c19ad5ef16f3463087a33ecfe5d5ac24f81ec.
* tccrun: sort sectionsgrischka2017-02-051-12/+26
| | | | | | | Sort executable before other sections. Also, apply RUN_SECTION_ALIGNMENT=63 for TCC_TARGET_I386 as well.
* tccrun: 'selinux' mmap: use only one mappinggrischka2017-02-051-38/+19
| | | | | | | | In the previous implementation, the rx mapping was never used. Therefor it is assumed that it is not needed. With only one mapping there is no reason to use a real /tmp/.xxxx file either as we can use an anonymous mapping.
* SECTION_ALIGNMENT -> RUN_SECTION_ALIGNMENT, and tweaksDavid Mertens2017-01-081-4/+5
| | | | | | | | | | | | Based on feedback from grischka, this commit (1) updates the name of the alignment constant to be more specific (2) aligns all sections, including the first (which previosly was not aligned) (3) reduces the x86-64 alignment from 512 to 64 bytes. The original x86-64 alignment of 512 bytes was based on testing. After ensuring that the initial section is also aligned, the same tests indicated that 64 bytes is sufficient.
* Architecture-specific section alignmentDavid Mertens2017-01-061-1/+7
| | | | | | | | Tests found excessive cache thrashing on x86-64 architectures. The problem was traced to the alignment of sections. This patch sets up an architecture-specific alignment of 512 bytes for x86-64 and 16 bytes for all others. It uses preprocessor directives that, hopefully, make it easy to tweak for other architectures.
* win32: support "-Wl,--large-address-aware" optionPavlas, Zdenek2016-12-303-0/+4
|
* tests: don't assume $(CC) is gccAvi Halachmi (:avih)2016-12-241-2/+2
| | | | This also allows self hosting + testing when $(CC) is tcc.
* tests: OOT build fixes etc.grischka2016-12-207-23/+36
| | | | | | | | | | | | | | | | | | | | | | tests/Makefile: fix out-of-tree build issues Also: - win64: align(16) MEM_DEBUG user memory on win64 the struct jmp_buf in the TCCState structure which we allocate by tcc_malloc needs alignment 16 because the msvcrt setjmp uses MMX instructions. - libtcc_test.c: win32/64 need __attribute__((dllimport)) for extern data objects - tcctest.c: exclude stuff that gcc does not compile except for relocation_test() the other issues are mostly ASM related. We should probably check GCC versions but I have no idea which mingw/gcc versions support what and which don't. - lib/Makefile: use tcc to compile libtcc1.a (except on arm which needs arm-asm
* Fix pseudo leakMichael Matz2016-12-201-5/+6
| | | | | | Once-allocated buffers (here a string) that aren't explicitely freed at program end but rather freed at _exit about 1 nanosecond later are regarded a leak with MEM_DEBUG, so explicitely free it. Blaeh :-/
* Fix some code suppression falloutMichael Matz2016-12-208-20/+138
| | | | | | | | | | Some more subtle issues with code suppression: - outputting asms but not their operand setup is broken - but global asms must always be output - statement expressions are transparent to code suppression - vtop can't be transformed from VT_CMP/VT_JMP when nocode_wanted Also remove .exe files from tests2 if they don't fail.
* i386-gen: fix USE_EBXgrischka2016-12-192-6/+11
| | | | | | | | | | | | | Restore ebx from *ebp because alloca might change esp. Also disable USE_EBX for upcoming release. Actually the benefit is less than one would expect, it appears that tcc can't do much with more than 3 registers except with extensive use of long longs where the disassembly looks much prettier (and shorter also). Also: tccgen/expr_cond() : fix wrong gv/save_regs order
* libtcc.c: -m option cleanupgrischka2016-12-184-197/+148
| | | | | | | | | | | handle mms-bitfields as sub-options of -m. (-mfloat-abi is still special because it requires arguments) tcc.c: help(): - list -mms-bitfields under 'Target specific options' libtcc.c/MEM_DEBUG - add check for past buffer writes
* tests: add memory leak testgrischka2016-12-187-37/+54
| | | | | | | | | | | | | Also ... tcctest.c: - exclude stuff that gcc doesn't compile on windows. libtcc.c/tccpp.c: - use unsigned for memory sizes to avoid printf format warnings - use "file:line: message" to make IDE error parsers happy. tccgen.c: fix typo
* tccgen: nocode_wanted++/--grischka2016-12-181-51/+37
| | | | | uses 'nocode_wanted' as a level couter instead of 'saved_nocode_wanted' everywhere.
* tccgen: fix expr_cond for alt. nocode_wantedgrischka2016-12-181-70/+74
| | | | | making shure that both the active and the passive branches do exacly the same thing.
* tccgen: nocode_wanted alternativelygrischka2016-12-187-131/+111
| | | | | | | | | | | | | | | tccgen.c: remove any 'nocode_wanted' checks, except in - greloca(), disables output elf symbols and relocs - get_reg(), will return just the first suitable reg) - save_regs(), will do nothing Some minor adjustments were made where nocode_wanted is set. xxx-gen.c: disable code output directly where it happens in functions: - g(), output disabled - gjmp(), will do nothing - gtst(), dto.
* Fix gawk miscompileMichael Matz2016-12-185-27/+56
| | | | | See testcase. Function pointer use was hosed when the destination function wasn't also called normally by the program.
* i386: Fix various testsuite issuesMichael Matz2016-12-153-18/+64
| | | | | | | | | on 32bit long long support was sometimes broken. This fixes code-gen for long long values in switches, disables a x86-64 specific testcase and avoid an undefined shift amount. It comments out a bitfield test involving long long bitfields > 32 bit; with GCC layout they can straddle multiple words and code generation isn't prepared for this.
* arm64: Handle R_AARCH64_PREL32 againMichael Matz2016-12-151-0/+5
| | | | This got lost when splitting reloc handling to individual files.
* arm64: Fix largeptr testMichael Matz2016-12-151-1/+2
| | | | VT_PTR needs to be handled like VT_LLONG.
* arm64: Fix a case of dead code suppressionMichael Matz2016-12-151-4/+6
| | | | 82_nocode_wanted.c:kb_wait_2_1 was miscompiled on arm64.
* struct-layout: Allow lowering of member alignmentMichael Matz2016-12-152-2/+17
| | | | | | when an alignment is explicitely given on the member itself, or on its types attributes then respect it always. Was only allowed to increase before, but GCC is allowing it.
* Support large alignment requestsMichael Matz2016-12-153-7/+38
| | | | | | | | The linux kernel has some structures that are page aligned, i.e. 4096. Instead of enlarging the bit fields to specify this, use the fact that alignment is always power of two, and store only the log2 minus 1 of it. The 5 bits are enough to specify an alignment of 1 << 30.
* struct-layout: cleanup code a bitMichael Matz2016-12-151-94/+56
|
* bitfields: Fix MS layout some moreMichael Matz2016-12-151-4/+9
| | | | | | | | | | | | | | | | Another corner case: struct foo6_1 { char x; short p:8; short :0; short :0; short p2:8; char y; }; In MS layout the second anon :0 bit-field does _not_ adjust size or alignment of the struct again. The first one does, though.
* bitfields: fix PCC layoutMichael Matz2016-12-151-23/+28
| | | | | Fixes some corner cases in PCC layout. Testcases coming up.
* bitfields: Implement MS compatible layoutMichael Matz2016-12-151-7/+30
| | | | | | | | Bit-fields are layed out differently in visual C, this implements a compatible mode. Checked against Visual C/C++ 2016. Unfortunately the GCC implementation of MS layout (behind -mms-bitfields) actually is different, and hence not compatible with MS in all cases :-/
* Fix struct layout some moreMichael Matz2016-12-152-40/+199
| | | | | | Anonymous sub-sub-members weren't handled correctly. Bit-fields neither: this implements PCC layout for now. It temporarily disables MS-compatible bit-field layout.
* Split off record layoutingMichael Matz2016-12-152-82/+114
| | | | | | | | | | | Such struct decl: struct S { char a; int i;} __attribute__((packed)); should be accepted and cause S to be five bytes long (i.e. the packed attribute should matter). So we can't layout the members during parsing already. Split off the offset and alignment calculation for this.