aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
Commit message (Collapse)AuthorAgeFilesLines
* clarify error message when library not foundseyko2015-04-161-1/+1
| | | | | 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-151-0/+18
|
* Revert "implement #pragma comment(lib,...)"Steven G. Messervey2015-04-151-31/+13
| | | | | | This reverts commit 8615bb40fb39bf7435462ca54cbbc24aaecae502. Reverting as it breaks on MinGW targets
* implement #pragma comment(lib,...)Steven G. Messervey2015-04-151-13/+31
|
* ability to specify a type of the input file with the -x switchseyko2015-04-121-19/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-121-0/+1
| | | | | | | | | | 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.
* replace a method to force bcheck.o linkingseyko2015-04-121-5/+8
| | | | | | * 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-101-0/+1
| | | | | | 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 a preprocessor for .Sseyko2015-04-101-1/+4
| | | | | | 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/+2
| | | | | | | | | | | | | | | | | | | | | | | | * 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
* fix installation amd bcheck for Windowsseyko2015-04-101-0/+11
| | | | | | | | | | | | | | | | | | | | | | * 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-101-1/+3
|
* fix the bug #31403: parser bug in structureseyko2015-04-101-0/+1
| | | | | | - 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 for Microsoft compilersseyko2015-03-291-1/+1
| | | | | Miccrosoft Visual Sudio (Express) 2008 and 2010 do not accept variable definitions C99 style, reported by Fabio <oldfaber@gmail.com>
* fix for the previous commit (compilation on RPi)seyko2015-03-261-1/+1
|
* make a bound checking more compatible with Windows 64seyko2015-03-261-2/+2
| | | | | | 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 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-231-1/+1
| | | | | | | | | | | | | | | | | | | | | 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 to allow build tcc by build-tcc.batseyko2015-03-191-0/+2
| | | | | move call to print_defines() from tcc.c to the libtcc.c define a print_defines() as a ST_FUNC
* Turn on a implicit-function-declaration warning by default.seyko2015-03-031-0/+1
| | | | | | | | A non declared function leads to a seriuos problems. And while gcc don't turn this warning on lets tcc do it. This warning can be turned off by -Wno-implicit-function-declaration option. And autor must explicitly do this if program must be compiled with this warning off.
* -std=c99 option for the tcc: allow to use a tcc as a reference compiler for ↵seyko2015-03-031-0/+6
| | | | | | "make test" tcc will igmore this option.
* A reverse of the commit 14745bdeb because of the problems while compiling ↵seyko2015-03-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | linux 2.4.26 A test program: /////////// typedef unsigned int __u32; static inline const __u32 __fswab32(__u32 x) { return ({ __u32 __tmp = (x) ; ___swab32(__tmp); }); } void func() { int aaa = 1; int snd_wnd = 2; int TCP_FLAG_ACK = 3; int pred_flags = (__builtin_constant_p((__u32) (((aaa << 26) | (__builtin_constant_p((__u32)((TCP_FLAG_ACK))) ? ({ __u32 __x = (((TCP_FLAG_ACK))); ((__u32)( (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); }) : __fswab32(((TCP_FLAG_ACK)))) | snd_wnd))) ? ({ __u32 __x = ((((aaa << 26) | (__builtin_constant_p((__u32)((TCP_FLAG_ACK))) ? ({ __u32 __x = (((TCP_FLAG_ACK))); ((__u32)( (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); }) : __fswab32(((TCP_FLAG_ACK)))) | snd_wnd))); ((__u32)( (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); }) : __fswab32((((aaa << 26) | (__builtin_constant_p((__u32)((TCP_FLAG_ACK))) ? ({ __u32 __x = (((TCP_FLAG_ACK))); ((__u32)( (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); }) : __fswab32(((TCP_FLAG_ACK)))) | snd_wnd)))); } //////////// error: ';' expected (got "(")
* tcc_free(table_ident) in preprocess_new() if table_ident != NULLseyko2015-03-031-0/+1
|
* tcc_undefine_symbol(): free an alloced symbolseyko2015-03-031-0/+1
|
* A gcc preprocessor option -dD addedseyko2015-03-031-0/+10
| | | | | | | | | With this option on a defines are included into the output (inside comments). This will allow to debug a problems like: In file included from math.c:8: In file included from /usr/include/math.h:43: /usr/include/bits/nan.h:52: warning: NAN redefined
* Added a gcc preprocessor options -P, -P1seyko2015-03-031-0/+5
| | | | | | | | | | | tcc -E -P do not output a #line directive, a gcc compatible option tcc -E -P1 don't follow a gcc preprocessor style and do output a standard #line directive. In such case we don't lose a location info when we going to compile a resulting file wtith a compiler not understanding a gnu style line info.
* Add arm64 (AArch64) as a target architecture.Edmund Grimley Evans2015-02-231-1/+6
|
* Use RELA relocations properly for R_DATA_PTR on x86_64.Edmund Grimley Evans2015-02-211-2/+8
| | | | | | | libtcc.c: Add greloca, a generalisation of greloc that takes an addend. tcc.h: Add greloca and put_elf_reloca. tccelf.c: Add put_elf_reloca, a generalisation of put_elf_reloc. tccgen.c: On x86_64, use greloca instead of greloc in init_putv.
* Warn about a conflicting compile options spectified on the command line.seyko2015-01-061-1/+11
| | | | Try "tcc -E -c tccasm.c -o tccasm.o"
* .i as file extensionseyko2015-01-061-1/+1
| | | | | | | | | | | Add a ".i" extension as alias for ".c" GCC and file extensions: .i C source code which should not be preprocessed. Before a patch: ./tcc -E tccasm.c -o tccasm.i ./tcc -c tccasm.i -o tccasm.o tccasm.i:1: error: unrecognized file type
* libtcc.c (put_extern_sym2): Extend the scope of buf to match its useLee Duhem2014-12-111-2/+1
| | | | | After leaving the code block that `buf' is defined, `buf' will not exist, so `name' will point to a variable that does not exist.
* tccgen: nocode_wanted: do not output constantsgrischka2014-08-011-1/+0
| | | | | | | | | | | | | | | | | | | | This for example suppresses string constants such as with int main() { return sizeof "foo"; } Actually, setting nocode_wanted = 1; in libtcc.c for the initial global level seemed wrong, since obviously "nocode_wanted" means code as any side effects, also such as string constants. This reverts a part of 2de1b2d14cc920e2c698ff0086f5558c2da7f569 (documented as "Some in-between fixes" in Changelog)
* win64: try to fix linkagegrischka2014-06-241-1/+0
| | | | | | | | | - revert to R_X86_64_PC32 for near calls on PE - revert to s1->section_align set to zero by default Untested. Compared to release_0_9_26 the pe-image looks back to normal. There are some differences in dissassembly (r10/r11 usage) but maybe that's ok.
* tccpe: adjust for new 'hidden' symbols featuregrischka2014-04-171-7/+5
| | | | | in order to avoid conflicts with windows specific (ab)usage of the Elf32_Sym -> st_other field.
* Parse assembler .hidden directiveMichael Matz2014-04-141-0/+3
| | | | | This makes TCCs assembler understand the '.hidden symbol' directive (and emits a STV_HIDDEN ELF symbol then).
* tcc, libtcc: fix build on windows with latest mingw.minux2014-04-111-1/+1
|
* tests2: cleanupgrischka2014-04-071-8/+1
| | | | | | | | | - remove -norunsrc switch Meaning and usage (-run -norun...???) look sort of screwed. Also general usefulness is unclear, so it was actually to support exactly one (not even very interesting) test This partially reverts e31579b0769e1f9c0947d12e83316d1149307b1a
* Declare wint_t in <stddef.h> when neededMichael Matz2014-04-071-0/+9
| | | | | Some old glibcs <wctype.h> require <stddef.h> to provide wint_t, accomodate them.
* Remove the fix from my last commit, it was pointed by scan-build and is a ↵mingodad2014-03-281-1/+1
| | | | false positive, thanks to grischka for pointing it.
* Fix a incorrect size for malloc.mingodad2014-03-271-1/+1
|
* A possible fix for the memory leak reported by valgrind when running ↵mingodad2014-03-251-0/+2
| | | | tcctest.c with tcc.
* libtcc: ignore linker optizimization and as-needed options. This allows ↵Austin English2014-03-061-0/+4
| | | | compiling some packages from Gentoo's portage
* Add support for runtime selection of float ABIThomas Preud'homme2014-01-081-2/+21
|
* be stricter with aliasinggrischka2014-01-071-4/+4
| | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | | | | | | - 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
* Define __ARM_EABI__ and __ARMEL__ when applicableThomas Preud'homme2013-11-261-0/+4
|
* struct variable behind guard, proper macro check, and remove some whitespace.Joseph Poirier2013-11-081-37/+39
| | | | | | | Wrap runtime_main as per its declaration in tcc.h. Fix preprocessor check for TCC_ARM_EABI macro definition. Signed-off-by: Joseph Poirier <jdpoirier@gmail.com>
* Revert "Add support for thread-local storage variables"Thomas Preud'homme2013-11-031-4/+1
| | | | | | | | | | TLS support in tinyCC is absolutely not ready: - segment register not select in load and store - no relocation added for computing offset of per-thread symbol - no support for TLS-specific relocations - no program header added as per Drepper document about TLS This reverts commit 1c4afd13501f07a673aed5f130166f2ee0f30927.
* Add support for thread-local storage variablesThomas Preud'homme2013-10-291-1/+4
|