aboutsummaryrefslogtreecommitdiff
path: root/tccpe.c
Commit message (Collapse)AuthorAgeFilesLines
* Give clang one less thing to complain aboutLarry Doolittle2017-05-081-1/+1
| | | | | | "s"[i<2] and "s" + (i<2) are literally identical, but the latter triggers a warning from clang because it looks so much like a noob is trying to concatenate an integer and a string. The former is arguably more clear.
* Spelling fixes in C comments onlyLarry Doolittle2017-05-071-2/+2
|
* final adjustments for releasegrischka2017-04-251-5/+1
| | | | | | | | | | | | | | | | | | | | | - configure/Makefiles: minor adjustments - build-tcc.bat: add -static to gcc options (avoids libgcc_s*.dll dependency with some mingw versions) - tccpe.c/tcctools.c: eliminate MAX_PATH (not available for cross compilers) - tccasm.c: use uint64_t/strtoull in unary() (unsigned long sometimes is only uint32_t, as always on windows) - tccgen.c: Revert (f077d16c) "tccgen: gen_cast: cast FLOAT to DOUBLE" Was a rather experimental, tentative commit, not really necessary and somewhat ugly too. - cleanup recent osx support: - Makefile/libtcc.c: cleanup copy&paste code - tccpp.c: restore deleted function
* tccgen/win32: let __declspec(dllimport) imply externgrischka2017-04-041-23/+18
| | | | | | | | | | | | | | | | | | | | | | | 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
* cross-compilers: allow individual configurationgrischka2017-02-231-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* tcctools.c: integrate tiny_libmaker/_impdefgrischka2017-02-181-13/+109
| | | | | | | | | | | | | | 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)
* win32: adjust new unicode supportgrischka2017-02-181-11/+14
| | | | | | | | | | | | | | | | | | | - lib/Makefile: add (win)crt1_w.o - crt1.c/_runtmain: return to tcc & only use for UNICODE (because it might be not 100% reliable with for example wildcards (tcc *.c -run ...) - tccrun.c/tccpe.c: load -run startup_code only if called from tcc_run(). Otherwise main may not be defined. See libtcc_test.c - tests2/Makefile: pass extra options in FLAGS to allow overriding TCC Also: - tccpe.c: support weak attribute. (I first tried to solve the problem above by using it but then didn't)
* Add support for Unicode entries 'wmain' and 'wWinMain' on WindowsYX Hao2017-02-171-8/+20
| | | | | | '-run' suported. argvs are converted. But don't use compliled Unicode CLI exe-file to get inputs interactively in other codepage! Please add other compliling supports than 'build-tcc.bat' (Who is good at them).
* mems & leaksgrischka2017-02-131-2/+12
| | | | | | | | | | | | - define_start: set above preprocess_start because now preprocess_start is defining macros. - free "cmd_include_files" - free defines always (after error-longjmps) - close all files (after error-longjmps) - tccpe.c: free imports always - libtcc.c: call tcc_memstats only after all states have been deleted.
* fixes & cleanupsgrischka2017-02-131-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - tccgen.c/tcc.h: allow function declaration after use: int f() { return g(); } int g() { return 1; } may be a warning but not an error see also 76cb1144ef91924c53c57ea71e6f67ce73ce1cc6 - tccgen.c: redundant code related to inline functions removed (functions used anywhere have sym->c set automatically) - tccgen.c: make 32bit llop non-equal test portable (probably not on C67) - dynarray_add: change prototype to possibly avoid aliasing problems or at least warnings - lib/alloca*.S: ".section .note.GNU-stack,"",%progbits" removed (has no effect) - tccpe: set SizeOfCode field (for correct upx decompression) - libtcc.c: fixed alternative -run invocation tcc "-run -lxxx ..." file.c (meant to load the library after file). Also supported now: tcc files ... options ... -run @ arguments ...
* win32: support "-Wl,--large-address-aware" optionPavlas, Zdenek2016-12-301-0/+1
|
* Control symbol table of which to relocate symbolsThomas Preud'homme2016-12-031-1/+1
| | | | Pass pointer to symbol table to relocate the symbols of in relocate_syms
* Rename add_elf_sym to set_elf_symThomas Preud'homme2016-12-031-2/+2
| | | | | | | | | | add_elf_sym is a confusing name because it is not clear what the function does compared to put_elf_sym. As a matter of fact, put_elf_sym also adds a symbol in a symbol table. Besides, "add_elf_sym" fails to convey that the function can be used to update a symbol (for instance its value). "set_elf_sym" seems like a more appropriate name: it will set a symbol to a given set of properties (value, size, etc.) and create a new one if non exist for that name as one would expect.
* tccpp_new/delete and other cleanupsgrischka2016-10-171-50/+56
|
* configure: fix tcc_lddir, cpugrischka2016-10-031-0/+2
| | | | ... and other minor cosmetic fixes
* libtcc: reimplement option -Wl,[-no]-whöle-archivegrischka2016-10-011-1/+1
| | | | - taking advantage of previous commit "incremental -Wl parsing"
* Revert part of "fix installation amd bcheck for Windows"grischka2016-10-011-1/+1
| | | | | | | tccelf.c : force linking bcheck by adding elf symbol __bound_init bcheck.c : use (size_t)1 for x86_64 Fixes 7e7e6148fdb4adbda936f80b5d4ac3d738908d95
* libtcc: cleanup @listfilegrischka2016-10-011-0/+17
| | | | | | | | | Also: - allow more than one item per line - respect "quoted items" and escaped quotes \" (also for LIBTCCAPI tcc_setoptions) - cleanup some copy & paste
* Rein in unintended external functions on Windows.Jean-Claude Beaudoin2016-09-271-0/+2
|
* Move utility functions `trimfront/back` to tccpp.cVlad Vissoultchev2016-04-131-16/+0
| | | | These are used in `libtcc.c` now and cannot remain in `tccpe.c`
* Merge the integer members of union CValue into "uint64_t i".Edmund Grimley Evans2015-11-171-2/+2
|
* Revert all of my changes to directories & codingstyle.gus knight2015-07-291-0/+1890
|
* Reorganize the source tree.gus knight2015-07-271-1890/+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...
* Clean up lots of rogue tabs.gus knight2015-07-271-24/+24
| | | | | | Still some more tabs to be taken care of. arm-gen.c and tcccoff.c have so many style issues that I'm just going to throw clang-format at them.
* Trim trailing spaces everywhere.gus knight2015-07-271-1/+1
|
* tccpp: fix issues, add testsgrischka2015-05-091-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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)
* win64: fix resource file supportgrischka2014-08-011-28/+24
|
* tccpe: adjust for new 'hidden' symbols featuregrischka2014-04-171-8/+8
| | | | | in order to avoid conflicts with windows specific (ab)usage of the Elf32_Sym -> st_other field.
* tccpe: speed up .def file loadinggrischka2014-04-131-17/+7
| | | | | The fgets replacement meant to work with "int fd" was just too slow.
* tcctest: add back testXb (self compile with -b)grischka2014-01-211-1/+1
| | | | | | | | | | | | | | | | | | - Thanks to Kirill "tcc -b itself" should work now (was removed in d5f4df09ff4a84dda5b03525285f03be7723376b) Also: - tests/Makefile: - fix spurious --I from 767410b8750b45d63805b45ca1a2cf34d7cb4923 - lookup boundtest.c via VPATH (for out-of-tree build) - test[123]b?: fail on diff error - Windows: test3 now works (from e31579b0769e1f9c0947d12e83316d1149307b1a) - abitest: a libtcc.a made by gcc is not usable for tcc on WIndows - using source instead (libtcc.c) - tccpe: - avoid gcc warning (x86_64)
* tccpe: cleanup "imports per ordinal"grischka2014-01-061-34/+33
| | | | | | | - tccpe.c: avoid conflict with imp_sym->st_value, cleanup - _parseLibs.bat, _tcc.bat: no instructions for usage, removed. from commit 642b6d0f50c6b6a842c9239a102fe34d5619e931
* i386: use __fixdfdi instead of __tcc_cvt_ftolgrischka2014-01-061-0/+2
| | | | | | | | | | | | Variants __fixsfdi/__fixxfdi are not needed for now because the value is converted to double always. Also: - remove __tcc_fpinit for unix as it seems redundant by the __setfpucw call in the startup code - avoid reference to s->runtime_main in cross compilers - configure: fix --with-libgcc help - tcctok.h: cleanup
* Add the possibility to use noname functions by ordinalYX Hao2013-09-191-6/+32
| | | | | | | | | | | | | | | | | | | | | tcc.c: process.h:177:20: note: expected 'char * const*' but argument is of type 'char const*const*' tccpe.c: Add the possibility to use noname functions by ordinal. use def file: "AliasName @n" build-tcc.bat: 1. Enable 32 bits mode on 64 bits OS. 2. build doc. _parseLibs.bat: Convenient to use "*.def + *.c" instead of *.a, just use -l* _tcc.bat: a practice of _parseLibs.bat Signed-off-by: YX Hao <lifenjoiner@163.com>
* win32: fix libtcc supportgrischka2013-09-101-3/+4
| | | | | | | | | | | | | | For "tcc -run file.c", I was trying to initialize the FP control in a function in libtcc1.a (_runmain) before calling main. Unfortunately that turned out to cause problems with for example libtcc_test since such usage doesn't necessarily define a 'main' function. So for tcc -run we're back to relying on the FP control word that is set in the startup code of tcc.exe rsp. libtcc.dll. This fixes part of commit 73faaea227a53e365dd75f1dba7a5071c7b5e541
* i386-gen: preserve fp control word in gen_cvt_ftoigrischka2013-08-281-17/+5
| | | | | | | | | | | | | | | | | | | | | | | - Use runtime function for conversion - Also initialize fp with tcc -run on windows This fixes a bug where double x = 1.0; double y = 1.0000000000000001; double z = x < y ? 0 : sqrt (x*x - y*y); caused a bad sqrt because rounding precision for the x < y comparison was different to the one used within the sqrt function. This also fixes a bug where printf("%d, %d", (int)pow(10, 2), (int)pow(10, 2)); would print 100, 99 Unrelated: win32: document relative include & lib lookup win32: normalize_slashes: do not mirror silly gcc behavior This reverts part of commit 8a81f9e1036637e21a47e14fb56bf64133546890 winapi: add missing WINAPI decl. for some functions
* tccpe: pstrcpy() will truncate .stabstr section name, use strncpy() instead.Roy2013-06-061-1/+1
|
* add version number to manpageUrs Janssen2013-02-171-1/+1
| | | | | | | avoid c++/c99 style comments in preprocessor directives avoid leadings whitespaces in preprocessor directives mention implemented variable length arrays in documentation fixed ambiguous option in texi2html call (Austin English)
* libtcc: new LIBTCCAPI tcc_set_options(TCCState*, const char*str)grischka2013-02-121-28/+30
| | | | | | | | | | | | | | | | | | | This replaces -> use instead: ----------------------------------- - tcc_set_linker -> tcc_set_options(s, "-Wl,..."); - tcc_set_warning -> tcc_set_options(s, "-W..."); - tcc_enable_debug -> tcc_set_options(s, "-g"); parse_args is moved to libtcc.c (now tcc_parse_args). Also some cleanups: - reorder TCCState members - add some comments here and there - do not use argv's directly, make string copies - use const char* in tcc_set_linker - tccpe: use fd instead of fp tested with -D MEM_DEBUG: 0 bytes left
* win32: Honor "-Wl,-subsystem=console/gui" optiongrischka2013-02-041-9/+10
|
* portability: fix void* <-> target address conversion confusiongrischka2013-02-041-7/+7
| | | | | | - #define addr_t as ElfW(Addr) - replace uplong by addr_t - #define TCC_HAS_RUNTIME_PLTGOT and use it
* safety: replace occurrences of strcpy by pstrcpygrischka2013-01-311-3/+3
|
* tccpe: no debug, no stabsgrischka2013-01-301-1/+4
|
* Revert "Added what I call virtual io to tinycc this way we can make a ↵Thomas Preud'homme2013-01-141-2/+2
| | | | | | | | monolitic executable or library that contains all needed to compile programs, truly tinycc portable." This reverts commit 59e18aee0e509a3ca75dbe6f909e18c1d17893d1. tcc is being stabilized now in order to do a new release soon. Therefore, such a change is not appropriate now.
* Revert "pe: fix tcc not linking to user32 and gdi32"Thomas Preud'homme2013-01-141-1/+1
| | | | | | This reverts commit 943574aba54713ca4a17fe33aadde5abee233b53. The empty string in "libs" was intended behavior, as can be seen from the "if (0 == *p)" below.
* Added what I call virtual io to tinycc this way we can make a monolitic ↵mingodad2013-01-111-2/+2
| | | | | | executable or library that contains all needed to compile programs, truly tinycc portable. Tested under linux exec the "mk-it" shell script and you'll end up with a portable tinycc executable that doesn't depend on anything else.
* pe: fix tcc not linking to user32 and gdi32Roy Tam2012-11-021-1/+1
|
* tcc.h: define TCC_IS_NATIVEgrischka2012-03-051-8/+3
| | | | | | - disable tccrun feature for non-native (cross-) compilers - define uplong for target adress size - fix using -Wl,-Ttext=... for Win64 (tccpe: ADDR3264 imagebase)
* rename error/warning -> tcc_(error/warning)grischka2011-08-111-6/+6
|
* libtcc: support more than one crtprefixgrischka2011-08-061-15/+0
| | | | Looks like gcc has that. Oh Deer!
* tccpe: cleanup ELFW() macros etc.grischka2011-07-141-32/+14
|