aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* set the user-defined library search paths firstVittorio Giovara2013-09-231-3/+1
|
* i386-gen: preserve fp control word in gen_cvt_ftoigrischka2013-08-281-11/+4
| | | | | | | | | | | | | | | | | | | | | | | - 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
* Define __ARM_PCS_VFP in hardfloat compilation modeThomas Preud'homme2013-06-151-0/+3
|
* Sorted out CMake on x86-64 and fixed silly XMM# bug introduced when working ↵James Lyon2013-04-251-0/+2
| | | | | | | | | on Win64 stdargs. I removed the XMM6/7 registers from the register list because they are not used on Win64 however they are necessary for parameter passing on x86-64. I have now restored them but not marked them with RC_FLOAT so they will not be used except for parameter passing.
* Added CMake build system (to facilitate Win64 builds)James Lyon2013-04-211-3/+10
| | | | | | Win32 build and tests work under CMake, however I haven't added install code yet. Win64 build fails due to chkstk.S failing to assemble.
* Fixed tests on Windows (including out-of-tree problems)James Lyon2013-04-171-1/+8
| | | | | | | | | | | Modified tcctest.c so that it uses 'double' in place of 'long double' with MinGW since this is what TCC does, and what Visual C++ does. Added an option -norunsrc to tcc to allow argv[0] to be set independently of the compiled source when using tcc -run, which allows tests that rely on the value of argv[0] to work in out-of-tree builds. Also added Makefile rules to automatically update out-of-tree build Makefiles when in-tree Makefiles have changed.
* don't confuse LD_LIBRARY_PATH (run time) with LIBRARY_PATH (link time)Urs Janssen2013-02-191-2/+2
|
* added CPATH, C_INCLUDE_PATH and LD_LIBRARY_PATHAndrew Aladjev2013-02-191-0/+18
|
* remove doubled prototypeUrs Janssen2013-02-181-2/+3
| | | | | fix documentation about __TINYC__ define __STDC_HOSTED__ like __STDC__
* libtcc: tcc_define_symbol() uses strings, fix segfaultRoy2013-02-181-1/+1
|
* Define __STDC_HOSTED__ to a sane valueThomas Preud'homme2013-02-171-1/+1
| | | | | | | Define __STDC_HOSTED__ to one as the correct values should be either 1 or 0. Since tinycc is hosted, it should be set to 1. Thanks Christian Jullien for the report.
* Define __STDC_HOSTED__Thomas Preud'homme2013-02-171-0/+1
| | | | | | | | | Quoting Michael Matz on tinycc-devel: "__STDC_HOSTED__ : not set (incorrectly, it should probably be set to 1 given that tcc assumes a normal main() and that the rest of the provided facilities is provided by the C library not under tcc control)"
* add version number to manpageUrs Janssen2013-02-171-1/+1
| | | | | | | 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)
* - don't use GCC_MAJOR to see if we're not using gcc as GCC_MAJOR might be setUrs Janssen2013-02-151-1/+1
| | | | during configure even with --cc=notgcc as long as gcc is installed.
* - make clang accept unportable code in libtcc1.cUrs Janssen2013-02-141-0/+5
| | | | - add -dumpversion cmd.line opt
* configure: cleanupgrischka2013-02-141-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* libtcc: new LIBTCCAPI tcc_set_options(TCCState*, const char*str)grischka2013-02-121-208/+423
| | | | | | | | | | | | | | | | | | | This replaces -> use instead: ----------------------------------- - tcc_set_linker -> tcc_set_options(s, "-Wl,..."); - tcc_set_warning -> tcc_set_options(s, "-W..."); - tcc_enable_debug -> tcc_set_options(s, "-g"); parse_args is moved to libtcc.c (now tcc_parse_args). Also some cleanups: - reorder TCCState members - add some comments here and there - do not use argv's directly, make string copies - use const char* in tcc_set_linker - tccpe: use fd instead of fp tested with -D MEM_DEBUG: 0 bytes left
* tcc -vv/--print-search-dirs: print more infogrischka2013-02-101-14/+64
| | | | | | | | | | | | | | tests/Makefile: - print-search-dirs when 'hello' fails - split off hello-run win32/include/_mingw.h: - fix for compatibility with mingw headers (While our headers in win32 are from mingw-64 and don't have the problem) tiny_libmaker: - don't use "dangerous" mktemp
* tcc.h: declare CValue.tab[LDOUBLE_SIZE/4]grischka2013-02-081-9/+2
| | | | | | | | Should fix some warnings wrt. access out of array bounds. tccelf.c: fix "static function unused" warning x86_64-gen.c: fix "ctype.ref uninitialzed" warning and cleanup tcc-win32.txt: remove obsolete limitation notes.
* lib/Makefile: use CC, add bcheck to libtcc1.agrischka2013-02-061-0/+4
| | | | | | | | Also: - fix "make tcc_p" (profiling version) - remove old gcc flags: -mpreferred-stack-boundary=2 -march=i386 -falign-functions=0 - remove test "hello" for Darwin (cannot compile to file)