Commit Graph

39 Commits

Author SHA1 Message Date
Vlad Vissoultchev
5175b1ad87 Use proper ifdef for x64 check in winnt.h 2016-03-14 18:07:38 +02:00
Vlad Vissoultchev
d715ebdae0 Add x64 SEH decls. Add exports to kernel32.def 2016-03-13 04:23:15 +02:00
Vlad Vissoultchev
95aac21130 Move WIN32_LEAN_AND_MEAN to windows.h (silence redeclarations) 2016-03-13 04:21:23 +02:00
Avi Halachmi (:avih)
9d33388b29 win: libm: add implementation for round/fmin/fmax and variants
round and fmin/fmax are relatively commonly used functions but were not
implemented anywhere in the tcc Windows distribution package. Newer mingw(64)
math.h stil doesn't include these implementations.

Add C implementations for these functions and place it as inline functions at
win32/include/tcc/tcc_libm.h - which is already included from math.h .

The code is mostly taken from musl-libc rs-1.0 (MIT) [*],

musl-libc: http://git.musl-libc.org/cgit/musl/tree/src/math?h=rs-1.0
license:   http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT?h=rs-1.0

Potential enhancements:
- Check how many useful libm implementations are still missing and consider
  adding them (some of them already work via the MS runtime).
- Consider putting libm implementations in an actual libm.a file, or add a dummy
  one such that build processes which try to link with libm will not fail.
2015-11-07 22:31:57 +02:00
Avi Halachmi (:avih)
9c52ba48b3 win: math.h: fix fpclassify/signbit/etc - use C instead of broken asm
The asm code cannot currently be used with tcc since tcc doesn't support 't'
constraint.

Use inline C implementation instead, place it win32/include/tcc/tcc_libm.h, and
include it from win32/include/math.h.

Since fpclassify now works, it also fixes few other macros which depend on it.
Implicitly fixed: isfinite, isinf, isnan, isnormal.

The implementations were taken from musl-libc rs-1.0 (MIT license).

musl-libc: http://git.musl-libc.org/cgit/musl/tree/src/math?h=rs-1.0
license:   http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT?h=rs-1.0
2015-11-07 22:18:46 +02:00
Avi Halachmi (:avih)
6e261a107c win: math.h: isnan: use macro, similar to others (still broken)
It was broken due to tcc not able to compile asm with 't' constraint, and it's
still broken because fpclassify on which it now depends has the same issue. Next
commit will fix this.
2015-11-07 22:17:21 +02:00
Avi Halachmi (:avih)
7307a6a3cb Revert "win32/include/math.h: remoing a "t" modifier usage"
This reverts commit 45bc505968.

The new asm code did not work as expected. Coordinated with seiko.
2015-11-07 21:30:56 +02:00
seyko
45bc505968 win32/include/math.h: remoing a "t" modifier usage
replaced by loading a float argument from memory and
    using the "m" modifier
2015-11-05 14:27:41 +03:00
seyko
00ba4b7625 win32: UUID typedef added 2015-09-25 03:42:44 +03:00
seyko
101cc8747f win32/include/winapi changes from https://github.com/run4flat/tinycc.git
just for testing. Is it needed? I'm not a MSYS citizen.

        run4flat is a tcc fork by David Mertens that knows how to work with
        multiple symbol tables. Excelent work. A good descriptions of the
        tcc internals inside a code comments.
2015-05-14 01:27:46 +03:00
seyko
7b96ddd045 win32/include/winsock2.h (look previous commit) 2015-03-03 22:45:50 +03:00
seyko
351e2ec334 add declaration of the "double trunc (double _x)" and winsock2.h
This allow to build a windows version of the nimrod compiler.
2015-03-03 22:41:55 +03:00
seyko
4b61f7f04b A lrint functions in win32/include/math.h are rewrittem because tcc can't handle "t" constraint 2015-03-03 22:38:31 +03:00
minux
5f7cdd29b6 win32/include/process.h: update prototypes to match mingw.
This eliminates an argument type mismatch warning during tcc
self-compilation on windows.
2014-04-12 00:09:57 -04:00
grischka
fbc8810334 Fix "Add support for struct > 4B returned via registers"
- avoid assumption "ret_align == register_size" which is
  false for non-arm targets
- rename symbol "sret" to more descriptive "ret_nregs"

This fixes commit dcec8673f2

Also:
- remove multiple definitions in win32/include/math.h
2013-12-16 15:38:10 +01:00
grischka
73faaea227 i386-gen: preserve fp control word in gen_cvt_ftoi
- 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 8a81f9e103
  winapi: add missing WINAPI decl. for some functions
