aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fixes for issues I've just found/introduced to x86 TCC.Shinichiro Hamaji2009-04-182-3/+6
| | | | | - Cast from pointer to long long makes TCC output an error. Use cast to int before we apply shift operation for a pointer value. - Removed test cases for casts from pointer to char/short because they produce warning.
* x86-64: Cast from 64bit pointer to long long must not generate movslq.Shinichiro Hamaji2009-04-182-1/+11
|
* win32: accept uppercase filename suffixesgrischka2009-04-181-3/+5
|
* x86-64: There can be valid addresses which is greater than 0xc0000000.Shinichiro Hamaji2009-04-181-1/+1
|
* Fix for x86-64: The first and second arguments of memcpy must be pointers.Shinichiro Hamaji2009-04-181-2/+2
|
* Fix silly typos in the previous change.Shinichiro Hamaji2009-04-181-2/+2
|
* x86-64: Make ABI for long double compatible with GCC.Shinichiro Hamaji2009-04-182-3/+31
| | | | | | - Now we use x87's stack top the long double return values. - Add rc_fret and reg_fret, wrapper functions for RC_FRET and REG_FRET. - Add a test case to check if strto* works OK.
* Improve the test coverage: !val for float/double/long long f.Shinichiro Hamaji2009-04-182-1/+4
|
* x86-64: Combine buffers of sections before we call tcc_run().Shinichiro Hamaji2009-04-183-47/+56
| | | | | | | - Now we can run tcc -run tcc.c successfully, though there are some bugs. - Remove jmp_table and got_table and use text_section for got and plt entries. - Combine buffers in tcc_relocate(). - Use R_X86_64_64 instead of R_X86_64_32 for R_DATA_32 (now the name R_DATA_32 is inappropriate...).
* Generate PIC code so that we can create shared objects properly.Shinichiro Hamaji2009-04-183-34/+128
| | | | | | - Add got_table in TCCState. This approach is naive and the distance between executable code and GOT can be longer than 32bit. - Handle R_X86_64_GOTPCREL properly. We use got_table for TCC_OUTPUT_MEMORY case for now. - Fix load() and store() so that they access global variables via GOT.
* check for absolute include pathsgrischka2009-04-181-6/+16
| | | | Suggested by Sandor Zsolt <narkoskatona@yahoo.com>
* get rid of "free_section problem" with private sectionsgrischka2009-04-181-13/+14
|
* tiny_libmaker: fix function array overflowgrischka2009-04-181-6/+6
|
* accept "restrict" in array-decl (STDC 199901)grischka2009-04-181-0/+2
|
* i386: apply "align=8 for doubles ..." for PE onlygrischka2009-04-181-0/+4
|
* x86-64: Now TCC can create healthy shared objects from object files ↵Shinichiro Hamaji2009-04-181-2/+8
| | | | | | | generated by GCC - Handle R_X86_64_GOTPCREL. - Output R_X86_64_RELATIVE reloc generated from R_X86_64_64.
* x86-64 bug fix: Fix stab generation for x86-64.Shinichiro Hamaji2009-04-181-3/+3
| | | | The size of a stab entry is 12 bytes even in 64bit environments. We must use int instead of long to keep the size of stab entries.
* x86-64 bug fix: Use stack with alignment just like 32bit environments.Shinichiro Hamaji2009-04-181-5/+4
|
* x86-64: Save RDX and RCX before we use them as function parameters.Shinichiro Hamaji2009-04-181-2/+2
| | | | When the function call is indirect, these registers may be broken to load a function pointer.
* Remove multiple definition error caused by combination of x86-64 and va_list.Shinichiro Hamaji2009-04-183-7/+25
| | | | | 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.
* Better DLL support on x86-64.Shinichiro Hamaji2009-04-181-8/+39
| | | | | | | | | | | | - Add a macro TCC_OUTPUT_DLL_WITH_PLT. -- Now, the DLL with PLT support works only on x86-64, but we may be able to support it on all architectures eventually. - Define TCC_OUTPUT_DLL_WITH_PLT when target architecture is x86-64. - Current status (x86-64): -- Main program should be able to call functions in shared objects. -- Main program should be able to use global variables in shared objects. -- Shared objects should be able to call functions in main program. -- Shared objects can NOT use global variables in main program. - To fix the last issue, we may need to add support of -fPIC option in our code generator.
* First naive DLL support on x86-64.Shinichiro Hamaji2009-04-181-3/+33
| | | | This logic depends on x86_64-gen.c and doesn't work with objects compiled by GCC.
* Generate PIC for addresses of symbols.Shinichiro Hamaji2009-04-181-11/+8
|
* Suppress noisy pointer signed-ness warnings on x86-64.Shinichiro Hamaji2009-04-181-0/+4
|
* Code cleaning: utilize vpushll().Shinichiro Hamaji2009-04-181-7/+1
|
* Support long long bitfields for all architectures.Shinichiro Hamaji2009-04-182-10/+46
| | | | | | - Modified gv() and vstore(), added vpushll(). - Added a test case for long long bitfields. - Tested on x86 and x86-64.
* A uint64 bug fix on x86-64Shinichiro Hamaji2009-04-182-1/+3
| | | | | 64bit unsigned literal was handled as 32bit integer. Added a unittest to catch this.
* Allow long long as a type of bitfields on x86-64.Shinichiro Hamaji2009-04-181-1/+5
|
* win32: allow user segments as writable & executablegrischka2009-04-181-1/+3
|
* 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>
* string_test: we should always use 'unsigned int' for bKirill Smelkov2009-04-181-4/+0
| | | | | | | | | | | | | | | | | | | | As recently shown in fb0ac2 (s/int/unsigned/ since GCC 4.3.2 produces code which doesn't stop) comparing (signed) int variable to 0x80000000 is not idea for x86_64. This is not a good idea for x86_32 either, because GCC 4.3.2 (the one in Debian Lenny) rightly assumes that a signed int could be never 0x80000000, and thus removes the check from while (b != 0x80000000) { ... completely. If we want this check, we need b to be always 'unsigned' 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 several test cases.Shinichiro Hamaji2008-12-021-0/+141
|
* Add support of x86-64.Shinichiro Hamaji2008-12-027-15/+1724
| | | | | | | | | | | | | | | | | | | | | | 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
* s/int/unsigned/ since GCC 4.3.2 produces code which doesn't stop.Shinichiro Hamaji2008-12-021-0/+4
|
* Suport LDOUBLE_SIZE == 16 environment.Shinichiro Hamaji2008-12-021-3/+15
|
* silly bug fix: s/#ifdef PTR_SIZE == 4/#if PTR_SIZE == 4/Shinichiro Hamaji2008-12-021-1/+1
|
* Make tccelf.c 64bit ready.Shinichiro Hamaji2008-12-021-9/+20
| | | | | | | - Use REL_SECTION_FMT instead of ".rel%s". - Use PTR_SIZE instead of sizeof(int) for GOT entries. - Use sizeof(ElfW(Dyn)) instead of magic number 8. - Use TCC_ELFCLASS instead of ELFCLASS32.
* One more s/int/long/Shinichiro Hamaji2008-12-021-1/+1
|
* Use int*2 instead of long*2 to hold double value.Shinichiro Hamaji2008-12-021-4/+4
| | | | I believe sizeof(double) is sizeof(int)*2 in most environments. On the other hand, sizeof(long) is equal to sizeof(double) in x86-64.
* Use long instead of int to hold pointer values.Shinichiro Hamaji2008-12-021-4/+4
|
* Add __builtin_frame_address(0)Shinichiro Hamaji2008-12-022-0/+19
| | | | | 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.
* Imported several macros required by x86-64Shinichiro Hamaji2008-12-021-3/+74
|
* Introduce ElfW macro and ELFW to encapsulate the difference between Elf32_* ↵Shinichiro Hamaji2008-12-023-177/+198
| | | | and Elf64_*. Also, introduce ElfW_Rel and SHT_RELX for difference between REL and RELA.