aboutsummaryrefslogtreecommitdiff
path: root/tcc.h
Commit message (Collapse)AuthorAgeFilesLines
* lib/libtcc1.c: cleanupgrischka2016-10-191-1/+1
| | | | | | | - remove #include dependencies from libtcc1.c for easier cross compilation - clear_cache only on ARM - error-message for mprotect failure
* tccrun/win64: cleanup runtime function tablegrischka2016-10-191-7/+3
| | | | | | | | | | | | | | - call RtlDeleteFunctionTable (important for multiple compilations) - the RUNTIME_FUNCTION* is now at the beginning of the runtime memory. Therefor when tcc_relocate is called with user memory, this should be done manually before it is free'd: RtlDeleteFunctionTable(*(void**)user_mem); [ free(user_mem); ] - x86_64-gen.c: expand char/short return values to int
* configure: --triplet= option, Makefile: cleanupgrischka2016-10-171-18/+13
|
* tccpp_new/delete and other cleanupsgrischka2016-10-171-38/+38
|
* tccgen/tccelf: move code from libtcc.cgrischka2016-10-151-26/+33
|
* Start support of OpenBSD, tcc compiler can be produced from source treeChristian Jullien2016-10-151-1/+3
|
* tccpp : "tcc -E -P" : suppress empty linesgrischka2016-10-091-73/+35
| | | | | | | | | Also: - regenerate all tests/pp/*.expect with gcc - test "insert one space" feature - test "0x1E-1" in asm mode case - PARSE_FLAG_SPACES: ignore \f\v\r better - tcc.h: move some things
* Misc. fixesgrischka2016-10-051-3/+6
| | | | | | | | | | | | | | | | | | | | Makefile : - do not 'uninstall' peoples /usr/local/doc entirely libtcc.c : - MEM_DEBUG : IDE-friendly output "file:line: ..." - always ELF for objects tccgen.c : - fix memory leak in new switch code - move static 'in_sizeof' out of function profiling : - define 'static' to empty resolve_sym() : - replace by dlsym() win32/64: fix R_XXX_RELATIVE fixme - was fixed for i386 already in 8e4d64be2fc1d707c7800c5096f6e0ea22cbd - do not -Lsystemdir if compiling to .o
* tccgen: arm/i386: save_reg_upstackgrischka2016-10-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tccgen.c:gv() when loading long long from lvalue, before was saving all registers which caused problems in the arm function call register parameter preparation, as with void foo(long long y, int x); int main(void) { unsigned int *xx[1], x; unsigned long long *yy[1], y; foo(**yy, **xx); return 0; } Now only the modified register is saved if necessary, as in this case where it is used to store the result of the post-inc: long long *p, v, **pp; v = 1; p = &v; p[0]++; printf("another long long spill test : %lld\n", *p); i386-gen.c : - found a similar problem with TOK_UMULL caused by the vstack juggle in tccgen:gen_opl() (bug seen only when using EBX as 4th register)
* configure: fix tcc_lddir, cpugrischka2016-10-031-0/+2
| | | | ... and other minor cosmetic fixes
* Revert "-fnormalize-inc-dirs"grischka2016-10-011-1/+0
| | | | | | | Too much code. gcc 3.x doesn't have that either. This reverts commit 41785a0bf9d505a3647a10ddc330417f52fd4528. This reverts commit 21665f433890e2038626f0b3123b189a62a67dc9.
* build: revert Makefiles to 0.9.26 state (mostly)grischka2016-10-011-3/+8
| | | | | | | | | | | | Except - that libtcc1.a is now installed in subdirs i386/ etc. - the support for arm and arm64 - some of the "Darwin" fixes - tests are mosly unchanged Also - removed the "legacy links for cross compilers" (was total mess) - removed "out-of-tree" build support (was broken anyway)
* libtcc: reimplement option -Wl,[-no]-whöle-archivegrischka2016-10-011-6/+14
| | | | - taking advantage of previous commit "incremental -Wl parsing"
* libtcc: -Wl,... incremental parsinggrischka2016-10-011-4/+1
| | | | parse -Wl linker options immediately
* Revert "output all sections if we produce an executable file"grischka2016-10-011-1/+0
| | | | | | | | | -- Not a fix This reverts commit 089ce6235c99638ad4542a57af4d09e2be0efc88. Revert "handle a -s option by executing sstrip/strip program" -- related, not a fix. This reverts commit 5cd4393a542ef4c64df7dcbb3fbe3a629666239d.
* libtcc: filetype cleanupgrischka2016-10-011-5/+14
| | | | - does not change signature of tcc_add_file
* tccpp: cleanupgrischka2016-10-011-93/+48
| | | | | | | | | | | | | | | | - "utf8 in identifiers" from 936819a1b90f2618bb3f86730189cf2895948ba0 - CValue: remove member str.data_allocated - make tiny allocator private to tccpp - allocate macro_stack objects on heap because otherwise it could crash after error/setjmp in preprocess_delete():end_macro() - mov "TinyAlloc" defs to tccpp.c - define_push: take int* str again
* libtcc: cleanup @listfilegrischka2016-10-011-11/+5
| | | | | | | | | Also: - allow more than one item per line - respect "quoted items" and escaped quotes \" (also for LIBTCCAPI tcc_setoptions) - cleanup some copy & paste
* libtcc: cleanup -x<filetype> switch codegrischka2016-10-011-1/+5
| | | | | Abusing filename[0] as type is just too much of a hack. -- From 05364072042ff37904a7b0b14cdd85a1ea1ca11d
* tccpp: #pragma once: make it workgrischka2016-10-011-2/+2
| | | | | | | | | | | after several "fixes" and "improvements" b3782c3cf5e66f74207303c381a305daabccdb12 5fb57bead41cd3a84f0aa3f98d00b5fe5de25a08 feature did not work at all - Use 'once' flag, not 'ifndef_macro' - Ignore filename letter case on _WIN32 - Increment global pp_once for each compilation
* 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.