2013-08-28 22:55:05 +02:00
Urs Janssen
0bdbd49eac add version number to manpage
avoid c++/c99 style comments in preprocessor directives
avoid leadings whitespaces in preprocessor directives
mention implemented variable length arrays in documentation
fixed ambiguous option in texi2html call (Austin English)
2013-02-17 00:48:51 +01:00
grischka
8042121d74 tcc -vv/--print-search-dirs: print more info
tests/Makefile:
- print-search-dirs when 'hello' fails
- split off hello-run

win32/include/_mingw.h:
- fix for compatibility with mingw headers
  (While our headers in win32 are from mingw-64 and don't have
  the problem)

tiny_libmaker:
- don't use "dangerous" mktemp
2013-02-10 00:38:40 +01:00
grischka
b89793d10a win32: _mingw.h: do not undef NULL
Not wise if stddef.h was already included. This is related to commit

    3aa26a794e

Instead hack stddef.h to have identical definition and thus
avoid the issue mentionned there.
2013-01-24 19:49:58 +01:00
grischka
2daf8b96a8 Revert mistake in "win32: malloc.h: fix win32 ... _STATIC_ASSERT"
from commit fc574f1498.

The files from include are copied to win32/include with make
install or build-tcc.bat.
2013-01-14 18:41:36 +01:00
Roy
fc574f1498 win32: malloc.h: fix win32 tcc-tcc complication by correcting _STATIC_ASSERT, ideas from mingw-w64 changeset 4293
stdarg.h, stddef.h: _mingw.h needs them
2012-12-31 08:59:50 +08:00
grischka
7b573dc239 win32/include: enable _timezone etc variables.
which live in msvcrt.dll and need __declspec(import) which
works by now.

Also:
- _mingw.h: conditionally define WIN32_LEAN_AND_MEAN
- malloc.h: don't undef alloca
2011-07-11 18:44:47 +02:00
grischka
9228842fa7 win32: register SEH in startup code (i386 only)
Needed to handle signal() etc. with msvcrt
2010-10-19 13:15:06 +02:00
grischka
e6f43dd0c6 win32: sys/timeb.h use _ftime instead of _ftime32 2010-04-12 20:56:13 +02:00
grischka
3aa26a794e win32: adjust for mingw32 winapi packages
Note: the files in tcc/win32/include/winapi are now from the
mingw-w64 project, however with this fix using mingw32 winapi
should still work.
2010-01-26 22:18:03 +01:00
grischka
e20bf69ac5 win64: defined size_t and ptrdiff_t to unsigned long long 2010-01-14 20:59:43 +01:00
grischka
b0abcfde9d win32: cleanup include 2010-01-14 20:59:43 +01:00
grischka
cda8c41ef3 win32: add size_t to _mingw.h 2009-12-20 01:54:38 +01:00
grischka
50b040ef83 win64: add tiny unwind data for setjmp/longjmp
This enables native unwind semantics with longjmp on
win64 by putting an entry into the .pdata section for
each compiled fuction.

Also, the function now use a fixed stack and store arguments
into X(%rsp) rather than using push.
2009-12-20 01:54:37 +01:00
grischka
d79b867d55 win64: adjust for two args with setjmp(buf,ctx) 2009-12-19 22:16:17 +01:00
grischka
720a32ede4 win32: remove #define alloca from mingw headers 2009-12-01 17:58:39 +01:00
grischka
dc251a7d8d win64: use new headers from mingw 2009-07-18 22:06:37 +02:00
grischka
ec4a350620 win32: guard va_list typedef 2009-06-17 02:11:40 +02:00
grischka
110a4edc15 drop alloca #define
(Because GNU's alloca.h unconditionally #undef's alloca)

Also, remove gcc specific sections in headers. and
instead change tests such that gcc does not use them.
2009-05-16 22:30:13 +02:00
grischka
2eaa1104f7 Checkin tiny_libmaker (ar replacement) by Timovj Lahde 2008-03-08 19:55:47 +00:00
grischka
d778bde7f9 Import more changesets from Rob Landley's fork (part 2) 2007-11-21 17:16:31 +00:00
bellard
debf0234cc added DECLARE_STDCALL_P (grischka) 2005-04-17 13:13:54 +00:00
bellard
5556cf1565 dos2unix 2005-04-17 13:10:37 +00:00
bellard
4821702fb4 win32 merge 2005-04-14 23:49:21 +00:00