aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
Commit message (Collapse)AuthorAgeFilesLines
* 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)
* portability: fix void* <-> target address conversion confusiongrischka2013-02-041-6/+6
| | | | | | - #define addr_t as ElfW(Addr) - replace uplong by addr_t - #define TCC_HAS_RUNTIME_PLTGOT and use it
* c67: remove global #define's for TRUE/FALSE/BOOLgrischka2013-02-041-2/+2
| | | | Also use uppercase TRUE/FALSE instead of true/false
* safety: replace occurrences of strcpy by pstrcpygrischka2013-01-311-1/+1
|
* Revert "Added what I call virtual io to tinycc this way we can make a ↵Thomas Preud'homme2013-01-141-85/+20
| | | | | | | | monolitic executable or library that contains all needed to compile programs, truly tinycc portable." This reverts commit 59e18aee0e509a3ca75dbe6f909e18c1d17893d1. tcc is being stabilized now in order to do a new release soon. Therefore, such a change is not appropriate now.
* Added what I call virtual io to tinycc this way we can make a monolitic ↵mingodad2013-01-111-20/+85
| | | | | | executable or library that contains all needed to compile programs, truly tinycc portable. Tested under linux exec the "mk-it" shell script and you'll end up with a portable tinycc executable that doesn't depend on anything else.
* tccpp: alternative fix for #include_next infinite loop buggrischka2013-01-061-27/+0
| | | | | | | | | | | | | | | This replaces commit 3d409b08893873b917ccb8c34398bc41a4e84d7c - revert old fix in libtcc.c - #include_next: look up the file in the include stack to see if it is already included. Also: - streamline include code - remove 'type' from struct CachedInclude (obsolete because we check full filename anyway) - remove inc_type & inc_filename from struct Bufferedfile (obsolete) - fix bug with TOK_FLAG_ENDIF not being reset - unrelated: get rid of an 'variable potentially uninitialized' warning
* fix #include_next infinite loop bug, see http://savannah.nongnu.org/bugs/?31357Sergey Vinokurov2012-09-201-0/+27
|
* Emit spaces for -MDMichael Matz2012-05-131-1/+1
| | | | | | | | | | | | | | | TCCs make dependency generator is incompatible with the GNU depcomp script which is widely used. For TCC it has to go over the output of -MD, (it detects it as ICC compatible), but the sed commands it uses are confused by tabs in the output, so that some rewrites aren't done. Those tabs will then finally confuse make itself when the generated .d files are included. It reads them as goal commands (leading tab), and is totally lost then. Short of changing depcomp (hard because distributed with all kinds of software), simply emit spaces for -MD.
* Make sizeof() be of type size_tMichael Matz2012-04-181-0/+6
| | | | | | | | This matters when sizeof is directly used in arithmetic, ala "uintptr_t t; t &= -sizeof(long)" (for alignment). When sizeof isn't size_t (as it's specified to be) this masking will truncate the high bits of the uintptr_t object (if uintptr_t is larger than uint).