aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
Commit message (Collapse)AuthorAgeFilesLines
* tcc: report Darwin when building for Mach-O binaries.Andrei Warkentin2017-04-251-0/+2
| | | | | | | Somewhat revert c4c3f50, but key off the config, not host system. Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
* tccgen/win32: let __declspec(dllimport) imply externgrischka2017-04-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Also, retain storage qualifiers in type_decl, in particular also for function pointers. This allows to get rid of this very early hack in decl() type.t |= (btype.t & VT_STATIC); /* Retain "static". */ which was to fix the case of int main() { static int (*foo)(); ... Also: - missing __declspec(dllimport) is an error now - except if the symbol is "_imp__symbol" - demonstrate export/import of data in the dll example (while 'extern' isn't strictly required with dllimport anymore) - new function 'patch_storage()' replaces 'weaken_symbol()' and 'apply_visibility()' - new function 'update_storage()' applies storage attributes to Elf symbols. - put_extern_sym/2 accepts new pseudo section SECTION_COMMON - add -Wl,-export-all-symbols as alias for -rdynamic - add -Wl,-subsystem=windows for mingw compatibility - redefinition of 'sym' error for initialized global data
* Even on Darwin, tcc should display LinuxChristian Jullien2017-02-261-2/+0
|
* Linux was incorrectly identified in banner when compiled on macOS DarwinChristian Jullien2017-02-261-0/+2
|
* cross-compilers: allow individual configurationgrischka2017-02-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | since configure supports only native configuration a file 'cross-tcc.mak' needs to be created manually. It is included in the Makefile if present. # ---------------------------------------------------- # Example config-cross.mak: # # windows -> i386-linux cross-compiler # (it expects the linux files in <prefix>/i386-linux) ROOT-i386 = {B}/i386-linux CRT-i386 = $(ROOT-i386)/usr/lib LIB-i386 = $(ROOT-i386)/lib:$(ROOT-i386)/usr/lib INC-i386 = {B}/lib/include:$(ROOT-i386)/usr/include DEF-i386 += -D__linux__ # ---------------------------------------------------- Also: - use libtcc1-<target>.a instead of directories - add dummy arm assembler - remove include dependencies from armeabi.c/lib-arm64.c - tccelf/ld_add_file: add SYSROOT (when defined) to absolute filenames coming from ld-scripts
* tcc: re-enable correct option -r supportgrischka2017-02-201-25/+27
| | | | | | | | | | | | | | | Forgot about it. It allows to compile several sources (and other .o's) to one single .o file; tcc -r -o all.o f1.c f2.c f3.S o4.o ... Also: - option -fold-struct-init-code removed, no effect anymore - (tcc_)set_environment() moved to tcc.c - win32/lib/(win)crt1 minor fix & add dependency - debug line output for asm (tcc -c -g xxx.S) enabled - configure/Makefiles: x86-64 -> x86_64 changes - README: cleanup
* tcc -hh: show more optionsgrischka2017-02-181-67/+114
|
* tcctools.c: integrate tiny_libmaker/_impdefgrischka2017-02-181-216/+119
| | | | | | | | | | | | | | usage: tcc -ar [rcsv] lib files... tcc -impdef lib.dll [-v] [-o lib.def] also: - support more files with -c: tcc -c f1.c f2.c ... - fix a bug which caused tcc f1.c f2.S to produce no asm - allow tcc -ar @listfile too - change prototype: _void_ tcc_set_options(...) - apply -Wl,-whole-archive when a librariy is given as libxxx.a also (not just for -lxxx)
* updates & cleanups (tcc-doc/Changelog/TODO ...)grischka2017-02-131-0/+1
| | | | | | | | | | | | | | | - tcc-doc.texi: commandline option info update - Changelog/TODO: update - tests/tcctest.py: removed - tests/Makefile: weaktest fixed - tests/tests2: some files renamed and/or converted to unix LF - configure/Makefile: --enable-static option (no dll on win32) - win32/build-tcc.bat: msvc support - win32/tcc-win32.txt: build info update - win32/vs2015/: VS solution removed - win32/include/tcc/tcc_libm.h: #include statement fixed - tcc.c: -include <file> option help info - .gitignore: cleanup
* tcc: don't use pstrcpy, fix win32 spanwn quotinggrischka2017-02-081-18/+50
| | | | | | | | | | | | - we're now exporting tcc_prefixed symbols from libtcc only - On windows, the msvcrt startup code would remove backslashes from commandline arguments such as -DFOO=\"foo\" which would appear in argv as -DFOO="foo" Therefor before passing these to spawnvp, we need to restore the backslashes.
* libtcc.c: -m option cleanupgrischka2016-12-181-17/+21
| | | | | | | | | | | handle mms-bitfields as sub-options of -m. (-mfloat-abi is still special because it requires arguments) tcc.c: help(): - list -mms-bitfields under 'Target specific options' libtcc.c/MEM_DEBUG - add check for past buffer writes
* Change dependency file format a bitMichael Matz2016-12-151-1/+1
| | | | | | | The linux fixdep parse is very stupid and only recognizes a target token when ':' is part of it. A space is permitted in Makefile syntax, but it's easier to change our emitter than all fixdep parsers out there.
* Implement gcc bitfield algorithm; add -mms-bitfieldsDavid Mertens2016-11-281-0/+1
|
* tccpp_new/delete and other cleanupsgrischka2016-10-171-10/+7
|
* Actual complete name for DragonFly is 'DragonFly BSD'.Christian Jullien2016-10-161-1/+1
|
* World is not reduced to either Windows or LinuxChristian Jullien2016-10-151-1/+14
|
* tcc -E: add one space in cases: tiny solutiongrischka2016-10-011-1/+5
| | | | | | replaces f5f82abc99424c4ece836000934fcf57a867c635 Also: fix tcc flags in Makefile, fix tcc -E
* libtcc: reimplement option -Wl,[-no]-whöle-archivegrischka2016-10-011-2/+4
| | | | - taking advantage of previous commit "incremental -Wl parsing"
* libtcc: -Wl,... incremental parsinggrischka2016-10-011-0/+3
| | | | parse -Wl linker options immediately
* libtcc: filetype cleanupgrischka2016-10-011-2/+4
| | | | - does not change signature of tcc_add_file
* libtcc: cleanup @listfilegrischka2016-10-011-17/+19
| | | | | | | | | 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-13/+7
| | | | | Abusing filename[0] as type is just too much of a hack. -- From 05364072042ff37904a7b0b14cdd85a1ea1ca11d
* Revert "ability to compile multiple *.c files with -c switch"grischka2016-10-011-32/+19
| | | | | | | copy & paste coding, twisted control flow This reverts commit a13f183e4c2c4b4d1d40e142b57a4298672dfd2c. Also, set linker args for DLLs also.
* Revert "--whole-archive support"grischka2016-10-011-16/+2
| | | | | | | | | | | | - 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.
* --whole-archive supportseyko2016-05-201-2/+16
| | | | | | | | | | | | | | | 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.
* Microsoft says that _spawnp must be used instead of spawnp. It fixes a ↵Christian Jullien2016-05-161-1/+1
| | | | warning when compiled with MinGW 32/64 gcc compilers
* tccpp: cleanup options -dD -dM, remove -Cgrischka2016-05-051-3/+2
| | | | | | | The lexer is for reading files, not for writing. Also : - macro_is_equal(): avoid crash if redefining __FILE__
* 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-15/+3
| | | | | This is done by impression of the pcc -C option. Usual execution path and speed are not changed.
* Better pragma once guardVlad Vissoultchev2016-04-131-1/+1
| | | | This takes care of case-insensitive filenames (like on win32)
* tccpp.c: Guard against ppfp being NULLVlad Vissoultchev2016-04-131-7/+2
| | | | Missed these in e946eb2a4109e0de5f8514457f851897a4824c3e
* Allow tcc arguments to be read from @listfilesseyko2016-04-131-0/+1
| | | | | | | | | | | | | | | | | 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.
* Fix pragma once guardseyko2016-04-131-1/+1
| | | | | | | | | | | | | | 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
|
* 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-061-0/+3
| | | | | | 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.
* Revert spawnvp param cast and use `no-incompatible-pointer-types` in ↵Vlad Vissoultchev2016-03-141-1/+1
| | | | build-tcc.bat
* Silence FIXME and compiler warningVlad Vissoultchev2016-03-131-1/+1
|
* tcc help output for the -xc -xa - optionsseyko2015-10-241-0/+2
|
* Revert all of my changes to directories & codingstyle.gus knight2015-07-291-0/+365
|
* Reorganize the source tree.gus knight2015-07-271-365/+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-1/+1
|
* redo of the -dD optionseyko2015-05-131-0/+1
| | | | | | | | 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"
* some -bench fixesseyko2015-05-121-8/+8
| | | | print stats to stderr, not to stdout
* minor pp optimizationsseyko2015-05-121-17/+9
| | | | | | * remove free_defines() from tcc_preprocess() all cleanup will be done in tcc_delete * move a preprocessor file closing to tcc_delete too
* a mem leak fix for "ability to compile multiple *.c files with -c switch"seyko2015-05-121-5/+4
| | | | | | A new version of the MEM_DEBUG will be submitted next. This version is not depend on the malloc_usable_size() presense in the libc and print a places where a leaked chunks of memory was allocated.
* allow to use MEM_DEBUG with libtccseyko2015-05-111-2/+0
|
* tccpp: fix issues, add testsgrischka2015-05-091-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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)
* fix "tcc test.c -Wl,,--oformat,binary"seyko2015-05-031-3/+0
| | | | | set linker options only when "s->output_type == TCC_OUTPUT_EXE" otherwise tcc will produce a wrong object file