grischka
74a24d77fd
libtcc: minor adjustments
...
- use {B} to substitute tcc_lih_path (instead of \b)
- expand CONFIG_TCC_CRTPREFIX in CONFIG_TCC_LIBPATHS
which fixes duplicate CONFIG_SYSROOT.
- put default CONFIG_SYSROOT ("") into tcc.h
- remove hack from commit db6fcce78f
because $(tccdir)/include is already in sysincludes
- configure: error out for unrecognized options.
- win32/build-tcc.bat: put libtcc into base dir where it will
find lib/include automatically, and build libtcc_test example.
2011-08-11 16:55:30 +02:00
grischka
e844fb11c2
libtcc: support more than one crtprefix
...
Looks like gcc has that. Oh Deer!
2011-08-06 16:49:30 +02:00
grischka
e6f3bf7f08
libtcc: cleanup the 'gen_makedeps' stuff
2011-08-06 16:11:58 +02:00
grischka
39a07cca58
tcc: fix -m32/64 & simplify
...
This cleans up the mess from commit
8f98573658
and preceeding.
- make tcc -m64 work on windows
- execvp on windows returns 0 always, replace by spawnvp
- remove bizarre support for i386-win32-tcc -m64
2011-08-06 16:11:58 +02:00
grischka
5e5e29f8fd
tcctest: switch weak_toolate proto with impl
...
gcc -O0 didn't like this.
2011-08-06 16:11:57 +02:00
grischka
f115c12346
x86-64: fix flags and zero-pad long doubles
...
This fixes a bug introduced in commit
8d107d9ffd
that produced wrong code because of interference between
0x10 bits VT_CONST and x86_64-gen.c:TREG_MEM
Also fully zero-pad long doubles on x86-64 to avoid random
bytes in output files which disturb file comparison.
2011-08-06 16:11:56 +02:00
grischka
81cd0cf6fd
configure: add switches to set search paths
...
--sysincludepaths=.. specify system include paths, colon separated"
Sets CONFIG_TCC_SYSINCLUDEPATHS
--libpaths=... specify system library paths, colon separated"
Sets CONFIG_TCC_LIBPATHS
--crtprefix=... specify location of crt?.o"
Sets CONFIG_TCC_CRTPREFIX
--elfinterp=... specify elf interpreter"
Sets CONFIG_TCC_ELFINTERP
Also the CONFIG_TCC_XXX were renamed to make them look
more consistent.
Also move the elf_interp definitions to tcc.h.
2011-08-06 16:11:12 +02:00
grischka
df9cce24a8
Accept colon separated paths with -L and -I
...
This allows passing colon separated paths to
tcc_add_library_path
tcc_add_sysinclude_path
tcc_add_include_path
Also there are new configure variables
CONFIG_TCC_LIBPATH
CONFIG_TCC_SYSINCLUDE_PATHS
which define the lib/sysinclude paths all in one and can
be overridden from configure/make
For TCC_TARGET_PE semicolons (;) are used as separators
Also, \b in the path string is replaced by s->tcc_lib_path
(CONFIG_TCCDIR rsp. -B option)
2011-08-01 01:10:36 +02:00
grischka
d7d8458888
Revert "better constant handling for expr_cond"
...
It produced wrong code with one of my test projects.
This reverts commit cd3d1a45f3 .
2011-07-16 15:53:30 +02:00
grischka
adc80009c8
elf.h: define SHF_MERGE etc.
2011-07-14 19:35:20 +02:00
grischka
8d107d9ffd
win64: va_arg with structures
2011-07-14 19:24:53 +02:00
grischka
aa80e5b1ff
tccpe: cleanup ELFW() macros etc.
2011-07-14 19:23:04 +02:00
grischka
d483ab322f
tccrun: win32: improve exception handler
2011-07-14 19:11:12 +02:00
grischka
08083ddb21
tccrun: win32: improve rt_get_caller_pc
2011-07-14 19:11:11 +02:00
grischka
d59bd8be8e
tccrun: rt_printline: fix no-stabs case
2011-07-14 19:11:10 +02:00
grischka
af83993810
tccrun: improve rt_printline output format
...
Prefix line with "file:linenumber:" such that editors
can easily jump to the source location
2011-07-14 19:11:08 +02:00
grischka
df4c0892f3
tccrun: win64: add unwind function table for dynamic code
...
This works only when tcc.exe is compiled using MSC. MinGW does
something in the startup code that defeats it.
2011-07-14 19:09:49 +02:00
grischka
232650f8b3
tccgen: reset aligned attribute for next type
...
Basically, with:
typedef __attribute__((aligned(16))) struct _xyz {
...
} xyz, *pxyz;
we want the struct aligned but not the pointer.
FIXME: This patch is a hack, waiting for someone in the knowledge
of correct __attribute__ semantics.
2011-07-14 19:00:46 +02:00
grischka
5280293d6b
make: create native tcc from separate objects
...
This was already possible using
make NOTALLINONE=1
and is now the default.
To build as previously from one big source, use
make ONE_SOURCE=1
Cross compilers are still build from one source because using
separate objects requires separate build directories one per
platform which currently is not (yet) supported by the makefile.
We could probably use gnu-makeish target variables like
$(I386_CROSS): OUTDIR=build/i386
$(X64_CROSS): OUTDIR=build/x86-64
and so on ...
Also NEED_FLOAT_TYPES for arm-gen is removed. It was about
variables that are referenced from outside (libtcc, tccgen).
We could declare them in tcc.h (as with reg_classes) or have
them twice in arm-gen.c. I chose option 2.
2011-07-14 18:45:37 +02:00
grischka
45184e01d8
win32: add -Wl,--stack=xxx switch
...
For example:
$ tcc -Wl,--stack=4194309
which means 4 MB. Default is 1 MB.
2011-07-11 18:47:16 +02: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
c449ef2e1f
tcc-doc: remove obsolete '-o option must also be given'
2011-05-17 21:55:05 +02:00
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