aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* final update for 0.9.27maingrischka2017-12-1219-109/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tccgen.c: - fix ldouble asm hack - fix a VLA problem on Win64 (also x86_64-gen.c) - patch_type(): make sure that no symbol ever changes from global to static tcc.c: - tcc -vv: print libtcc1.a path also on win32 tccpe.c, tcctools.c: - use unix LF mode to for .def output files (that is for creating reproducible output trees) Makefile: - suppress some warnings when makeinfo is missing - call 'which install' only on win32 tests/Makefile: - change PATH only on WINNT systems (i.e. not if cross-compiling on linux for win32) - asm-c-connect.test: slim output and do diff tccrun.c tccpe.c *-link.c: - integrate former 'pe_relocate_rva()' into normal relocation This also fixes linkage of the unwind data on WIN64 for -run (reported by Janus Lynggaard Thorborg) tccasm.c, tests/tcctest.c: - fix dot (sym_index of -1 crashed in put_elf_reloc) - massage .set a bit (see test) other: - #define SECTION_ABS removed - ST_DATA Section *strtab_section: removed - put_extern_sym2(): take int section number Conflicts: tccelf.c tccpe.c Conflicts: tccelf.c
* tccgen_begin/end_filegrischka2017-12-126-68/+81
| | | | | | | | | | | | | | | | | | This is supposed to make compilation and linking with multiple source files (tcc f1.c f2.S ...) behave just the same as linking object files. tccgen.c:put_extern_sym2(): - use put_elf_sym to enter new symbols unconditionally tccelf.c: - save section state before compilation - disable symbol hashing during compilation - merge symbols and update relocations after compilation tccpe.c: - re-create s1->uw_sym for each compilation (because it may change)
* Fix some multi-file corner cases with asmMichael Matz2017-12-105-44/+73
| | | | | | | | | | | | | for this we have to create also asm symbols as VT_STATIC initially except if there's an indication that it should be global (.globl or undefined at end of unit). For this to work we need to be able to globalize symbols after they were local and enter them into the ELF hash tables, and also adjust the symbols that were potentially already used in relocs when they were still local. The easiest is to do a proper symbol resolution step also in multi-file mode, for regular symbols (the non-dynamic ones, i.e. not from shared libs).
* tccgen: unify type redefinition checksgrischka2017-12-052-72/+59
| | | | | | | tccgen.c: - improved function patch_storage() and added new function patch_type() for more consistent type redefinition and instance redefinition checks.
* tccasm: use global(_symbol)_stackgrischka2017-12-054-84/+67
| | | | | | | | | * removed asm_label stack * removed asm_free_labels() post-processing * using "impossible C type" for asm labels (VT_ASM) * tccgen.c:update_storage(): use it to refresh symbol attributes * tccelf.c:find_elf_sym(): ignore STB_LOCAL symbols * tccgen.c:unary(): asm symbols are supposed to be undeclared in C
* Fix another corner case with C/asm symtableMichael Matz2017-12-044-3/+29
| | | | | | See testcase (from grischka). If the asm has no .globl, but there's a (non-static) C definition the symbol should be exported, even if the first reference comes from asm.
* tccasm: Accept suffixed cmovCCMichael Matz2017-12-032-4/+17
| | | | | | | The length suffix for cmovCC isn't necessary as the required register operands always allow length deduction. But let's be nice to users and accept them anyway. Do that without blowing up tables, which means we don't detect invalid suffixes for the given operands, but so be it.
* tccasm: Unify C and asm symbol tableMichael Matz2017-11-278-188/+164
| | | | | | | | | | This makes the asm symbols use the same members as the C symbols for global decls, e.g. using the ELF symbol to hold offset and section. That allows us to use only one symbol table for C and asm symbols and to get rid of hacks to synch between them. We still need some special handling for symbols that come purely from asm sources.
* Adjust asm-c-connect testcase for WindowsMichael Matz2017-11-271-11/+12
| | | | | Calling conventions are different, let's use functions without any arguments.
* tccasm: Don't abuse dllexport/dllimportMichael Matz2017-11-252-8/+10
| | | | | | | | | For tracking if asm symbols are connected with a C symbol, and if asm symbols need to be global use new flags, instead of reusing dllimport/dllexport, which would cause unrequested exported entries on Windows. This is a stop-gap until the C and asm symtable are unified.
* tccasm: synch C and asm symtab tighterMichael Matz2017-11-227-23/+119
| | | | | | | | | | | | | See testcase. The C and asm symtab are still separate, but integrated tighter: the asm labels are only synched at file end, not after each asm snippet (this fixes references from one to another asm block), the C and asm syms are synched both ways, so defining things in asm and refering from C, or the other way around works. In effect this model reflects what happens with GCC better. For this the asm labels aren't using the C label namespace anymore, but their own, which increases the size of each TokenSym by a pointer.
* Adjust testcase for PIE compilersMichael Matz2017-11-191-1/+7
| | | | | | one some systems GCC defaults to PIC/PIE code which is incompatible with a unannotated asm call to a function (getenv here). TCC doesn't support these PIC annotations (yet), so play some pre-processor games.
* Fix forward asm labels differentlyMichael Matz2017-11-191-9/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | while last change fixed one part of label behaviour (undefined ones must be global) it again broke a different aspect (forward defs without .globl must stay local). This fixes both aspects. That a label is local instead of global is difficult to test without resorting to look at the symbol table or using two-file testcases, so we do without. In essence the local/global-ness of symbols should be the same between GAS and TCC for this input: .globl glob1 glob1: call glob1 .globl glob2 call glob2 glob2: glob3: .globl glob3 call glob3 glob4: call glob4 .globl glob4 call glob5 .globl glob5 glob5: call glob6 glob6: .globl glob6 locl1: call locl1 call locl2 locl2: unref1: unref2: .globl unref2 .globl unref3 unref3: call undef
* Don't make forard asm symbols static by defaultMichael Matz2017-11-162-2/+20
| | | | | | | fixes the problem in the testcase. A symbolic reference from asm, which remains undefined at the end of processing is always a global reference, not a static (STB_LOCAL) one. This also affected the linux kernel.
* Fix absolute memory referencesMichael Matz2017-11-151-6/+25
| | | | | | | | This properly fixes what 870271ea tried to fix. Absolute memory references can't use %rip relative addressing, and additionally, if the address doesn't fit 32bit (signed) it must be loaded via movabs. No good testcase added, it would require catching signals and still be unreliable.
* Revert "gen_addrpc32: absolute ptr needs *ABS* relocation"Michael Matz2017-11-141-1/+2
| | | | | | | | This reverts commit 870271ea071971002fa556e09e1873db316fa1a9. The commit is broken, you can't unconditionally emit a PC-relative relocation without a symbol. And if there's a symbol the addend need to be in the relocation, not the section.
* Win64/PE: Changed runtime function unwind info to be added after relocation, ↵janus.lt2017-11-041-4/+5
| | | | fixes SEH + long jmps
* fixed dylib typo in libtcc.cemekoi2017-10-191-1/+1
|
* various stuffgrischka2017-10-1130-654/+424
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | win32/Makefile ("for cygwin") removed - On cygwin, the normal ./configure && make can be used with either cygwin's "GCC for Win32 Toolchain" ./configure --cross-prefix=i686-w64-mingw32- or with an existing tcc: ./configure --cc=<old-tccdir>/tcc.exe tcctest.c: - exclude test_high_clobbers() on _WIN64 (does not work) tests2/95_bitfield.c: - use 'signed char' for ARM (where default 'char' is unsigned) tests: - remove -I "expr" diff option to allow tests with busybox-diff. libtcc.c, tcc.c: - removed -iwithprefix option. It is supposed to be combined with -iprefix which we don't have either. tccgen.c: - fix assignments and return of 'void', as in void f() { void *p, *q; *p = *q: return *p; } This appears to be allowed but should do nothing. tcc.h, libtcc.c, tccpp.c: - Revert "Introduce VIP sysinclude paths which are always searched first" This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1. The patch was giving tcc's system includes priority over -I which is not how it should be. tccelf.c: - add DT_TEXTREL tag only if text relocations are actually used (which is likely not the case on x86_64) - prepare_dynamic_rel(): avoid relocation of unresolved (weak) symbols tccrun.c: - for HAVE_SELINUX, use two mappings to the same (real) file. (it was so once except the RX mapping wasn't used at all). tccpe.c: - fix relocation constant used for x86_64 (by Andrei E. Warentin) - #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin. tccasm.c: - keep forward asm labels static, otherwise they will endup in dynsym eventually. configure, Makefile: - mingw32: respect ./configure options --bindir --docdir --libdir - allow overriding tcc when building libtcc1.a and libtcc.def with make XTCC=<tcc program to use> - use $(wildcard ...) for install to allow installing just a cross compiler for example make cross-arm make install - use name <target>-libtcc1.a build-tcc.bat: - add options: -clean, -b bindir
* Win: crt, initialize global __argc, __targv and _tenviron of msvcrtYX Hao2017-10-102-41/+34
| | | | | _tenviron: as far as possible, not in ASC '-run' mode. __argc and __targv are shortcuts for _tWinMain, when you want to use program parameters.
* Fix Windows++ compilation of previous (YX Hao, Joel Bodenmann)Steffen Nurpmeso2017-10-091-0/+2
|
* Introduce VIP sysinclude paths which are always searched firstSteffen Nurpmeso2017-10-035-9/+36
|
* Adjust va_list to work with muslSteffen Nurpmeso2017-09-302-2/+7
|
* tools directory no more exists, removed in win32 tarball Makefile target.Christian Jullien2017-09-291-1/+0
|
* Use more conventional punctuation for sequential assignmentsLarry Doolittle2017-09-251-6/+6
|
* freebsd: allow building tcc which targets windowsAvi Halachmi (:avih)2017-09-251-1/+2
| | | | | | | | | | | Currently tcc doesn't have a compile-time config indicating that the target is freebsd, and as a result, the tcc binary adds freebsh stuff to elf headers if the compile-time (of tcc) *host* is freebsd. Test also that the target is not PE while generating an elf header. This still likely fails (but untested) when tcc targets other non-freebsd systems on a freebsd system, but for now fix it only when targetting windows.
* Fix some spelling in documentationLarry Doolittle2017-09-241-5/+5
|
* Spelling fixesLarry Doolittle2017-09-2419-28/+28
| | | | Comments only, no change to functionality
* Convert two .c files to LF line endingsLarry Doolittle2017-09-242-317/+317
| | | | ... matching the other 157 .c files in the tree
* 'long' reviewgrischka2017-09-246-176/+164
| | | | | | | | | | | | | | | | | | | | | add some features for more complete 'long' support tcc.h: - use LONG_SIZE=4/8 instead of TCC_LONG_ARE_64_BIT tccgen.c: - add ptrdiff_type, update size_type - support shift and ?: operations - support long enum types - display 'long' from type_to_str - nwchar_t is unsigned short on windows - unrelated: use memcpy in init_putv for long doubles to avoid random bytes in the image (if tcc was compiled by gcc) for diff purposes. tccpp.c: - make parse_number return correct types - improve multi-character-constants 'XX' 'abcd' Changelog: - update
* gen_addrpc32: absolute ptr needs *ABS* relocationZdenek Pavlas2017-09-111-2/+1
| | | | | | | Dereferencing of absolute pointers is broken on x86_64, eg: *(int*)NULL does not segfault but returns -4 instead *(char*)(-10L << 20) does not return 0x55 (vsyscall page, push rbp)
* Add test case for fastcall calling conventionZhang Boyang2017-09-103-1/+278
|
* Add test case for AL/AX extending problemZhang Boyang2017-09-103-0/+53
|
* Add test case for wide char handling in wide string literalZhang Boyang2017-09-102-0/+13
|
* Fix calling function pointers casted from intergers in DLLZhang Boyang2017-09-091-11/+3
| | | | | | The code generated for "((void (*)(void))0x12345678)()" will be a single "CALL 0x12345678" in previous code. However, this will not work for DLLs, because "CALL imm" is PC related, DLL relocation will break the code. This commit fixed the problem by forcing TCC generates indirect CALLs in this situation.
* Fix AL/AX is not extended to EAX when calling indirectlyZhang Boyang2017-09-091-6/+8
| | | | | AL/AX should be extended to EAX when calling functions. However, the previous code did this only for direct calls, indirect calls were ignored. New code also avoid redundant code when generating JMP instruction. (i.e. expanding code should be generated with CALL instruction only)
* Fix wide char handling in wide string literalZhang Boyang2017-09-091-1/+67
| | | | | | This commit fixed the problem that TCC directly cast each byte in wide string literal to wchar_t, which is wrong when wide string literal contains real wide chars. It fixed the problem by assuming input charset is UTF-8, and wchar_t stores wide chars in UTF-16 (Windows) or UTF-32 (others). The UTF-8 decoder is coded according to The Unicode Standard Version 10.
* called function should pop the arguments when using fastcallZhang Boyang2017-08-211-3/+3
|
* Convert from ISO-8859-1 to UTF-8. See aa812e8.Edmund Grimley Evans2017-07-261-1/+1
|
* Revert "use int for ssize_t, (u)intptr_t instead of long in stddef.h"Matthias Gatto2017-07-262-10/+3
| | | | | | This reverts commit 52622c3c0365ad497ce1188e433ac5f0a721c283. Because 28b7c9 was right.
* Revert "simplify VT_LONG parsing"matthias2017-07-251-3/+3
| | | | | | | | | Too simple long parsion. Take me a long long long time to see my mistake, Sorry (long long long wasn't see as an error) This reverts commit a4cd2805f95e1369254762478883e91050f2cba1.
* Remove debug echo in Cygwin MakefileChristian Jullien2017-07-251-1/+1
|
* Update Cygwin Makefile to use -B. for bootstrapChristian Jullien2017-07-251-26/+26
|
* use int for ssize_t, (u)intptr_t instead of long in stddef.hMatthias Gatto2017-07-252-3/+10
|
* check that _Generic match 'signed long int' as 'long'Matthias Gatto2017-07-252-0/+4
|
* simplify VT_LONG parsingMatthias Gatto2017-07-251-3/+3
|
* Update Cygwin Makefile to work with recent changes about ONE_SOURCE and ↵Christian Jullien2017-07-251-5/+7
| | | | CONFG_TCCDIR
* define __SIZE_TYPE__ and __PTRDIFF_TYPE__ as unsigned int and int.Matthias Gatto2017-07-251-2/+2
| | | | | | | As long is now a qualifier, and because compare_type will notice that variables are not the same type, we can't use long as int anymore. So, I've redefine __SIZE_TYPE__ as unsigned int and __PTRDIFF_TYPE__ as int.
* remove inside_generic hackMatthias Gatto2017-07-242-7/+8
| | | | | define uint64_t and int64_t as 'long' instead of 'long long' when __LP64__ is define.
* tccgen: nodata_wanted fix, default ONE_SOURCE, etc...grischka2017-07-2325-163/+350
| | | | | | | | | | | | | | | | | | | | | | | | | tccgen.c: doubles need to be aligned, on ARM. The section_reserve() in init_putv does not do that. -D ONE_SOURCE: is now the default and not longer needed. Also, tcc.h now sets the default native target. These both make compiling tcc simple as "gcc tcc.c -o tcc -ldl" again. arm-asm.c: enable pseudo asm also for inline asm tests/tests2/Makefile: disable bitfield tests except on windows and x86_64 and don't generate-always tcc.c: fix a loop with -dt on errors configure: print compiler version (as recognized) tccpp.c: actually define symbols for tcc -dt clear static variables (needed for -dt or libtcc usage) 96_nodata_wanted.c: use __label__ instead of asm lib/files: use native symbols (__i386__ etc.) instead of TCC_TARGET_...