aboutsummaryrefslogtreecommitdiff
path: root/tcc.h
Commit message (Collapse)AuthorAgeFilesLines
* fix push_macro, asked Tom to help me testfix push_macrojiang2014-05-161-1/+1
|
* restore 2dd8587c2f32d17a2cd0443a60a614a3fa9bbe29jiang2014-05-131-2/+10
|
* Return to: e20c1eb99e1003c1e59522c136dbb15c52d7cc7cjiang2014-05-041-29/+11
| | | | | | | | | | | | | | | | | | | | | | | 1: The new patch for the other machines still have the problem. 2: libcrt Rename (what if gcc had libcrt as well) 3: parse_number exact problem 4: VT_VLS is to allow tcc Compile the following int b = 9; struct st { int a; int b [b] }; struct st st1; st1.b [8] = 9; printf ("% d \ n", st1.b [8]); tcc a problem. Due to problems in front, and now can not be improved 5: they commit much, bug difficult to lock, you can not let other people help develop. 6: ('\ t') too Thanks to Michael and Ray Their criticism I have benefited!
* tcc on i386 are still having problems at work.Thank Roy report again. Struck ↵jiang2014-05-031-2/+0
| | | | on several variables can be connected to commit in the register. I am worried whether tcc can run the os. Since my machine is ubuntu 64 bits I can test my machine.
* Fix x86-64 vlajiang2014-05-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, it should look like this High stack ------------- ----- Func_ret_sub ------------ ---- Vla stack ------------- ---- Known loc -------------- Low Increased loc_stack () function is used for temporary stack management, call save_reg (), released by load () Like this Before use High ----- Known loc ---- --- ---- ---- Pop_stack Low loc_stack (size, 1) After use High ----- Known loc ---- Pop_stack --- ---- ---- Low
* Fixes include the double quotes bugjiang2014-05-021-2/+10
| | | | | Added push_macro, pop_macro support Fix pack bug, when output with-E will pack the bug
* update for x86_64-gen.cjiang2014-05-011-0/+2
|
* fix its own making bug. Improved init_putz (). Modify the tests / Makefile ↵jiang2014-05-011-0/+2
| | | | to make the test more secure
* Expansion code again for x86_64-genjiang2014-05-011-5/+7
|
* rename i386-tok.h i386-asm.c, add PRINTF_ASM_CODEjiang2014-04-301-0/+1
|
* rename libtcc1.cjiang2014-04-301-1/+1
|
* Fix va_arg bug, Fix type conversion bug, an increase of loc_stack () ↵jiang2014-04-301-0/+1
| | | | function is used to manage loc
* Reduce the generation of machine code for x86_64, Less of sizejiang2014-04-291-3/+5
|
* tccpe: adjust for new 'hidden' symbols featuregrischka2014-04-171-0/+4
| | | | | in order to avoid conflicts with windows specific (ab)usage of the Elf32_Sym -> st_other field.
* Parse and emit hidden visibilityMichael Matz2014-04-141-2/+10
| | | | | | | This adds parsing of (GCC compatible) visibility attribute in order to mark selected global symbols as hidden. The generated .o files contain hidden symbols already, the TCC linker doesn't yet do the right thing.
* Fix preprocessor concat with empty argThomas Preud'homme2014-04-121-0/+1
|
* tcc.h: add ELF interpreter for DragonFly BSD.minux2014-04-121-0/+2
|
* ELF: Remove traces of old RUNTIME_PLTGOT codeMichael Matz2014-04-061-6/+0
| | | | | The last users of it went away, no use in keeping this code.
* arm: Use proper PLT/GOT for -run.Michael Matz2014-04-061-1/+1
| | | | | | | | | | | Same as with x86_64, disable the runtime_plt_and_got hack for -run on arm as well. For that we need to handle several relocations as (potentially) generating PLT slots as well. Tested with mpfr-3.1.2 and gawk (both using --disable-shared), there are two resp. five pre-existing problems, so no regressions. This also works toward enabling real shared libs for arm, but it's not there yet.
* x86_64: Create proper PLT and GOT also for -runMichael Matz2014-04-061-1/+2
| | | | | | This makes us use the normal PLT/GOT codepaths also for -run, which formerly used an on-the-side blob for the jump tables. For x86_64 only for now, arm coming up.
* tccgen: x86_64: fix garbage in the SValue upper bitsgrischka2014-04-041-37/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was going wrong (case TOK_LAND in unary: computed labels) - vset(&s->type, VT_CONST | VT_SYM, 0); - vtop->sym = s; This does the right thing and is shorter: + vpushsym(&s->type, s); Test case was: int main(int argc, char **argv) { int x; static void *label_return = &&lbl_return; printf("label_return = %p\n", label_return); goto *label_return; //<<<<< here segfault on linux X86_64 without the memset on vset printf("unreachable\n"); lbl_return: return 0; } Also:: - Rename "void* CValue.ptr" to more usable "addr_t ptr_offset" and start to use it in obvious cases. - use __attribute__ ((noreturn)) only with gnu compiler - Revert CValue memsets ("After several days searching ...") commit 4bc83ac3933efa565ae3326b55fcd711b63c073d Doesn't mean that the vsetX/vpush thingy isn't brittle and there still might be bugs as to differences in how the CValue union was set and is then interpreted later on. However the big memset hammer was just too slow (-3% overall).
* x86-64: shared libs improvementMichael Matz2014-03-311-1/+1
| | | | | | | | | | This correctly resolves local references to global functions from shared libs to their PLT slot (instead of directly to the target symbol), so that interposition works. This is still not 100% conforming (executables don't export symbols that are also defined in linked shared libs, as they must), but normal shared lib situations work.
* Add __attribute__ ((noreturn)) to tcc_error and expect functions.mingodad2014-03-301-2/+2
| | | | This make use of static analysis tools like scan-build report less false positives.
* tccpp: reorder some tokensgrischka2014-03-291-15/+18
| | | | | | ... and make future reordering possibly easier related to 9a6ee577f6165dccfde424732bfc6f16f1e2811b
* Simplify and fix GOT32 + PLT32 reloc commitThomas Preud'homme2014-03-261-0/+1
| | | | | | | | Introduce a new attribute to check the existence of a PLT entry for a given symbol has the presence of an entry for that symbol in the dynsym section is not proof that a PLT entry exists. This fixes commit dc8ea93b13faefb565fb937f8b8c08c40c063549.
* Def signedness != signed != unsigned for charThomas Preud'homme2014-02-061-1/+1
| | | | | | | | When checking for exact compatibility between types (such as in __builtin_types_compatible_p) consider the case of default signedness to be incompatible with both of the explicit signedness for char. That is, char is incompatible with signed char *and* unsigned char, no matter what the default signedness for char is.
* Add support for runtime selection of float ABIThomas Preud'homme2014-01-081-6/+15
|
* be stricter with aliasinggrischka2014-01-071-31/+26
| | | | | | | | | | | | | | Refactoring (no logical changes): - use memcpy in tccgen.c:ieee_finite(double d) - use union to store attribute flags in Sym Makefile: "CFLAGS+=-fno-strict-aliasing" basically not necessary anymore but I left it for now because gcc sometimes behaves unexpectedly without. Also: - configure: back to mode 100755 - tcc.h: remove unused variables tdata/tbss_section - x86_64-gen.c: adjust gfunc_sret for prototype
* misc. fixesgrischka2014-01-061-15/+15
| | | | | | | | | | | | | | | | | | | | | | - tccgen: error out for cast to void, as in void foo(void) { return 1; } This avoids an assertion failure in x86_64-gen.c, also. also fix tests2/03_struct.c accordingly - Error: "memory full" - be more specific - Makefiles: remove circular dependencies, lookup tcctest.c from VPATH - tcc.h: cleanup lib, include, crt and libgcc search paths" avoid duplication or trailing slashes with no CONFIG_MULTIARCHDIR (as from 9382d6f1a0e2d0104a82ed805207d9e742c6b068) - tcc.h: remove ";{B}" from PE search path in ce5e12c2f950052d8109b6b7a56d900547705c08 James Lyon wrote: "... I'm not sure this is the right way to fix this problem." And the answer is: No, please. (copying libtcc1.a for tests instead) - win32/build_tcc.bat: do not move away a versioned file
* Fix struct ret in variadic fct with ARM hardfloatThomas Preud'homme2014-01-061-1/+2
| | | | | | | | | | | | | The procedure calling standard for ARM architecture mandate the use of the base standard for variadic function. Therefore, hgen float aggregate must be returned via stack when greater than 4 bytes and via core registers else in case of variadic function. This patch improve gfunc_sret() to take into account whether the function is variadic or not and make use of gfunc_sret() return value to determine whether to pass a structure via stack in gfunc_prolog(). It also take advantage of knowing if a function is variadic or not move float result value from VFP register to core register in gfunc_epilog().
* Don't enable bound check if libgcc is usedThomas Preud'homme2014-01-061-1/+2
| | | | | Bound check rely on some functions provided by libtcc. It should therefore not be enabled when libgcc is used.
* Fix CONFIG_TCC_SYSINCLUDEPATHS on !win32 systemsRamsay Jones2013-10-021-2/+4
| | | | | | | | | | | Commit 9382d6f1 ("Fix lib, include, crt and libgcc search paths", 07-09-2013) inadvertently included an initial empty entry to the CONFIG_TCC_SYSINCLUDEPATHS variable (for non win32 targets). In addition to an empty line in the 'tcc -vv' display, this leads to the preprocessor attempting to read an include file from the root of the filesystem (i.e. '/header.h'). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Generate an error when a function is redefinedThomas Preud'homme2013-09-161-1/+3
| | | | | | | | | Use one more bit in AttributeDef to differenciate between declared function (only its prototype is known) and defined function (its body is also known). This allows to generate an error in cases like: int f(){return 0;} int f(){return 1;}
* Fix lib, include, crt and libgcc search pathsThomas Preud'homme2013-09-071-10/+11
|
* i386-gen: preserve fp control word in gen_cvt_ftoigrischka2013-08-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | - 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
* Improved variable length array support.James Lyon2013-04-271-1/+17
| | | | | | | | | | | | | | | VLA storage is now freed when it goes out of scope. This makes it possible to use a VLA inside a loop without consuming an unlimited amount of memory. Combining VLAs with alloca() should work as in GCC - when a VLA is freed, memory allocated by alloca() after the VLA was created is also freed. There are some exceptions to this rule when using goto: if a VLA is in scope at the goto, jumping to a label will reset the stack pointer to where it was immediately after the last VLA was created prior to the label, or to what it was before the first VLA was created if the label is outside the scope of any VLA. This means that in some cases combining alloca() and VLAs will free alloca() memory where GCC would not.
* Fixed problems with XMM1 use on Linux/x86-64.James Lyon2013-04-191-4/+0
| | | | | | All tests pass. I think I've caught all the cases assuming only XMM0 is used. I expect that Win64 is horribly broken by this point though, because I haven't altered it to cope with XMM1.
* Got test1-3 working on x86-64.James Lyon2013-04-191-0/+3
| | | | | | There are probably still issues on x86-64 I've missed. I've added a few new tests to abitest, which fail (2x long long and 2x double in a struct should be passed in registers).
* x86-64 ABI fixes.James Lyon2013-04-191-0/+2
| | | | | | | | | abitest now passes; however test1-3 fail in init_test. All other tests pass. I need to re-test Win32 and Linux-x86. I've added a dummy implementation of gfunc_sret to c67-gen.c so it should now compile, and I think it should behave as before I created gfunc_sret.
* Tests in abitest.c now work on Win32.James Lyon2013-04-181-0/+1
| | | | | | | I expect that Linux-x86 is probably fine. All other architectures except ARM are definitely broken since I haven't yet implemented gfunc_sret for these, although replicating the current behaviour should be straightforward.
* Added ABI compatibility tests with native compiler using libtcc.James Lyon2013-04-171-1/+1
| | | | | | | | | | Only one test so far, which fails on Windows (with MinGW as the native compiler - I've tested the MinGW output against MSVC and it appears the two are compatible). I've also had to modify tcc.h so that tcc_set_lib_path can point to the directory containing libtcc1.a on Windows to make the libtcc dependent tests work. I'm not sure this is the right way to fix this problem.
* added CPATH, C_INCLUDE_PATH and LD_LIBRARY_PATHAndrew Aladjev2013-02-191-0/+2
|
* Fix GNU Hurd interpreter pathThomas Preud'homme2013-02-181-0/+2
|
* Add support for KfreeBSD 64bitsThomas Preud'homme2013-02-181-1/+5
|
* add version number to manpageUrs Janssen2013-02-171-14/+14
| | | | | | | 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)
* - document -dumpversionUrs Janssen2013-02-151-1/+1
| | | | - fixed a broken prototype
* Revert "Don't search libgcc_s.so.1 on /lib64"Thomas Preud'homme2013-02-141-5/+1
| | | | This reverts commit b9f089fc4a3c852858bbc8e60c5ac19b7736d7a9.
* Don't search libgcc_s.so.1 on /lib64Thomas Preud'homme2013-02-141-1/+5
| | | | | It seems libgcc_s.so.1 is systematically on /lib/ (whether /lib/$triplet for multiarch systems or just /lib for other systems).
* configure: pass CONFIG_xxxDIR/PATH options via commandlinegrischka2013-02-141-0/+2
| | | | | | | | | | | | | | | - except for CONFIG_SYSROOT and CONFIG_TCCDIR Strictly neccessary it is only for CONFIG_MULTIARCHDIR because otherwise if it's in config.h it is impossible to leave it undefined. But it is also nicer not to use these definitions for cross-compilers. - Also: lib/Makefile : include ../Makefile for CFLAGS lib/libtcc1.c : fix an issue compiling tcc with tcc on x64
* configure: cleanupgrischka2013-02-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add quotes: eval opt=\"$opt\" - use $source_path/conftest.c for OOT build - add fn_makelink() for OOT build - do not check lddir etc. on Windows/MSYS - formatting config-print.c - rename to conftest.c (for consistency) - change option e to b - change output from that from "yes" to "no" - remove inttypes.h dependency - simpify version output Makefile: - improve GCC warning flag checks tcc.h: - add back default CONFIG_LDDIR - add default CONFIG_TCCDIR also (just for fun) tccpp.c: - fix Christian's last warning tccpp.c: In function ‘macro_subst’: tccpp.c:2803:12: warning: ‘*((void *)&cval+4)’ is used uninitialized in this function [-Wuninitialized] That the change fixes the warning doesn't make sense but anyway. libtcc.c: - tcc_error/warning: print correct source filename/line for token :paste: (also inline :asm:) lddir and multiarch logic still needs fixing.