aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Ignore abitest-cc and abitest-tcc test programsThomas Preud'homme2014-02-021-0/+1
|
* Test long long to float conversionsThomas Preud'homme2014-02-011-0/+8
|
* Move result of itof double conv back to VFP regThomas Preud'homme2014-02-012-0/+10
| | | | | | | | | | | EABI functions to convert an int to a double register take the integer value in core registers and also give the result in core registers. It is thus necessary to move the result back to VFP register after the function call. This only affected integer to double conversion because integer to float conversion used a VFP instruction to do the conversion and this obviously left the result in VFP register. Note that the behavior is left untouched for !EABI as the correct behavior in this case is unknown to the author of this patch.
* Ordinary and implicit rules cannot be mixed in the same string in MakefileIavael2014-01-231-1/+1
|
* tcctest: add back testXb (self compile with -b)grischka2014-01-213-21/+25
| | | | | | | | | | | | | | | | | | - Thanks to Kirill "tcc -b itself" should work now (was removed in d5f4df09ff4a84dda5b03525285f03be7723376b) Also: - tests/Makefile: - fix spurious --I from 767410b8750b45d63805b45ca1a2cf34d7cb4923 - lookup boundtest.c via VPATH (for out-of-tree build) - test[123]b?: fail on diff error - Windows: test3 now works (from e31579b0769e1f9c0947d12e83316d1149307b1a) - abitest: a libtcc.a made by gcc is not usable for tcc on WIndows - using source instead (libtcc.c) - tccpe: - avoid gcc warning (x86_64)
* workaround a wine cmd bug in build-tcc.batAustin English2014-01-201-1/+1
|
* tccrun: Mark argv area as valid for bcheckKirill Smelkov2014-01-191-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On my x86_64 box in i386 mode with address space randomization turned off, I've observed the following: tests$ ../tcc -B.. -b -run boundtest.c 1 Runtime error: dereferencing invalid pointer boundtest.c:222: at 0x808da73 main() With diagnostic patch (like in efd9d92b "lib/bcheck: Don't assume heap goes right after bss") and bcheck traces for __bound_new_region, __bound_ptr_indir, etc... here is how the program run looks like: >>> TCC etext: 0x8067ed8 edata: 0x807321d end: 0x807d95c brk: 0x807e000 stack: 0xffffd0b4 &errno: 0xf7dbd688 mark_invalid 0xfff80000 - (nil) mark_invalid 0x80fa000 - 0x100fa000 new 808fdb0 808ff40 101 101 fd0 ff0 new 808ff44 808ff48 101 101 ff0 ff0 new 808ff49 8090049 101 101 ff0 1000 new 808fd20 808fd29 101 101 fd0 fd0 new 808fd2c 808fd6c 101 101 fd0 fd0 new 808fd6d 808fda0 101 101 fd0 fd0 E: __bound_ptr_indir4(0xffffd184, 0x4) Runtime error: dereferencing invalid pointer boundtest.c:222: at 0x808ea83 main() So we are accessing something on stack, above stack entry for compiled main. Investigating with gdb shows that this is argv: tests$ gdb ../tcc Reading symbols from /home/kirr/src/tools/tinycc/tcc...done. (gdb) set args -B.. -b -run boundtest.c 1 (gdb) r Starting program: /home/kirr/src/tools/tinycc/tests/../tcc -B.. -b -run boundtest.c 1 warning: Could not load shared library symbols for linux-gate.so.1. Do you need "set solib-search-path" or "set sysroot"? >>> TCC etext: 0x8067ed8 edata: 0x807321d end: 0x807d95c brk: 0x807e000 stack: 0xffffd074 &errno: 0xf7dbd688 mark_invalid 0xfff80000 - (nil) mark_invalid 0x80fa000 - 0x100fa000 new 808fdb0 808ff40 101 101 fd0 ff0 new 808ff44 808ff48 101 101 ff0 ff0 new 808ff49 8090049 101 101 ff0 1000 new 808fd20 808fd29 101 101 fd0 fd0 new 808fd2c 808fd6c 101 101 fd0 fd0 new 808fd6d 808fda0 101 101 fd0 fd0 E: __bound_ptr_indir4(0xffffd144, 0x4) Program received signal SIGSEGV, Segmentation fault. 0x0808ea83 in ?? () (gdb) bt #0 0x0808ea83 in ?? () #1 0x080639b3 in tcc_run (s1=s1@entry=0x807e008, argc=argc@entry=2, argv=argv@entry=0xffffd144) at tccrun.c:132 #2 0x080492b0 in main (argc=6, argv=0xffffd134) at tcc.c:346 (gdb) f 1 #1 0x080639b3 in tcc_run (s1=s1@entry=0x807e008, argc=argc@entry=2, argv=argv@entry=0xffffd144) at tccrun.c:132 132 ret = (*prog_main)(argc, argv); 132 ret = (*prog_main)(argc, argv); (gdb) p argv $1 = (char **) 0xffffd144 So before running compiled program, mark argv as valid region and we are done - now the test passes. P.S. maybe it would be better to just mark the whole vector kernel passes to program (argv, env, auxv, etc...) as valid all at once...
* Fixed the LDBL_* macros in include/float.h for x86-64: as saidVincent Lefevre2014-01-121-1/+1
| | | | | | when x86-64 support was added, "for long double, we use x87 FPU". And indeed, tests show that Intel's extended precision is used, not double precision.
* Revert "Use anonymous file instead of regular file to back mmap"Iavael2014-01-121-5/+12
| | | | | | This reverts commit 935d8169b8e3570f1a5e726c5295be2f460c1540, because two anonymous mappings would have different content, while they must have the same one.
* tcctest: One more signed zero testMichael Matz2014-01-121-0/+6
| | | | This also checks that -(-0.0) is +0.0.
* Fix floating point unary minus and plusMichael Matz2014-01-122-17/+45
| | | | | | | negate(x) is subtract(-0,x), not subtract(+0,x), which makes a difference with signed zeros. Also +x was expressed as x+0, in order for the integer promotions to happen, but also mangles signed zeros, so just don't do that with floating types.
* Fix compile on ARM non-eabi and non-vfpMichael Matz2014-01-111-1/+1
| | | | Adjust arm_init prototype to match declaration.
* Fix Fixes for PE x86_64 for fail in codeMichael Matz2014-01-111-27/+20
| | | | | | | Applying 64bit relocs assumes that the CVal is initialized to zero for the whole 64bit. Consolidate this a bit, at the same time zeroing the .ull member more consistently when needed. Fixes segfault on x86_64-linux using global vars in tcctest.c.
* Fix missing mem_size assignment when using mmap()keren2014-01-101-0/+2
|
* Fixes previous fixesArchidemon2014-01-101-5/+5
|
* Fixes for PE x86_64 for fail in codeArchidemon2014-01-101-3/+15
| | | | | | | | | | | | int (*fn1)=0x13fde16b5; and int fn1(int a) {...} struct { int (*fn2)(int a); } b = { fn1 };
* Use anonymous file instead of regular file to back mmapkeren2014-01-091-14/+5
| | | | Signed-off-by: Keren Tan <tankeren@gmail.com>
* Various Makefile fixes for cross-compilationThomas Preud'homme2014-01-092-5/+19
| | | | | | - Build libtcc1 for cross-compiler on arm (arm to X cross compilers) - Install libtcc1 and includes for arm to i386 cross compiler - Add basic check of cross-compilers (compile ex1.c)
* Remove WITHOUT_LIBTCC macro: no more userThomas Preud'homme2014-01-081-3/+1
|
* Use GNU triplet prefix for cross tcc compilersThomas Preud'homme2014-01-082-25/+34
| | | | | Compatibility symlinks are put in place in case some script were relying on former names except for CMake since it was added after last release.
* Shared libraries also have entry pointsThomas Preud'homme2014-01-081-1/+1
| | | | This fix commit 32734680cb2a645d48f806edae5a5912e0759a23
* Improve ELF on ARMThomas Preud'homme2014-01-081-1/+7
| | | | | * set whether soft or hardfloat calling convention is used * mark ELF file has having an entry point when there is
* Update elf.hThomas Preud'homme2014-01-082-1094/+2479
|
* Add support for runtime selection of float ABIThomas Preud'homme2014-01-087-70/+113
|
* Explicit that EABI only supports VFP for nowThomas Preud'homme2014-01-072-5/+3
|
* Don't say compiler flags are warning optionsThomas Preud'homme2014-01-071-1/+1
|
* fixed permissions for install on UnixVincent Lefevre2014-01-071-3/+3
| | | | Signed-off-by: Vincent Lefevre <vincent@vinc17.net>
* be stricter with aliasinggrischka2014-01-076-89/+92
| | | | | | | | | | | | | | Refactoring (no logical changes): - use memcpy in tccgen.c:ieee_finite(double d) - use union to store attribute flags in Sym Makefile: "CFLAGS+=-fno-strict-aliasing" basically not necessary anymore but I left it for now because gcc sometimes behaves unexpectedly without. Also: - configure: back to mode 100755 - tcc.h: remove unused variables tdata/tbss_section - x86_64-gen.c: adjust gfunc_sret for prototype
* misc. fixesgrischka2014-01-0610-54/+46
| | | | | | | | | | | | | | | | | | | | | | - tccgen: error out for cast to void, as in void foo(void) { return 1; } This avoids an assertion failure in x86_64-gen.c, also. also fix tests2/03_struct.c accordingly - Error: "memory full" - be more specific - Makefiles: remove circular dependencies, lookup tcctest.c from VPATH - tcc.h: cleanup lib, include, crt and libgcc search paths" avoid duplication or trailing slashes with no CONFIG_MULTIARCHDIR (as from 9382d6f1a0e2d0104a82ed805207d9e742c6b068) - tcc.h: remove ";{B}" from PE search path in ce5e12c2f950052d8109b6b7a56d900547705c08 James Lyon wrote: "... I'm not sure this is the right way to fix this problem." And the answer is: No, please. (copying libtcc1.a for tests instead) - win32/build_tcc.bat: do not move away a versioned file
* tccpe: cleanup "imports per ordinal"grischka2014-01-063-143/+33
| | | | | | | - tccpe.c: avoid conflict with imp_sym->st_value, cleanup - _parseLibs.bat, _tcc.bat: no instructions for usage, removed. from commit 642b6d0f50c6b6a842c9239a102fe34d5619e931
* i386: use __fixdfdi instead of __tcc_cvt_ftolgrischka2014-01-066-80/+84
| | | | | | | | | | | | Variants __fixsfdi/__fixxfdi are not needed for now because the value is converted to double always. Also: - remove __tcc_fpinit for unix as it seems redundant by the __setfpucw call in the startup code - avoid reference to s->runtime_main in cross compilers - configure: fix --with-libgcc help - tcctok.h: cleanup
* Fix struct ret in variadic fct with ARM hardfloatThomas Preud'homme2014-01-067-23/+35
| | | | | | | | | | | | | The procedure calling standard for ARM architecture mandate the use of the base standard for variadic function. Therefore, hgen float aggregate must be returned via stack when greater than 4 bytes and via core registers else in case of variadic function. This patch improve gfunc_sret() to take into account whether the function is variadic or not and make use of gfunc_sret() return value to determine whether to pass a structure via stack in gfunc_prolog(). It also take advantage of knowing if a function is variadic or not move float result value from VFP register to core register in gfunc_epilog().
* Don't call __tcc_fpinit if using libgccThomas Preud'homme2014-01-061-0/+2
|
* Don't enable bound check if libgcc is usedThomas Preud'homme2014-01-062-2/+3
| | | | | Bound check rely on some functions provided by libtcc. It should therefore not be enabled when libgcc is used.
* Relicensing TinyCCDaniel Glöckner2014-01-041-0/+1
| | | | | I'm fine with relicensing all my contributions to files other than arm-gen.c.
* Move logic for if (int value) to tccgen.cThomas Preud'homme2014-01-046-118/+37
| | | | | | | Move the logic to do a test of an integer value (ex if (0)) out of arch-specific code to tccgen.c to avoid code duplication. This also fixes test of long long value which was only testing the bottom half of such values on 32 bits architectures.
* Update Changelog from git changelog entriesThomas Preud'homme2014-01-041-1/+63
|
* Relicensing TinyCCDaniel Glöckner2014-01-041-1/+1
|
* Fix negation of 0.0 and -0.0Thomas Preud'homme2014-01-041-2/+15
|
* Provide install-strip target in MakefileThomas Preud'homme2014-01-041-0/+3
|
* Use libtcc.a for static link even with USE_LIBGCCThomas Preud'homme2014-01-032-2/+7
| | | | | | | When statically linking, runtime library should be static as well. tcc could link with libgcc.a but it's in a gcc version specific directory. Another solution, followed by this patch, is to use libtcc.a when statically linking, even if USE_LIBGCC was configured.
* Report error on NaN comparisonThomas Preud'homme2014-01-032-4/+13
| | | | | | | | Use comisd / fcompp for float comparison (except TOK_EQ and TOK_NE) instead of ucomisd / fucompp to detect NaN comparison. Thanks Vincent Lefèvre for the bug report and for also giving the solution.
* Always set *palign in classify_x86_64_argThomas Preud'homme2014-01-031-0/+1
| | | | | | | Set *palign for VT_BITFIELD and VT_ARRAY types in classify_x86_64_arg as else you happen to have in *palign what was already there. This can cause gfunc_call on !PE systems to consider an array as 16 bytes align and trigger the assert if the previous argument was 16 bytes aligned.
* Fix "Add support for struct > 4B returned via registers"grischka2013-12-163-16/+31
| | | | | | | | | | | - avoid assumption "ret_align == register_size" which is false for non-arm targets - rename symbol "sret" to more descriptive "ret_nregs" This fixes commit dcec8673f21da86ae3dcf1ca3e9498127715b795 Also: - remove multiple definitions in win32/include/math.h
* make git ignore lib/arm directoryThomas Preud'homme2013-12-151-0/+1
|
* Fix signed integer division in ARM runtime ABIThomas Preud'homme2013-12-151-9/+21
| | | | | | | | - fix computation of absolute value (clearing the sign bit does not since integers are encoded in 2's complement) - test sign of integer in a more conventional way (binary and with the high bit does not work for long long due to a bug in gtst) - spacing in include
* Add ARM aeabi functions needed to run tcctestThomas Preud'homme2013-12-113-1/+509
| | | | | | | | | | | | Add implementation for float / integer conversion functions: __aeabi_d2lz, __aeabi_d2ulz, __aeabi_f2lz, __aeabi_f2ulz, __aeabi_l2d, __aeabi_l2f, __aeabi_ul2d, __aeabi_ul2f Add implementation for long long helper functions: __aeabi_ldivmod, __aeabi_uldivmod, __aeabi_llsl, __aeabi_llsr, __aeabi_lasr Add implementation for integer division functions: __aeabi_uidiv, __aeabi_uidivmod, __aeabi_idiv, __aeabi_idivmod,
* Support special calling convention for runtime ABIThomas Preud'homme2013-12-111-15/+34
| | | | | | | | Add infrastructure to support special calling convention for runtime ABI function no matter what is the current calling convention. This involve 2 changes: - behave as per base standard in gfunc_call - move result back in VFP register in gen_cvt_itof1
* Define __ARM_EABI__ and __ARMEL__ when applicableThomas Preud'homme2013-11-261-0/+4
|
* Make abitest.c have predictable resultThomas Preud'homme2013-11-251-2/+2
| | | | | | | | stdarg_test in abitest.c relies on a sum of some parameters made by both the caller and the callee to reach the same result. However, the variables used to store the temporary result of the additions are not initialized to 0, leading to uncertainty as to the results. This commit add this needed initialization.