aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* x86-asm: Fix lcall/ljmp, xchg and inc/decMichael Matz2016-05-032-8/+6
| | | | | | | Various x86 asm fixes: 64bit lcall/ljmp like 32bit a commit before, xchgw accepted wrong operands on 32 and 64bit, and 64bit used 0x40/0x48+reg for incw/decw, but those are REX prefixes, not instructions.
* i386-asm: correct lcall/ljmp encodingMichael Matz2016-05-021-2/+2
| | | | The 0xff/3 form of lcall needs a mod/rm byte, so reflect this.
* __asm__() outside functionseyko2016-05-013-0/+17
| | | | | | | | gcc/pcc allow __asm__() outside a function body: extern void vide(void); __asm__("vide: ret"); There is many such code in the Linux kernels.
* lcall hex code correctionseyko2016-05-011-1/+1
|
* clearing "output space after TOK_PPNUM ..."seyko2016-05-011-23/+20
|
* output space after TOK_PPNUM which followed by '+' or '-'seyko2016-05-019-9/+114
| | | | | | * correct -E output for the case ++ + ++ concatenation do this only for expanded from macro string and only when tcc_state->output_type == TCC_OUTPUT_PREPROCESS
* tccpp: macro subst fixgrischka2016-04-291-4/+4
| | | | | | | | | #define Y(x) Z(x) #define X Y return X(X(1)); was : return Z(Y(1)); now : return Z(Z(1));
* TODO: Add two issues.Edmund Grimley Evans2016-04-241-0/+2
|
* fix for the "Reduce allocations overhead"seyko2016-04-221-1/+1
| | | | Now no trap when compiling tccboot
* .rept asm directiveseyko2016-04-223-1/+41
| | | | | and '.' alone is a token now in *.S (not an identifier) representing a current position in the code (PC).
* section alignmentseyko2016-04-221-1/+1
| | | | | | Alignment of unknown sections changed from 32 to PTR_SIZE This is gcc/pcc default value. This helps to use tcc as linux kernel compiler.
* Source and destination overlap in memcpy, cstr_cat (tccpp.c:322)seyko2016-04-221-1/+1
| | | | This code is from "Improve hash performance"
* Run testcases in sorted orderMichael Matz2016-04-221-1/+1
| | | | | Without sorting they run in whatever order readdir returns, I like it better when the order is reliable (and alphanumeric).
* Reduce allocations overheadVlad Vissoultchev2016-04-172-7/+219
| | | | | | | | | - 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-176-97/+105
| | | | | | | | | | | | - 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)
* Revert "Fix tests Makefiles on Windows"Vlad Vissoultchev2016-04-173-14/+2
| | | | This reverts commit fa2472c17246206ce6947475782de17245eceeea.
* Add travis tests integrationVlad Vissoultchev2016-04-172-0/+126
|
* simplify -C printingseyko2016-04-171-112/+29
| | | | | | | | | | parse_print_line_comment() and parse_print_comment() are combined and made more simply: * don't worry about speed with -E option * don't handle straya in comments Do we need to handle strays in regular parse_line_comment() and parse_comment() ?
* __builtin_expect no-opseyko2016-04-162-0/+38
| | | | | Taken from David Mertens tcc branch on github https://github.com/run4flat/tinycc.git
* allow to compile tcc by pccseyko2016-04-153-2/+6
| | | | | * pcc have only __linux__ macro (and no __linux) * pcc don't have __clear_cache proc
* preprocessor oprtion -C (keep comments)seyko2016-04-155-48/+195
| | | | | This is done by impression of the pcc -C option. Usual execution path and speed are not changed.
* fix preprocessing *.S with ` ' chars in #commentsseyko2016-04-143-1/+17
| | | | | with a test program. Problem detected when trying to compile linux-2.4.37.9 with tcc.
* fix for thev "#pragna once" guardseyko2016-04-142-1/+2
| | | | | gcc 3.4.6 don't understand "#if PATHCMP==stricmp" where "#define PATHCMP stricmp"
* Move utility functions `trimfront/back` to tccpp.cVlad Vissoultchev2016-04-134-19/+18
| | | | These are used in `libtcc.c` now and cannot remain in `tccpe.c`
* Simplify @listfiles parsingVlad Vissoultchev2016-04-131-39/+17
| | | | This moves listfiles parsing inline in `tcc_parse_args1`
* Better pragma once guardVlad Vissoultchev2016-04-132-5/+9
| | | | This takes care of case-insensitive filenames (like on win32)
* win32: Better VS2015 solution and project filesVlad Vissoultchev2016-04-133-0/+34
| | | | These include all header and source files from source directory
* tccpp.c: Guard against ppfp being NULLVlad Vissoultchev2016-04-132-24/+18
| | | | Missed these in e946eb2a4109e0de5f8514457f851897a4824c3e
* correct version of "Identifiers can start and/or contain"seyko2016-04-134-72/+94
| | | | | | | 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-133-27/+94
| | | | | | | | | | | | | | | | | 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.
* win32: Add missing header files for nginx compilationseyko2016-04-136-0/+1122
| | | | | | | | | From: Vlad Vissoultchev Date: Tue, 12 Apr 2016 21:02:43 +0300 Subject: win32: Add missing header files for nginx compilation The new ones are hoisted from mingw-w64 as most other headers under `win32/include/winapi`
* VS2015 solution and project filesseyko2016-04-135-2/+383
| | | | | | | | | | | | | 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.
* Fix pragma once guardseyko2016-04-132-3/+6
| | | | | | | | | | | | | | From: Vlad Vissoultchev Date: Mon, 11 Apr 2016 01:26:32 +0300 Subject: Fix pragma once guard when compiling multiple source files When compiling multiple source files directly to executable cached include files guard was incorrectly checked for TOK_once in ifndef_macro member. If two source files included the same header guarded by pragma once, then the second one erroneously skipped it as `cached_includes` is not cleared on second `tcc_compile`
* fix for the -dM patchseyko2016-04-131-2/+7
| | | | assign fopen("/dev/null","w") to the s->ppfp insteed of NULL
* document -dM in "tcc -h" outputseyko2016-04-131-1/+1
|
* revert of the 'Identifiers can start and/or contain'seyko2016-04-134-92/+70
| | | | | | | | 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 '.'
* Skip math library if not found when -lm option is usedVlad Vissoultchev2016-04-081-2/+5
| | | | | | This only silences "cannot find library" error and allows Makefiles targeting gcc to not complain about missing libraries If there is custom libm then standard handling applies.
* Implement -dM preprocessor option as in gccVlad Vissoultchev2016-04-064-8/+14
| | | | | | 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.
* tccgen.c: Allow type attributes to prefix enum/struct/union nameVlad Vissoultchev2016-04-063-10/+28
| | | | | | From gcc docs: "You may also specify attributes between the enum, struct or union tag and the name of the type rather than after the closing brace." Adds `82_attribs_position.c` in `tests/tests2`
* cleaning "Identifiers can start and/or contain"seyko2016-04-051-4/+6
| | | | more logical algorithm of the isidnum_table[] changing
* compilation speed of the tccboot correctionseyko2016-04-051-0/+4
| | | | | | | we use gnu extension "case 0x80 ... 0xFF" for tcc & gcc and perform test if(c & 0x80) for other compilers
* utf8 in identifiersseyko2016-04-053-1/+24
| | | | | | | | | | | | | | made like in pcc (pcc.ludd.ltu.se/ftp/pub/pcc-docs/pcc-utf8-ver3.pdf) We treat all chars with high bit set as alphabetic. This allow code like #include <stdio.h> int Lefèvre=2; int main() { printf("Lefèvre=%d\n",Lefèvre); return 0; }
* nocode_wanted with while/for inside ({})seyko2016-04-053-3/+96
| | | | a test included.
* optimization of the previous patchseyko2016-04-051-4/+6
| | | | | compilation speed of the tccboot restored (patch remove testing of the parse_flags in loop)
* Identifiers can start and/or contain '.' in *.Sseyko2016-04-058-73/+115
| | | | | | | | | | | | | | | | | 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.
* describe -fnormalize-inc-dirs in tcc-doc.texiseyko2016-04-041-1/+5
|
* R_386_COPYseyko2016-04-031-0/+6
| | | | | | This reloction must copy initialized data from the library to the program .bss segment. Currently made like for ARM (to remove noise of defaukt case). Is this true?
* -fnormalize-inc-dirsseyko2016-04-033-1/+96
| | | | | | 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-034-82/+69
| | | | | | | | | | | | | | | | | - 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
* Fix assignment to/from volatile typesMichael Matz2016-03-263-0/+17
| | | | | | | | | Code like this was broken: char volatile vi = i; See testcase, happens in ideosyncratic legacy code sprinkling volatile all over.