aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
Commit message (Collapse)AuthorAgeFilesLines
* x86-64 bug fix: Use stack with alignment just like 32bit environments.Shinichiro Hamaji2009-04-181-5/+4
|
* Remove multiple definition error caused by combination of x86-64 and va_list.Shinichiro Hamaji2009-04-181-0/+18
| | | | | We need malloc and free to implement va_start and va_end. Since malloc and free may be replaced by #define, we add __builtin_malloc and __builtin_free.
* Add check for invalid numbers.Shinichiro Hamaji2009-04-181-0/+2
| | | | | | | | If there are some characters after TCC parses a number, it is an error. This bug was reported on list: http://www.mail-archive.com/tinycc-devel@nongnu.org/msg02014.html
* Fix overrun in decl_initializer_alloc.Shinichiro Hamaji2009-04-181-2/+4
| | | | | | | | This bug was reported on http://lists.gnu.org/archive/html/tinycc-devel/2009-03/msg00035.html This happens because parser of array initializer doesn't stop to read until semi-colon or comma.
* Code cleaning: utilize vpushll().Shinichiro Hamaji2009-04-181-7/+1
|
* Support long long bitfields for all architectures.Shinichiro Hamaji2009-04-181-10/+31
| | | | | | - Modified gv() and vstore(), added vpushll(). - Added a test case for long long bitfields. - Tested on x86 and x86-64.
* Allow long long as a type of bitfields on x86-64.Shinichiro Hamaji2009-04-181-1/+5
|
* i386: align=8 for double and long longgrischka2009-04-181-1/+1
|
* win32: fix for VC8Express compilergrischka2009-04-181-2/+7
|
* tcc -E: preserve spaces (partial solution)Kirill Smelkov2009-04-181-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recently I needed to trim storage space on an embedded distro which has X. X depend on cpp which is ~8MB in size as shipped in Debian, so the idea was to remove cpp and use `tcc -E` instead where appropriate. I've done this with the following 'hack' put inplace of /usr/bin/cpp : #!/bin/sh -e TCC=/home/kirr/local/tcc/bin/tcc last="${!#}" # hack to distinguish between '... -D...' and '... file' if test -r "$last"; then exec $TCC -E "$@" else exec $TCC -E "$@" - fi But the problem turned out to be in `tcc -E` inability to preserve spaces between tokens. So e.g. the following ~/.Xresources XTerm*VT100*foreground: black ... got translated to XTerm * VT100 * foreground : black which is bad, bacause now X don't understand it. Below is a newbie "fix" for the problem. It still does not preserve spaces on macro expansion, but since the fix cures original problem, I think it is at least one step forward. Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
* type_size function returned incorrect sizeAlexander Egorenkov2009-04-181-1/+8
| | | | of multi dimensional arrays if dimension is divisable by 2
* fix constant optimization for unsignedsgrischka2009-04-181-2/+14
|
* fix data overflow with init_putvgrischka2008-12-021-0/+4
| | | | | The simplest code to reproduce this bug seems to be int a[][] = {{1,1,1,1,1,1,1}};
* Add support of x86-64.Shinichiro Hamaji2008-12-021-10/+128
| | | | | | | | | | | | | | | | | | | | | | Most change was done in #ifdef TCC_TARGET_X86_64. So, nothing should be broken by this change. Summary of current status of x86-64 support: - produces x86-64 object files and executables. - the x86-64 code generator is based on x86's. -- for long long integers, we use 64bit registers instead of tcc's generic implementation. -- for float or double, we use SSE. SSE registers are not utilized well (we only use xmm0 and xmm1). -- for long double, we use x87 FPU. - passes make test. - passes ./libtcc_test. - can compile tcc.c. The compiled tcc can compile tcc.c, too. (there should be some bugs since the binary size of tcc2 and tcc3 is differ where tcc tcc.c -o tcc2 and tcc2 tcc.c -o tcc3) - can compile links browser. It seems working. - not tested well. I tested this work only on my linux box with few programs. - calling convention of long-double-integer or struct is not exactly the same as GCC's x86-64 ABI. - implementation of tcc -run is naive (tcc -run tcctest.c works, but tcc -run tcc.c doesn't work). Relocating 64bit addresses seems to be not as simple as 32bit environments. - shared object support isn't unimplemented - no bounds checker support - some builtin functions such as __divdi3 aren't supported
* Suport LDOUBLE_SIZE == 16 environment.Shinichiro Hamaji2008-12-021-3/+15
|
* One more s/int/long/Shinichiro Hamaji2008-12-021-1/+1
|
* Use long instead of int to hold pointer values.Shinichiro Hamaji2008-12-021-4/+4
|
* Add __builtin_frame_address(0)Shinichiro Hamaji2008-12-021-0/+18
| | | | | Adding the GCC extension __builtin_frame_address(). We support only zero as the argument for now. With this functionality, we can implement GCC compatible stdarg by macros in x86-64.
* Introduce ElfW macro and ELFW to encapsulate the difference between Elf32_* ↵Shinichiro Hamaji2008-12-021-14/+15
| | | | and Elf64_*. Also, introduce ElfW_Rel and SHT_RELX for difference between REL and RELA.
* Futher changes to castsDaniel Glöckner2008-11-301-3/+6
| | | | | | | | | nocode_wanted can't be used to enforce constant expressions, as it is set f.ex. by __builtin_constant_p. A null pointer is unequal to a pointer to any object or function. Assuming symbols always point to memory, a symbol+constant cast to bool is always true.
* Fix get_tok_str wrt wide charactersDaniel Glöckner2008-11-301-2/+4
| | | | Fixes both, character constants and string literals.
* Rewrote '?' for constantsDaniel Glöckner2008-11-301-7/+10
| | | | | The condition is now cast to _Bool and it now works with return types bigger than 32 bit.
* Cast parameter of '!' to _BoolDaniel Glöckner2008-11-301-2/+5
|
* Rewrote castsDaniel Glöckner2008-11-301-115/+101
| | | | | | | | | Casting of constants was done only inside functions. I restructured the code and used intermediate types (long double/long long) for most conversions to have less ifs. Please review. There are lots of cases to take care of and lots of mistakes to make.
* line-numbers output for TCC -Egrischka2008-11-301-12/+25
|
* was hash, not linkgrischka2008-09-151-1/+1
|
* Display error on statement expressions with complex return typeDaniel Glöckner2008-09-121-0/+14
| | | | | | | | | | | The return type of a statement expression (a GCC extention) may involve elements on the symbol stack that have been put there by the expression. These will be freed at the end of the expression so that the calling block can not use them. Contrary to the comment (written in 2003), this bug no longer shows up in Valgrind, as freed symbols are now put onto a stack for later reuse.
* Fix bitfields with non-int types and in unionsDaniel Glöckner2008-09-121-8/+28
| | | | | | | | | | | | | | | | | The ISO C draft allow only signed/unsigned int and _Bool as base type for bitfields. TinyCC ever since allowed a wider range of types, but there were many bugs that shifted values when they shouldn't, etc.. The patch introduces a restriction to the layout of bitfields with mixed types that makes it incompatible with GCC. In struct { typeA x:1; typeB y:1; }; y is combined with x in the same byte iff typeA is typeB (neglecting signedness). This is done to avoid alignment issues and exceeding the width of typeA.
* Force null pointer exception for code outside of a functionDaniel Glöckner2008-09-121-0/+3
| | | | | | | | | | TinyCC sometimes has problems to evaluate constant expressions at compile time. This leads to code being generated outside of functions. Without this patch some of these bugs are not caught, because cur_text_section still points to the section of the last function. Before the first function cur_text_section is uninitialized. Setting cur_text_section to a null pointer should make TinyCC die in all cases.
* Optimize arithmetic with pointer to value on stack + constantDaniel Glöckner2008-09-121-2/+3
|
* Fix gv for long longsDaniel Glöckner2008-09-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | long long a(); long long b() { return a(); } At the end of b there will be some useless register shuffling. This is because return wants to have the result of a in REG_IRET. gv checks if this is the case for BOTH registers of the long long. After this test it uses REG_LRET for the second register if the first is supposed to be REG_IRET. In other cases it uses RC_INT. The patch compares the second register against the class it will have in the end instead of the register class the first register will have. At this point I would like to remind those who pick up the patches that there are two other mails by me with uncommitted fixes: http://lists.gnu.org/archive/html/tinycc-devel/2003-10/msg00044.html http://lists.gnu.org/archive/html/tinycc-devel/2008-08/msg00007.html Daniel
* A prefix for default library/include search pathsDaniel Glöckner2008-09-121-6/+6
| | | | | | | | | This patch is useful for cross compilers. Without this patch tcc tries to use the host's libraries, crt*.o and include files. The patch prepends a string to all default paths. The string can be passed to configure with --sysroot=string. Daniel
* Runtime lib functionsDaniel Glöckner2008-09-121-17/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | Yesterday I felt the urge to change a few things in TinyCC. This is the first and biggest change of all of them. - use __aeabi_*divmod functions in ARM EABI to make binaries depend solely on standardized library functions - refactor ARM floating point <-> integer conversion a bit - rename long long->float and shift library functions to correspond to the names used by GCC - compile more tokens conditionally to reduce the size of TinyCC The intention is primarily to allow users of the ARM target to use libgcc (which is usually available as a shared library) instead of libtcc1 (which can't be compiled for ARM due to lack of an inline assembler). Changing the EABI target to use the divmod functions in theory allows to use it without libtcc1 on any (not necessarily GCC based) ARM EABI system. Daniel
* fix isidnum_table for CH_EOF (-1)grischka2008-09-121-5/+5
|
* free_section bugfixgrischka2008-09-121-2/+2
|
* release loaded dlls cleanly (Sam K)grischka2008-05-051-2/+11
|
* enable pe-output from libtcc (Shmuel Zeigerman)grischka2008-05-051-7/+0
|
* fix options in C scripts after -rungrischka2008-04-271-17/+14
|
* fix stabstr with linked objectsgrischka2008-04-271-0/+2
|
* enable multiple states and fix minor memory leaksgrischka2008-04-271-16/+48
|
* update manual, changeloggrischka2008-03-311-0/+2
|
* added verbosity levels (-vv -vvv)grischka2008-03-311-13/+24
|
* Accept standard input as an inputstream (Hanzac Chen)grischka2008-03-311-8/+9
|
* Add -soname linker option (Marc Andre Tanner)grischka2008-03-251-2/+11
|
* Enable -B option for library path on win32grischka2008-03-081-9/+9
|
* Just warn about unknown directives, define __STDC_VERSION__=199901Lgrischka2008-01-161-14/+22
|
* Switch to newer tccpe.c (includes support for resources)grischka2007-12-191-135/+174
|
* Handle backslashes within #include, #error, #warninggrischka2007-12-171-8/+21
|
* Import changesets (part 4) 428,457,460,467: defines for openbsd etc.grischka2007-12-161-4/+10
|
* Use _WIN32 for a windows hosted tcc and define it for the PE target.grischka2007-12-131-48/+52
|