aboutsummaryrefslogtreecommitdiff
path: root/lib/libtcc1.c
Commit message (Collapse)AuthorAgeFilesLines
* more minor fixesgrischka2017-05-071-112/+16
| | | | | | | | | | | | | | | | | | | | | | | | | * tccgen: re-allow long double constants for x87 cross sizeof (long double) may be 12 or 16 depending on host platform (i386/x86_64 on unix/windows). Except that it's 8 if the host is on windows and not gcc was used to compile tcc. * win64: fix builtin_va_start after VT_REF removal See also a8b83ce43a95fa519dacfe7690a3a0098af7909c * tcctest.c: remove outdated limitation for ll-bitfield test It always worked, there is no reason why it should not work in future. * libtcc1.c: exclude long double conversion on ARM * Makefile: remove CFLAGS from link recipes * lib/Makefile: use target DEFINES as passed from main Makefile * lib/armflush.c lib/va_list.c: factor out from libtcc1.c * arm-gen.c: disable "depreciated" warnings for now
* cross-compilers: allow individual configurationgrischka2017-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | since configure supports only native configuration a file 'cross-tcc.mak' needs to be created manually. It is included in the Makefile if present. # ---------------------------------------------------- # Example config-cross.mak: # # windows -> i386-linux cross-compiler # (it expects the linux files in <prefix>/i386-linux) ROOT-i386 = {B}/i386-linux CRT-i386 = $(ROOT-i386)/usr/lib LIB-i386 = $(ROOT-i386)/lib:$(ROOT-i386)/usr/lib INC-i386 = {B}/lib/include:$(ROOT-i386)/usr/include DEF-i386 += -D__linux__ # ---------------------------------------------------- Also: - use libtcc1-<target>.a instead of directories - add dummy arm assembler - remove include dependencies from armeabi.c/lib-arm64.c - tccelf/ld_add_file: add SYSROOT (when defined) to absolute filenames coming from ld-scripts
* Revert "partial revert of the commit 4ad186c5ef61"grischka2017-02-051-12/+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.
* libtcc1: Don't use stdlib functionsMichael Matz2016-12-151-3/+0
| | | | | | | | | | | libtcc1 is the compiler support library and therefore needs to function in a freestanding environment. In particular it can't just use fprintf or stderr, which it was on x86-64 (but only when compiled by GCC). The tight integration between libtcc1 and tcc itself makes it impossible to ever reach that case so the abort() there is enough. abort() is strictly speaking also not available in a freestanding environment, but it often is nevertheless.
* lib/libtcc1.c: cleanupgrischka2016-10-191-35/+15
| | | | | | | - remove #include dependencies from libtcc1.c for easier cross compilation - clear_cache only on ARM - error-message for mprotect failure
* lib/libtcc1.c: Replace "long" with "unsigned int" in union float_long.Edmund Grimley Evans2015-11-041-1/+1
|
* Correct prototype: void __clear_cache(void *, void *).Edmund Grimley Evans2015-10-151-2/+2
|
* Revert all of my changes to directories & codingstyle.gus knight2015-07-291-13/+13
|
* Trim trailing spaces everywhere.gus knight2015-07-271-13/+13
|
* x86-64: Fix stdarg for large non-float structsMichael Matz2015-03-091-4/+3
| | | | | | | | | | Some structs are passed in registers. When they need more than one the implementation of __va_arg on x86-64 didn't correctly account for this. This fixes only the cases where the structs consist of integer types, as there the register save area is consecutive. Fixes some tests from 73_arm64.c, but still leaves those failing that use floating point in the large-but-regpassed structs.
* partial revert of the commit 4ad186c5ef61seyko2015-03-041-0/+14
| | | | | | | | | | | | | | | A test program: /* result of the new version inroduced in 4ad186c5ef61: t2a = 44100312 */ #include<stdio.h> int main() { int t1 = 176401255; float f = 0.25f; int t2a = (int)(t1 * f); // must be 44100313 int t2b = (int)(t1 * (float)0.25f); printf("t2a=%d t2b=%d \n",t2a,t2b); return 0; }
* x86_64-tcc and libtcc1.c: size_t definition is needed for a x86_64-tcc to ↵seyko2015-03-031-1/+2
| | | | parse memset()
* New implementation of va_list/va_start/var_copy that do not use dynamic ↵mingodad2014-03-281-21/+9
| | | | memory, with this when compiling fossil-scm with tcc on linux X86_64 it works fine.
* Fix __clear_cache implementationThomas Preud'homme2014-03-111-1/+2
| | | | Forgot to give the parameters to syscall function, doh!
* Use intptr_t to cast pointerThomas Preud'homme2014-03-091-1/+3
|
* Undefine __va* in libtcc1 to avoid errors w/ clangThomas Preud'homme2014-03-091-0/+5
|
* Make condition in libtcc1 based on targetThomas Preud'homme2014-03-091-5/+5
| | | | | | Prior to this commit runtime library was compiled according to the host because of the macro used to detec what architecture to choose. This commit fixes this by using the TARGET_* macro instead.
* i386: use __fixdfdi instead of __tcc_cvt_ftolgrischka2014-01-061-18/+21
| | | | | | | | | | | | 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
* Add __clear_cache implementation in libtcc1Thomas Preud'homme2013-11-051-1/+23
| | | | Add __clear_cache function for flushing caches to libtcc1.
* libtcc1.c: Fix __asm__() in __tcc_fpinit and __tcc_cvt_ftolRamsay Jones2013-09-091-3/+3
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* i386-gen: preserve fp control word in gen_cvt_ftoigrischka2013-08-281-6/+17
| | | | | | | | | | | | | | | | | | | | | | | - Use runtime function for conversion - Also initialize fp with tcc -run on windows This fixes a bug where double x = 1.0; double y = 1.0000000000000001; double z = x < y ? 0 : sqrt (x*x - y*y); caused a bad sqrt because rounding precision for the x < y comparison was different to the one used within the sqrt function. This also fixes a bug where printf("%d, %d", (int)pow(10, 2), (int)pow(10, 2)); would print 100, 99 Unrelated: win32: document relative include & lib lookup win32: normalize_slashes: do not mirror silly gcc behavior This reverts part of commit 8a81f9e1036637e21a47e14fb56bf64133546890 winapi: add missing WINAPI decl. for some functions
* Fixed x86-64 long double passing.James Lyon2013-04-261-1/+3
| | | | | | long double arguments require 16-byte alignment on the stack, which requires adjustment when the the stack offset is not an evven number of 8-byte words.
* Sorted out CMake on x86-64 and fixed silly XMM# bug introduced when working ↵James Lyon2013-04-251-0/+7
| | | | | | | | | on Win64 stdargs. I removed the XMM6/7 registers from the register list because they are not used on Win64 however they are necessary for parameter passing on x86-64. I have now restored them but not marked them with RC_FLOAT so they will not be used except for parameter passing.
* Added cross compilation to CMake build system.James Lyon2013-04-251-7/+3
| | | | | Brings it more into line with make based system. I've tested on 32- and 64-bit Windows, but not yet Linux.
* Flush caches before -running programThomas Preud'homme2013-03-181-0/+11
| | | | | | | | | | | | On some architectures, ARM for instance, the data and instruction caches are not coherent with each other. This is a problem for the -run feature since instructions are written in memory, and are thus written in the data cache first and then later flushed to the main memory. If the instructions are executed before they are pushed out of the cache, then the processor will fetch the old content from the memory and not the newly generated code. The solution is to flush from the data cache all the data in the memory region containing the instructions and to invalidate the same region in the instruction cache.
* - document -dumpversionUrs Janssen2013-02-151-1/+1
| | | | - fixed a broken prototype
* configure: pass CONFIG_xxxDIR/PATH options via commandlinegrischka2013-02-141-1/+6
| | | | | | | | | | | | | | | - except for CONFIG_SYSROOT and CONFIG_TCCDIR Strictly neccessary it is only for CONFIG_MULTIARCHDIR because otherwise if it's in config.h it is impossible to leave it undefined. But it is also nicer not to use these definitions for cross-compilers. - Also: lib/Makefile : include ../Makefile for CFLAGS lib/libtcc1.c : fix an issue compiling tcc with tcc on x64
* Support struct arguments with stdarg.hShinichiro Hamaji2010-12-281-0/+79
| | | | | | | | - add __builtin_va_arg_types to check how arguments were passed - move most code of stdarg into libtcc1.c - remove __builtin_malloc and __builtin_free - add a test case based on the bug report (http://www.mail-archive.com/tinycc-devel@nongnu.org/msg03036.html)
* new subdirs: include, lib, testsgrischka2009-04-181-0/+607