aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Bugfix: 32-bit vs 64-bit bug in x86_64-gen.c:gcall_or_jmpPhilip2015-04-231-1/+2
| | | | | | | | | | | | | Verify an immediate value fits into 32 bits before jumping to it/calling it with a 32-bit immediate operand. Without this fix, code along the lines of ((int (*)(const char *, ...))140244834372944LL)("hi\n"); will fail mysteriously, even if that decimal constant is the correct address for printf. See https://github.com/pipcet/tinycc/tree/bugfix-1
* "#pragma once" implementationseyko2015-04-212-1/+4
|
* * and #pragma pop_macro("macro_name")seyko2015-04-218-3/+71
| | | | | | | | | | * give warning if pragma is unknown for tcc * don't free asm_label in sym_free(), it's a job of the asm_free_labels(). The above pragmas are used in the mingw headers. Thise pragmas are implemented in gcc-4.5+ and current clang.
* add missing test from -fdollar-in-identifiers commitRamsay Jones2015-04-202-0/+55
| | | | | | | Commit 5ce2154c ("-fdollar-in-identifiers addon", 20-04-2015) forgot to include the test files from Daniel's patch. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* -fdollar-in-identifiers addonseyko2015-04-204-13/+21
| | | | | | | * disable a -fdollar-in-identifiers option in assembler files * a test is added This is a patch addon from Daniel Holden.
* Fix program symbols exported in dynsym sectionThomas Preud'homme2015-04-181-12/+11
| | | | | | | | | | Prior to this commit TinyCC was exporting symbols defined in programs only when they resolve an undefined symbol of a library. However, the expected behavior (see --export-dynamic in GNU ld manpage) is that all symbols used by libraries and defined by a program should be exported in dynsym section. This is because symbol resolution search first in program and then in libraries, thus allowing program symbol to interpose symbol defined in a library.
* clarify error message when library not foundseyko2015-04-163-4/+3
| | | | | a prior error message: cannot find 'program_resolve_lib' after a patch: cannot find library 'libprogram_resolve_lib'
* implement #pragma comment(lib,...)Steven G. Messervey2015-04-154-1/+48
|
* Revert "implement #pragma comment(lib,...)"Steven G. Messervey2015-04-154-74/+15
| | | | | | This reverts commit 8615bb40fb39bf7435462ca54cbbc24aaecae502. Reverting as it breaks on MinGW targets
* implement #pragma comment(lib,...)Steven G. Messervey2015-04-154-15/+74
|
* ability to compile multiple *.c files with -c switchseyko2015-04-121-3/+26
| | | | Usage example: tcc -c -xc ex5.cgi -xn ex2.c ex7.c ex6.cgi
* ability to specify a type of the input file with the -x switchseyko2015-04-125-28/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | Usage example: tcc -xc ex5.cgi From a gcc docs: You can specify the input language explicitly with the -x option: -x language Specify explicitly the language for the following input files (rather than letting the compiler choose a default based on the file name suffix). This option applies to all following input files until the next -x option. Possible values for language are: c c-header c-cpp-output c++ c++-header c++-cpp-output objective-c objective-c-header objective-c-cpp-output objective-c++ objective-c++-header objective-c++-cpp-output assembler assembler-with-cpp ada f77 f77-cpp-input f95 f95-cpp-input java -x none Turn off any specification of a language, so that subsequent files are handled according to their file name suffixes (as they are if -x has not been used at all)
* -fdollar-in-identifiers switch which enables '$' in identifiersseyko2015-04-124-4/+13
| | | | | | | | | | library Cello: http://libcello.org/ which uses `$` and several variations of as macros. There is also RayLanguage which also uses it as a macro for a kind of ObjC style message passing: https://github.com/kojiba/RayLanguage This is a patch from Daniel Holden.
* A new file CodingStyle with rules for indentationseyko2015-04-121-0/+6
|
* replace a method to force bcheck.o linkingseyko2015-04-122-5/+9
| | | | | | * define __bound_init as external_global_sym insteed of the compiling a tiny program * remove warning about buf[] when CONFIG_TCC_BCHECK is not defined
* Fix for Microsoft compilersseyko2015-04-111-1/+1
| | | | | | | Correction for the commit db08122d31a681e593c6679140d2df0cc63c8784 As pointed Thomas Preud'homme buf[] may be used outside of the block whit code: name = block;
* option to use an old algorithm of the array in struct initializationseyko2015-04-103-4/+34
| | | | | | This is for a case when no '{' is used in the initialization code. An option name is -fold-struct-init-code. A linux 2.4.26 can't find initrd when compiled with a new algorithm.
* fix "handle a -s option" commitseyko2015-04-101-12/+8
| | | | for targets which don't support variable length arrays.
* fix a preprocessor for .Sseyko2015-04-103-4/+21
| | | | | | Lets assume that in *.S files a preprocessor directive follow '#' char w/o spaces between. Otherwise there is too many problems with the content of the comments.
* fix a preprocessor for .Sseyko2015-04-101-2/+6
| | | | | A test program (tcc -E test.S): # .. or else we have a high. This is a test.S
* fix a preprocessor for .Sseyko2015-04-102-19/+15
| | | | | | | | | | | | | | | | | | | | | | | | * tell a right line number in error message if a #line directive is wrong * don't print an error message if we preprocess a .S file and #line directive is wrong. This is the case of the # 4026 bytes comment in *.S file. * preprocess_skip: skip a line with if (parse_flags & PARSE_FLAG_ASM_COMMENTS) p = parse_line_comment(p); if line starts with # and a preprocessor command not found. A test program: #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) # This repeats until either a device doesn't exist, or until #endif * remove a second definition of the TOK_FLAG_* and PARSE_FLAG_* from the tccpp.c
* a bounds checking code for the ARCH=x86_64seyko2015-04-108-64/+319
|
* Add a demo.bat file to the examples directory on Windowsseyko2015-04-102-0/+970
| | | | And a new console demo program: taxi and passengers simulator
* fix installation amd bcheck for Windowsseyko2015-04-107-39/+70
| | | | | | | | | | | | | | | | | | | | | | * define targetos=Windows when --enable-tcc32-mingw, --enable-cygwin, ... * use TARGETOS insteed HOST_OS when selecting PROGS * use "$(tccdir)" insteed $(tccdir) on install (spaces in path) * install tcc.exe too * produce bcheck.o when cross-compiling too (lib/Makefile) * force bcheck.o linking by compiling inside tcc_set_output_type() a dummy program with local array. Otherwise bcheck.o may be not linked. * replace %xz format specifier with %p in bcheck (don't supported on Windows) * call a __bound_init when __bound_ptr_add, __bound_ptr_indir, __bound_new_region, __bound_delete_region called. This is because a __bound_init inside ".init" section is not called on Windows for unknown reason. * print on stderr a message when an illegal pointer is returned: there is no segmentation violation on Windows for a program compiled with "tcc -b" * remove "C:" subdir on clean if $HOST_OS = "Linux" * default CFLAGS="-Wall -g -O0" insteed CFLAGS="-Wall -g -O2" to speed up compilation and more precise debugging.
* handle a -s option by executing sstrip/strip programseyko2015-04-103-1/+18
|
* output all sections if we produce an executable fileseyko2015-04-101-0/+1
| | | | | | | | | | tcc w/o -g option generate an executable file which format is not recognized by binutils. It is like stripped one but binutils don't think so. Solution: generate not stripped file which can be correctly stripped by external utils. may be there is a need to handle a -s option and call a sstrip/strip program to do a job.
* remove a compilation warnings for libtest and test3seyko2015-04-102-0/+4
| | | | | | | | | | ------------ libtest ------------ ./libtcc_test lib_path=.. <string>:11: warning: implicit declaration of function 'printf' <string>:13: warning: implicit declaration of function 'add' ------------ test3 ------------ tcctest.c:1982: warning: implicit declaration of function 'putchar' tcctest.c:2133: warning: implicit declaration of function 'strlen'
* fix the bug #31403: parser bug in structureseyko2015-04-104-3/+23
| | | | | | - a warning: unnamed struct/union that defines no instances - allow a nested named struct declaration w/o identifier only when option -fms-extensions is used
* Fix to accommodate missing i386/bcheck.o during install on Mac OS XRaphael Cohn2015-04-071-1/+1
|
* Fix to test for HOST_OS not TARGETOSRaphael Cohn2015-04-071-1/+1
|
* Fixing bug for Linux x86_64 introduced in previous macosx commitRaphael Cohn2015-04-071-2/+2
|
* Adjusted configure host_os to use uname for DarwinRaphael Cohn2015-04-072-2/+11
| | | | | Adjusted Makefile to make it Darwin (Mac OS X 10.10)-friendly for cross-compilers by removing the creation of arm64 cross-compilers on this platform.
* Adjusted configure to be more BSD friendlyRaphael Cohn2015-04-071-1/+1
|
* a small revers for bcheck.o changes (d80593bc4d43)seyko2015-03-301-1/+1
| | | | | | replacing (addr > e->size) with (addr >= e->size) was correct only in one place, a second replacing is reversed by this commit.
* Fix for Microsoft compilersseyko2015-03-292-2/+2
| | | | | Miccrosoft Visual Sudio (Express) 2008 and 2010 do not accept variable definitions C99 style, reported by Fabio <oldfaber@gmail.com>
* fix for the bcheck.o (bug #14958)seyko2015-03-292-14/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | - care about __attribute__ redefinition in the system headers - an invalid pointer must be returned when (addr >= e->size), and not (addr > e->size) A test program: #include <stdio.h> #include <stdlib.h> int main () { int v[10]; fprintf(stderr, "&v[0] = %p\n", &v[0]); fprintf(stderr, "&v[10] = %p\n", &v[10]); exit(1); return 0; } // tcc -b test.c The output before a patch: &v[0] = 0xbf929d8c &v[10] = 0xbf929db4 The output after a patch: &v[0] = 0xbff6e33c &v[10] = 0xfffffffe
* fix: try to add a bounds.o only if __bounds_init not foundseyko2015-03-281-3/+6
| | | | | | | | | | | | | | | /usr/local/lib/tcc/i386/bcheck.o: error: '__bound_error_msg' defined twice #include <stdio.h> int main () { #if 1 int v[10]; v[10] = 0; fprintf(stderr, "is bounds error catched?\n"); #endif return 0; } // tcc -b test.c
* fix for the previous commit (compilation on RPi)seyko2015-03-262-2/+2
|
* make a bound checking more compatible with Windows 64seyko2015-03-266-53/+53
| | | | | | On Linux 32: sizeof(long)=32 == sizeof(void *)=32 on Linux 64: sizeof(long)=64 == sizeof(void *)=64 on Windows 64: sizeof(long)=32 != sizeof(void *)=64
* fix for the previous commit: tcc_add_support() was used before definitionseyko2015-03-261-25/+25
|
* fix: enforce bcheck.o linking when -b option is usedseyko2015-03-262-1/+10
| | | | | fixes a crash for the empry program (tcc -b empty.c) empty.c: int main() { return 0; }
* fix a bug #43984: tcc -run reports errno=2seyko2015-03-251-0/+4
| | | | | | | | | The following program (errno.c) reports errno=2 when run using "tcc -run errno.c" #include <errno.h> #include <stdio.h> int main(void) { printf("errno=%d\n", errno); return 0; }
* fix for a -dumpversion option: move it before -dDseyko2015-03-231-2/+2
| | | | | | | Options must be sorted and a long one must preceed a short one. What was before: tcc -dumpversion tcc: error: invalid option -- '-dumpversion'
* fix for: x86_64-tcc compiled by i386-tcc is wrongseyko2015-03-233-4/+4
| | | | | | | | | | | | | | | | | | | | | A test program (must be compiled by the above version of the tcc): /* Tickle a bug in TinyC on 64-bit systems: * the LSB of the top word or ARGP gets set * for no obvious reason. * * Source: a legacy language interpreter which * has a little stack / stack pointer for arguments. * * Output is: 0x8049620 0x10804961c * Should be: 0x8049620 0x804961c */ #include <stdio.h> #define NARGS 20000 int ARG[NARGS]; int *ARGSPACE = ARG; int *ARGP = ARG - 1; main() { printf("%p %p\n", ARGSPACE, ARGP); }
* fix a gcc compiler warning for the previous commitseyko2015-03-231-1/+1
| | | | mark a constant as long long (or -std=gnu99 is needed)
* revert a commit: Work around for the issue TCC doesn't handle -2147483648 ↵seyko2015-03-231-1/+1
| | | | | | | properly because a tcc handle now -2147483648 properly. Look a commit: Make integer constant parsing C99 compliant
* A right fix for the array in struct initialization w/o '{'seyko2015-03-234-21/+116
| | | | | Parse a type if there is only one '(' before a type token. Otherwise a recursion will perform a job.
* Revert of the commit: fix for the array in struct initialization w/o '{', case 2seyko2015-03-231-16/+9
| | | | A right solution for this problem will follow.
* quick fix for the native tcc on debian/ubuntuseyko2015-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Force to use a NATIVE_DEFINES insteed of the DEFINES for the native tcc. After this change we have on debian/ubuntu # ./x86_64-tcc -vv tcc version 0.9.26 (x86-64, Linux) install: /usr/local/lib/tcc crt: /usr/lib/x86_64-linux-gnu libraries: /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib /usr/local/lib/x86_64-linux-gnu /usr/local/lib include: /usr/local/include/x86_64-linux-gnu /usr/local/include /usr/include/x86_64-linux-gnu /usr/include /usr/local/lib/tcc/include elfinterp: /lib64/ld-linux-x86-64.so.2 Before this change the output was # ./x86_64-tcc -vv tcc version 0.9.26 (x86-64, Linux) install: /usr/local/lib/tcc crt: /usr/lib libraries: /usr/lib /lib /usr/local/lib include: /usr/local/include /usr/include /usr/local/lib/tcc/include elfinterp: /lib64/ld-linux-x86-64.so.2 This change don't fix a cross compilers
* configure: don't output CONFIG_LDDIR when build_cross = "yes"seyko2015-03-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This fixes i386-tcc on CentOS 7. After patch [root@centos7 tinycc]# ./i386-tcc -vv tcc version 0.9.26 (i386, Linux) install: /usr/local/lib/tcc crt: /usr/lib libraries: /usr/lib /lib /usr/local/lib Before patch: [root@centos7 tinycc]# ./i386-tcc -vv tcc version 0.9.26 (i386, Linux) install: /usr/local/lib/tcc crt: /usr/lib64 libraries: /usr/lib64 /lib64 /usr/local/lib64