grischka
5d55647a3c
tccpp: fix problem in preprocess_skip with empty #
...
for example:
#ifdef stuff
# /* some comment */
#endif
2011-03-06 19:13:12 +01:00
grischka
a3ebdd0aeb
tccpe: support leading underscore for symbols
...
To make this the default, enable this line in libtcc.c:tcc_new:
#if defined(TCC_TARGET_PE) && 0
s->leading_underscore = 1;
and then recompile tcc and also libtcc1.a
2011-02-13 17:44:12 +01:00
grischka
2775173d4d
fix crash with get_tok_str() in skip()
...
crash was triggered by numbers etc. as unexpected token, i.e.
everything that requires additional information with the token.
2011-02-04 20:23:43 +01:00
grischka
69fe7585a2
tiny_libmaker: strip leading directory to avoid buffer overrun
...
The arhdr.ar_name has 16 bytes. Long object names esp. with
leading directory were causing a buffer overrun which was
detected by glibc.
2010-12-04 16:56:58 +01:00
grischka
21c2a68aa0
tccelf/tcccoff: fix some type conversion warnings
2010-12-04 16:48:15 +01:00
grischka
86ffc48129
make: new lib/Makefile for libtcc1.a on more platforms
...
win32/64 cross-compilers now build libtcc1.a and install it
together with the windows headers in a 'win32' sub-directory
of TCCDIR.
2010-12-04 16:47:08 +01:00
grischka
f332bb3bca
tccpe: typedef unsigned int DWORD for cross compilers.
...
This fixes the i386-win32-tcc cross-compiler on x86-64 linux
platform.
I verified that it produces identical binaries for 'hello_win.exe'
and 'tcc.exe' (tcc compiled by itself) compared to the output of
the native tcc on windows.
2010-11-27 15:02:57 +01:00
grischka
9bd69bf49f
build: remove #include "config.h" from target dependent files
...
This is to make cross build of libtcc1.a easier.
2010-11-26 20:46:54 +01:00
grischka
c4eef48025
libtcc: fix s->include_stack_ptr used uninitialized in tcc_open
2010-11-26 20:46:50 +01:00
grischka
44e84bb22a
tccpp: fix token pasting ##
...
This patch takes advantage of new function tcc_open_bf
from previous commit.
2010-11-25 13:30:31 +01:00
grischka
e97bf88bad
libtcc: new function tcc_open_bf to create BufferedFile
...
Use it in:
- tcc_open
- tcc_compile_string
- tcc_define_symbol
- tcc_assemble_inline
2010-11-25 13:29:15 +01: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
a7fb00e887
tccmain: simplify option help
2010-09-08 19:13:36 +02:00
grischka
4ab4efd3a6
Revert "implemented C99 for loop with variable declaration"
...
This reverts commit 433ecdfc9d .
The patch breaks e.g. with
for ((i = 10); --i;);
In particular to check for a type decl. this is not sufficient:
if (tok < TOK_UIDENT) {
A future approach to c99 loop variables might instead use:
if (parse_btype(...)) {
plus refactor function decl() accordingly.
2010-08-21 13:39:12 +02:00
grischka
82c5edb31c
Avoid crash with "Avoid a crash with weak symbols for "make test""
...
This fixes commit 197a6acb30
which fixed commit 95b9a477b6
Also remove useless example files
2010-06-30 20:25:04 +02:00
grischka
3ba37e1e3f
tccgen: Revert yuanbin's recent patches
...
This reverts commits 670993..d35138
Maybe these commits fixed something but also seemed to cause problems.
2010-06-21 18:21:44 +02:00
grischka
632ee5a540
Revert "Complain for static fct declared w/o file scope"
...
This reverts commit e9406c09a3 .
We don't want errors for static local function pointers, such as:
{
static void (*fn)();
...
}
2010-06-15 17:03:23 +02:00
grischka
10b4802869
Fix "Fix bashims in configure ..." for MSYS
...
Fixes commit dc265feb63
2010-06-15 17:02:35 +02:00
grischka
5fcd1fef1c
Fix last commits: remove CRLF, chmod 644 tccgen.c
2010-06-15 17:02:09 +02:00
grischka
d2cf970a41
tccelf: fix warning
2010-04-13 18:30:01 +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
a40814cc9d
tccpp: signal missing #endif error
2010-01-14 21:00:05 +01:00
grischka
4e5170d4a5
tccpp: convert TOK_GET macro into function
2010-01-14 20:59:44 +01:00
grischka
280e20b1d3
tccpp: warn about #define redefinition
2010-01-14 20:59:44 +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
5299142286
x86-64: use uplong for symbol values
2010-01-14 20:59:42 +01:00
grischka
2341ee5142
tccpe: improve dllimport/export and use for tcc_add_symbol
2010-01-14 20:59:42 +01:00
grischka
bdb9387a74
win32: readme: add libtcc_test example
2010-01-14 20:59:41 +01:00
grischka
903b6001e7
update Makefiles
2009-12-20 20:34:35 +01:00
grischka
0de95730ad
build from multiple objects: fix other targets
2009-12-20 20:33:41 +01:00
grischka
b54862406e
x86-64: fix gtst, back to only 5 regs for now
2009-12-20 20:33:21 +01:00
grischka
070b86a870
x86-64: use r8/r9 as generic integer registers
2009-12-20 02:19:51 +01:00
grischka
0e5c0ee045
x86-64: use r8,r9 as load/store registers
2009-12-20 01:54:39 +01:00
grischka
cda8c41ef3
win32: add size_t to _mingw.h
2009-12-20 01:54:38 +01:00
grischka
4a01eb09d8
use vpushv in some places
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
88a3ccab9f
allow tcc be build from separate objects
...
If you want that, run: make NOTALLINONE=1
2009-12-20 01:53:49 +01:00
grischka
7fa712e00c
win32: enable bounds checker & exception handler
...
exception handler borrowed from k1w1. Thanks.
2009-12-19 22:22:43 +01:00
grischka
8bbde91f62
tcc_relocate: revert to 0.9.24 behavior
2009-12-19 22:16:23 +01:00
grischka
3db219477a
tccrun: new file
...
factor out -run support
2009-12-19 22:16:22 +01:00
grischka
41e112360f
fix uninitialized warnings with 'type.ref'
2009-12-19 22:16:22 +01:00
grischka
3020a4765d
tccpe: with -l try also with "lib" prefix
...
-lfoo searches: foo.def, libfoo.def, foo.dll, libfoo.dll
2009-12-19 22:16:21 +01:00
grischka
94bf4d2c22
tccpe: improve dllimport
2009-12-19 22:16:21 +01:00
grischka
1308e8ebcf
integrate x86_64-asm.c into i386-asm.c
...
Also, disable 16bit support for now as it causes bugs
in 32bit mode. #define I386_ASM_16 if you want it.
2009-12-19 22:16:20 +01:00
grischka
e81569bc70
tcc: add "-Wl,-rpath=path" option (library search path)
2009-12-19 22:16:20 +01:00
grischka
dd3d4f7295
x86-64: fix udiv, add cqto instruction
2009-12-19 22:16:19 +01:00
grischka
1445fea582
tccpe: allow linkage to extern symbols from asm
2009-12-19 22:16:18 +01:00
grischka
b5e2238483
tccasm: make VT_VOID symbols ST_NOTYPE, elf-wise
...
This was confusing objdump such that it did not print
disassembly with -d.
Also, put filename as with C compilation
2009-12-19 22:16:18 +01:00
grischka
ab4a4ab25e
x86-64: in gv(): ignore second register
2009-12-19 22:16:17 +01:00
grischka
d79b867d55
win64: adjust for two args with setjmp(buf,ctx)
2009-12-19 22:16:17 +01:00
grischka
e500c9118a
i386-asm: fix imul
...
With imul the 3rd operand defaults to the 2nd on. The previous
logic left 'op_type[2]' uninitialized which caused the bug to
show up only sometimes.
2009-12-06 17:41:22 +01:00
grischka
56d6abdb3d
tccgen: propagate alignment from typedef
...
Store (part of) the AttributeDef structure in the (int)sym-r
field of the typedef symbol (kludgy).
2009-12-06 17:37:33 +01:00
grischka
720a32ede4
win32: remove #define alloca from mingw headers
2009-12-01 17:58:39 +01:00
grischka
679f0794f8
win32: explain usage of mingw w32api package
2009-11-30 17:14:41 +01:00
grischka
a5279b2c05
tccpe: fclose FILE*
...
Reported by Martin Ettl (thanks)
2009-11-30 17:14:37 +01:00
grischka
a26bf10de3
win64: Use tcc's own assembler
...
Now that we have it thanks to Mr. Féret
2009-11-21 23:43:38 +01:00
grischka
50055880f9
asm 32/64: replace (long)sym->next by sym->jnext
2009-11-21 23:43:30 +01:00
grischka
1383055b17
x86_64: fix asm
2009-11-14 21:48:37 +01:00
grischka
0a3bcb57f6
fix 32bit asm
...
The new 16bit code was causing wrong 0x66 prefixes
in 32bit code.
The fix possibly breaks the feature on 16bit asm.
2009-11-14 20:05:22 +01:00
grischka
5b113f3ee3
win32: handle __declspec(dllimport)
2009-11-13 18:04:56 +01:00
grischka
dd70d19267
#define __TINYC__ = version-number
2009-11-13 17:11:52 +01:00
grischka
834b782a9c
tccpe: fill checksum header field
2009-08-24 13:30:02 +02:00
grischka
569c20f104
tccpp: fix quirk with cached headers and #else
...
Such as with
#ifndef FOO_H
...
#else
...
#endif
2009-08-24 13:30:01 +02:00
grischka
1026ca5888
fix "symbol not defined" if symbol has offset 0
2009-08-24 13:30:01 +02:00
grischka
d923e652f2
tccpp: avoid double free with macro_ptr_allocated (after errors)
2009-08-24 13:30:00 +02:00
grischka
0d34c2136e
tccgen: free inline functions correctly
2009-08-24 13:30:00 +02:00
grischka
697f9e305d
win64: fix bat
2009-08-24 13:28:02 +02:00
grischka
b08dfb8273
tcc: optionally build using libtcc
2009-07-18 22:08:01 +02:00
grischka
f88350b611
fix some warning
2009-07-18 22:07:51 +02:00
grischka
c998985c74
cleanup: constify some global data
2009-07-18 22:07:42 +02:00
grischka
94ae3984b0
tccpe: set tcc_lib_path from DLL
2009-07-18 22:07:33 +02:00
grischka
1df662c1b0
tccpe: load dll on the fly
2009-07-18 22:07:25 +02:00
grischka
9fda4f4248
win32: treat long double as double
2009-07-18 22:07:17 +02:00
grischka
97738d1ae9
win32: reformat examples, crt etc
2009-07-18 22:07:10 +02:00
grischka
bb5e0df79a
x86-64: fix load() for const pointers: (void*)-2
2009-07-18 22:07:03 +02:00
grischka
fc977d56c9
x86-64: chkstk, alloca
2009-07-18 22:06:54 +02:00
grischka
c0fc0fa0c4
win64: add x64 target to build-tcc.bat
2009-07-18 22:06:46 +02:00
grischka
dc251a7d8d
win64: use new headers from mingw
2009-07-18 22:06:37 +02:00
grischka
06aed3d171
win64: update tiny_impdef, tiny_libmaker (Elf64)
2009-07-18 22:06:14 +02:00
grischka
09ac9faf59
win64: align jmp_buf
2009-07-18 22:06:07 +02:00
grischka
035918ef2f
win64: fix pointer <-> unsigned long typecast issues
2009-07-18 22:05:58 +02:00
grischka
459875796b
pe32+ target: adjust x86_64-gen.c
...
- calling conventions are different:
* only 4 registers
* stack "scratch area" is always reserved
* doubles are mirrored in normal registers
- no GOT or PIC there
2009-07-18 22:05:49 +02:00
grischka
3ba1532cfb
pe32+ target: add to makefile
2009-07-18 22:05:40 +02:00
grischka
3ea4acb9b9
pe32+ target: add in various #define's
2009-07-18 22:05:27 +02:00
grischka
719ba918dd
tccpe: use more official structs
2009-07-18 21:55:32 +02:00
grischka
f366cb20fe
tccpe: support pe32+ (x86_64) target
2009-07-18 21:55:28 +02:00
grischka
fe8def3303
tccpe: use ElfW macros
2009-07-18 21:55:25 +02:00
grischka
dcfad3af49
tccpe: get rid of kludgy export-symbol sort
2009-07-18 21:55:20 +02:00
grischka
370cdeb628
tccpe: build IAT vector with with -run too
...
This prepares for x86_64 where we need the vector
for far jumps. Also, resolve DLL symbols in place
2009-07-18 21:55:15 +02:00
grischka
bed17847bd
cleanup: stop abuse of sym->c for #define tokenstreams
2009-07-18 21:55:10 +02:00
grischka
d0b432ab38
cleanup: stop abuse of sym->r for inline functions
2009-07-18 21:55:06 +02:00
grischka
5e83b64dae
cleanup: put prototypes in front of libtcc.c
2009-07-18 21:55:02 +02:00
grischka
85e481b66e
pp: return newline after directive
2009-07-18 21:54:58 +02:00
grischka
fcdb663dde
pp: simplify pasting, enable L ## number
2009-07-18 21:54:55 +02:00
grischka
045cff28fe
fix asmtest (somehow), update Makefiles
2009-07-18 21:54:51 +02:00
grischka
0085c648f6
bcheck: restore malloc hooks when done
2009-07-18 21:54:47 +02:00
grischka
c93ddac9aa
configure: support DESTDIR for RPM packagers etc.
...
Suggested by Shlomi Fish
2009-07-18 21:54:43 +02:00
grischka
ec4a350620
win32: guard va_list typedef
2009-06-17 02:11:40 +02:00