aboutsummaryrefslogtreecommitdiff
path: root/tcc.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "--whole-archive support"grischka2016-10-011-1/+0
| | | | | | | | | | | | - would parse linker args in two different places - would mess up "tcc -v ..." output: tcc -v test.c -> test.c +> test.c - would use function "tcc_load_alacarte()" to do the contrary of what its name suggests. This reverts commit 19a169ceb896f78205bc23b847938c58f14d1dda.
* gtst_addr(): short conditional jumps (i386, x86_64)Pavlas, Zdenek2016-09-301-0/+5
|
* Rein in unintended external functions on Windows.Jean-Claude Beaudoin2016-09-271-1/+1
|
* pstrcpy looks to be needed by Windows win32/win64 builds. Reverted as ↵Christian Jullien2016-09-261-1/+1
| | | | PUB_FUNC to allow tcc.exe build again.
* Rein in unintended external functions.Jean-Claude Beaudoin2016-09-251-3/+3
|
* --whole-archive supportseyko2016-05-201-0/+1
| | | | | | | | | | | | | | | A patch is implemented as suggested in tinycc-devel mail list. From: Reuben Thomas Date: Thu, 31 Jul 2014 16:52:53 +0100 Subject: [PATCH] Add --{no,}-whole-archive support I resurrected the patch supplied to the mailing list in 2009 Since --whole-archive is a useful flag to get tcc working with autotools, and of course in its own right, I suggest you have a look at the patch and see if it is acceptable. I cannot see any suggestion that it was actively rejected last time round, just no evidence that it was ever added.
* x86-64-asm: Clean up 64bit immediate supportMichael Matz2016-05-111-1/+1
| | | | | | | | | Fix it to actually be able to parse 64bit immediates (enlarge operand value type). Then, generally there's no need for accepting IM64 anywhere, except in the 0xba+r mov opcodes, so OP_IM is unnecessary, as is OPT_IMNO64. Improve the generated code a bit by preferring the 0xc7 opcode for im32->reg64, instead of the im64->reg64 form (which we therefore hardcode).
* tccpp: cleanup options -dD -dM, remove -Cgrischka2016-05-051-4/+1
| | | | | | | The lexer is for reading files, not for writing. Also : - macro_is_equal(): avoid crash if redefining __FILE__
* tccgen: scope levels for local symbolsgrischka2016-05-051-2/+4
| | | | | | | | | | | | | | | | | | ... for fast redeclaration checks Also, check function parameters too: void foo(int a) { int a; ... } Also, try to fix struct/union/enum's on different scopes: { struct xxx { int x; }; { struct xxx { int y; }; ... }} and some (probably not all) combination with incomplete declarations "struct xxx;" Replaces 2bfedb18675228c3837c23fa523231f55e102c12 and 07d896c8e5d1b46bf4aebd403c78e5f7ffebe02a Fixes cf95ac399cbce1ea8a519f91dd36a5cfd4ea7943
* -fno-type-redefinition-checkseyko2016-05-041-0/+1
| | | | | | | | | | | | | don't catch redefinition for local vars. With this option on tcc accepts the following code: int main() { int a = 0; long a = 0; } But if you shure there is no problem with your local variables, then a compilation speed can be improved if you have a lots of the local variables (50000+)
* Reduce allocations overheadVlad Vissoultchev2016-04-171-0/+42
| | | | | | | | | - uses new `TinyAlloc`-ators for small `TokenSym`, `CString` and `TokenString` instances - conditional `TAL_DEBUG` for mem leaks and double frees detection - on `TAL_DEBUG` collects allocation origin (file + line) - conditional `TAL_INFO` for allocators stats (in release mode too) - chain a new allocator twice current capacity on buffer exhaustion
* Improve hash performanceVlad Vissoultchev2016-04-171-3/+4
| | | | | | | | | | | | - better `TOK_HASH_FUNC` - increases `hash_ident` initial size to 16k (from 8k) - `cstr_cat` uses single `realloc` + `memcpy` - `cstr_cat` can append terminating zero - `tok_str_realloc` initial size to 16 (from 8) - `parse_define` uses static `tokstr_buf` - `next` uses static `tokstr_buf` - fixes two latent bugs (wrong deallocations in libtcc.c:482 and tccpp.c:2987)
* preprocessor oprtion -C (keep comments)seyko2016-04-151-1/+2
| | | | | This is done by impression of the pcc -C option. Usual execution path and speed are not changed.
* fix for thev "#pragna once" guardseyko2016-04-141-0/+1
| | | | | gcc 3.4.6 don't understand "#if PATHCMP==stricmp" where "#define PATHCMP stricmp"
* Move utility functions `trimfront/back` to tccpp.cVlad Vissoultchev2016-04-131-0/+2
| | | | These are used in `libtcc.c` now and cannot remain in `tccpe.c`
* correct version of "Identifiers can start and/or contain"seyko2016-04-131-1/+3
| | | | | | | A problem was in TOK_ASMDIR_text: - sprintf(sname, ".%s", get_tok_str(tok1, NULL)); + sprintf(sname, "%s", get_tok_str(tok1, NULL)); When tok1 is '.text', then sname is '..text'
* Allow tcc arguments to be read from @listfilesseyko2016-04-131-0/+9
| | | | | | | | | | | | | | | | | From: Vlad Vissoultchev Date: Tue, 12 Apr 2016 20:43:15 +0300 Subject: Allow tcc arguments to be read from @listfiles This allows all @ prefixed arguments to be treated as listfiles containing list of source files or tcc options where each one is on a separate line. Can be used to benchmark compilation speed with non-trivial amount of source files. The impl of `tcc_parse_args` had to be moved to a new function that is able to be called recursively w/ the original one remaining as a driver of the new one. Listfiles parsing happens in a new `args_parser_add_listfile` function that uses `tcc_open`/`tcc_close/inp` for buffered file input.
* VS2015 solution and project filesseyko2016-04-131-0/+7
| | | | | | | | | | | | | From: Vlad Vissoultchev Date: Mon, 11 Apr 2016 01:32:28 +0300 Subject: Add VS2015 solution and project files to `win32/vs2015` directory This allows release/debug builds for both x86 and x64 targets. Some warnings had to be suppressed. Output libtcc.dll and tcc.exe are copied to parent `win32` directory w/ a post-build action.
* revert of the 'Identifiers can start and/or contain'seyko2016-04-131-3/+1
| | | | | | | | When tccboot kernels compiles with 'Identifiers can start and/or', this kernel don't start. It is hard to find what is wrong. PS: there was no test for identifiers in *.S with '.'
* Implement -dM preprocessor option as in gccVlad Vissoultchev2016-04-061-1/+2
| | | | | | There was already support for -dD option but in contrast -dM dumps only `#define` directives w/o actual preprocessor output. The original -dD output differs from gcc output by additional comment in front of `#define`s so this quirk is left for -dM as well.
* Identifiers can start and/or contain '.' in *.Sseyko2016-04-051-1/+3
| | | | | | | | | | | | | | | | | modified version of the old one which don't allow '.' in #define Identifiers. This allow correctly preprocess the following code in *.S #define SRC(y...) \ 9999: y; \ .section __ex_table, "a"; \ .long 9999b, 6001f ; \ // .previous SRC(1: movw (%esi), %bx) 6001: A test included.
* -fnormalize-inc-dirsseyko2016-04-031-1/+2
| | | | | | remove non-existent or duplicate directories from include paths if -fnormalize-inc-dirs is specified. This will help to compile current coreutils package
* reverse of the "Identifiers can start and/or contain '.'"seyko2016-04-031-3/+1
| | | | | | | | | | | | | | | | | - Identifiers can start and/or contain '.' in PARSE_FLAG_ASM_FILE - Move all GAS directives under TOK_ASMDIR prefix This patches breaks compilation of the tccboot (linux 2.4.26 kernel). A test.S which fails with this patches: #define SRC(y...) \ 9999: y; \ .section __ex_table, "a"; \ .long 9999b, 6001f<---->; \ .previous SRC(1:<>movw (%esi), %bx<------>) // 029-test.S:7: error: macro 'SRC' used with too many args
* Move all GAS directives under TOK_ASMDIR prefix to include leading '.'Vlad Vissoultchev2016-03-151-1/+3
| | | | Use only these tokens in `asm_parse_directive` and don't recycle others' tokens (like TOK_SECTION1)
* Change the way struct CStrings are handled.Edmund Grimley Evans2015-11-261-1/+5
| | | | | | | | | A CString used to be copied into a token string, which is an int array. On a 64-bit architecture the pointers were misaligned, so ASan gave lots of warnings. On a 64-bit architecture that required memory accesses to be correctly aligned it would not work at all. The CString is now included in CValue instead.
* tcc.h: Change order of built-in include paths: put TCC's own dir first.Edmund Grimley Evans2015-11-231-3/+3
| | | | | There may be compiler-specific header files that should override system headers. See TCC's include paths by running "tcc -vv".
* tccpp: cleanup #include_nextgrischka2015-11-201-1/+1
| | | | | | | | | | | | | | | | tcc_normalize_inc_dirs: normally no problem to be absolutly gcc compatible as long as it can be done the tiny way. This reverts to the state before recent related commits and reimplements a (small) part of it to fix the reported problem. Also: Revert "parsing "..." sequence" c3975cf27c792d493e76a2058a1eaf588324053e && p[1] == '.' is not a reliable way to lookahead
* tccgen: asm_label cleanupgrischka2015-11-201-1/+2
| | | | | | | - avoid memory allocation by using its (int) token number - avoid additional function parameter by using Attribute Also: fix some strange looking error messages
* Trivial changes to avoid some compiler warnings.Edmund Grimley Evans2015-11-191-4/+4
|
* Replace pointer casts with calls to (read|write)(16|32|64)le.Edmund Grimley Evans2015-11-191-0/+45
| | | | | This stops UBSan from giving runtime misaligned address errors and might eventually allow building on a non-little-endian host.
* Merge the integer members of union CValue into "uint64_t i".Edmund Grimley Evans2015-11-171-6/+1
|
* tcc.h: remove CONFIG_TCCBOOT partseyko2015-11-051-7/+0
| | | | | | curremtly no one will try to compile a linux kernel from the boot loader. With current tcc it is not possible w/o additional tuning.
* fix for the previous commitseyko2015-11-051-0/+1
| | | | | a cross-compilation from unix to win32 need a "sys/stat.h" include file
* normalize inc dirs, symplify include_nextseyko2015-11-051-0/+1
| | | | | | | | | include dirs are prepared as in gcc - for each duplicate path keep just the first one - remove each include_path that exists in sysinclude_paths include_next streamlined by introducing inc_path_index in the BufferedFile
* Define CONFIG_TCC_ELFINTERP on NetBSD as /usr/libexec/ld.elf_soKamil Rytarowski2015-10-111-0/+2
|
* Revert "fix-mixed-struct (patch by Pip Cet)"gus knight2015-07-291-5/+3
| | | | This reverts commit 4e04f67c94c97b4f28a4d73759a0ad38fb3a10f7. Requested by grischka.
* Revert all of my changes to directories & codingstyle.gus knight2015-07-291-0/+1498
|
* Reorganize the source tree.gus knight2015-07-271-1498/+0
| | | | | | | | | | * Documentation is now in "docs". * Source code is now in "src". * Misc. fixes here and there so that everything still works. I think I got everything in this commit, but I only tested this on Linux (Make) and Windows (CMake), so I might've messed something up on other platforms...
* Trim trailing spaces everywhere.gus knight2015-07-271-4/+4
|
* fix-mixed-struct (patch by Pip Cet)seyko2015-05-141-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jsut for testing. It works for me (don't break anything) Small fixes for x86_64-gen.c in "tccpp: fix issues, add tests" are dropped in flavor of this patch. Pip Cet: Okay, here's a first patch that fixes the problem (but I've found another bug, yet unfixed, in the process), though it's not particularly pretty code (I tried hard to keep the changes to the minimum necessary). If we decide to actually get rid of VT_QLONG and VT_QFLOAT (please, can we?), there are some further simplifications in tccgen.c that might offset some of the cost of this patch. The idea is that an integer is no longer enough to describe how an argument is stored in registers. There are a number of possibilities (none, integer register, two integer registers, float register, two float registers, integer register plus float register, float register plus integer register), and instead of enumerating them I've introduced a RegArgs type that stores the offsets for each of our registers (for the other architectures, it's simply an int specifying the number of registers). If someone strongly prefers an enum, we could do that instead, but I believe this is a place where keeping things general is worth it, because this way it should be doable to add SSE or AVX support. There is one line in the patch that looks suspicious: } else { addr = (addr + align - 1) & -align; param_addr = addr; addr += size; - sse_param_index += reg_count; } break; However, this actually fixes one half of a bug we have when calling a function with eight double arguments "interrupted" by a two-double structure after the seventh double argument: f(double,double,double,double,double,double,double,struct { double x,y; },double); In this case, the last argument should be passed in %xmm7. This patch fixes the problem in gfunc_prolog, but not the corresponding problem in gfunc_call, which I'll try tackling next.
* redo of the -dD optionseyko2015-05-131-0/+2
| | | | | | | | functionality was broken some time ago and was removed by the "tccpp: fix issues, add tests" fix: LINE_MACRO_OUTPUT_FORMAT_NONE in pp_line() means: output '\n' and not "don't output at all"
* restore a max memory usage printing for a new MEM_DEBUG when -benchseyko2015-05-121-1/+1
|
* a new version of the MEM_DEBUGseyko2015-05-121-5/+15
|
* tcc_add_dll is not used if TCC_TARGET_PEseyko2015-05-101-0/+4
| | | | after "tccpp: fix issues, add tests"
* tccpp: fix issues, add testsgrischka2015-05-091-17/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix some macro expansion issues * add some pp tests in tests/pp * improved tcc -E output for better diff'ability * remove -dD feature (quirky code, exotic feature, didn't work well) Based partially on ideas / researches from PipCet Some issues remain with VA_ARGS macros (if used in a rather tricky way). Also, to keep it simple, the pp doesn't automtically add any extra spaces to separate tokens which otherwise would form wrong tokens if re-read from tcc -E output (such as '+' '=') GCC does that, other compilers don't. * cleanups - #line 01 "file" / # 01 "file" processing - #pragma comment(lib,"foo") - tcc -E: forward some pragmas to output (pack, comment(lib)) - fix macro parameter list parsing mess from a3fc54345949535524d01319e1ca6378b7c2c201 a715d7143d9d17da17e67fec6af1c01409a71a31 (some coffee might help, next time ;) - introduce TOK_PPSTR - to have character constants as written in the file (similar to TOK_PPNUM) - allow '\' appear in macros - new functions begin/end_macro to: - fix switching macro levels during expansion - allow unget_tok to unget more than one tok - slight speedup by using bitflags in isidnum_table Also: - x86_64.c : fix decl after statements - i386-gen,c : fix a vstack leak with VLA on windows - configure/Makefile : build on windows (MSYS) was broken - tcc_warning: fflush stderr to keep output order (win32)
* a lot simpler VLA codeseyko2015-05-041-6/+0
| | | | | | | | Author: Philip <pipcet@gmail.com> Our VLA code can be made a lot simpler (simple enough for even me to understand it) by giving up on the optimization idea, which is very tempting. There's a patch to do that attached, feel free to test and commit it if you like. (It passes all the tests, at least
* tccpp.c: fix GNU comma handlingPhilip2015-05-021-0/+1
| | | | | | | | | This requires moving TOK_PLCHLDR handling, but the new logic should make things easier even if (when?) GNU comma handling is removed. (Somewhat confusingly, GCC no longer supports GNU commas. See http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html for a description of past and current GCC behaviour.)
* tccpp.c: parse flag to accept stray \Philip2015-05-021-0/+1
| | | | | | | | | | | | | | | | | | | This adds a PARSE_FLAG_ACCEPT_STRAYS parse flag to accept stray backslashes in the source code, and uses it for pure preprocessing. For absolutely correct behaviour of # stringification, we need to use this flag when parsing macro definitions and in macro arguments, as well; this patch does not yet do so. The test case for that is something like #define STRINGIFY2(x) #x #define STRINGIFY(x) STRINGIFY2(x) STRINGIFY(\n) which should produce "\n", not a parse error or "\\n". See http://lists.nongnu.org/archive/html/tinycc-devel/2015-05/msg00002.html
* replace PARSE_FLAG_ASM_COMMENTS with PARSE_FLAG_ASM_FILEseyko2015-04-271-2/+1
| | | | | after "assign PARSE_FLAG_ASM_COMMENTS only for asm files" functions of this flags are identical
* Revert "* and #pragma pop_macro("macro_name")"grischka2015-04-231-1/+0
| | | | | | | | | | | | - pop_macro incorrect with initially undefined macro - horrible implementation (tcc_open_bf) - crashes eventually (abuse of Sym->prev_tok) - the (unrelated) asm_label part is the opposite of a fix (Despite of its name this variable has nothing to do with the built-in assembler) This reverts commit 0c8447db7970813292a8be74ee50e49091be5d15.