aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
Commit message (Collapse)AuthorAgeFilesLines
* Add support for runtime selection of float ABIThomas Preud'homme2014-01-081-1/+1
|
* Add the possibility to use noname functions by ordinalYX Hao2013-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | | tcc.c: process.h:177:20: note: expected 'char * const*' but argument is of type 'char const*const*' tccpe.c: Add the possibility to use noname functions by ordinal. use def file: "AliasName @n" build-tcc.bat: 1. Enable 32 bits mode on 64 bits OS. 2. build doc. _parseLibs.bat: Convenient to use "*.def + *.c" instead of *.a, just use -l* _tcc.bat: a practice of _parseLibs.bat Signed-off-by: YX Hao <lifenjoiner@163.com>
* x86-64 ABI fixes.James Lyon2013-04-191-1/+1
| | | | | | | | | abitest now passes; however test1-3 fail in init_test. All other tests pass. I need to re-test Win32 and Linux-x86. I've added a dummy implementation of gfunc_sret to c67-gen.c so it should now compile, and I think it should behave as before I created gfunc_sret.
* Fixed tests on Windows (including out-of-tree problems)James Lyon2013-04-171-0/+1
| | | | | | | | | | | 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.
* added CPATH, C_INCLUDE_PATH and LD_LIBRARY_PATHAndrew Aladjev2013-02-191-0/+1
|
* configure: pass CONFIG_xxxDIR/PATH options via commandlinegrischka2013-02-141-0/+1
| | | | | | | | | | | | | | | - except for CONFIG_SYSROOT and CONFIG_TCCDIR Strictly neccessary it is only for CONFIG_MULTIARCHDIR because otherwise if it's in config.h it is impossible to leave it undefined. But it is also nicer not to use these definitions for cross-compilers. - Also: lib/Makefile : include ../Makefile for CFLAGS lib/libtcc1.c : fix an issue compiling tcc with tcc on x64
* - make clang accept unportable code in libtcc1.cUrs Janssen2013-02-141-0/+1
| | | | - add -dumpversion cmd.line opt
* libtcc: new LIBTCCAPI tcc_set_options(TCCState*, const char*str)grischka2013-02-121-438/+160
| | | | | | | | | | | | | | | | | | | 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 --help: update option summarygrischka2013-02-101-6/+15
| | | | tcc-doc.texi: also
* tcc -vv/--print-search-dirs: print more infogrischka2013-02-101-4/+8
| | | | | | | | | | | | | | 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
* c67: remove global #define's for TRUE/FALSE/BOOLgrischka2013-02-041-1/+1
| | | | Also use uppercase TRUE/FALSE instead of true/false
* Revert "Added what I call virtual io to tinycc this way we can make a ↵Thomas Preud'homme2013-01-141-97/+0
| | | | | | | | 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-0/+97
| | | | | | 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.
* tcc.c: fix argv index for parse_argsgrischka2012-06-121-3/+3
| | | | | | | | | I probably broke that myself earlier. In any case parse_args needs to start with index 0 because it is is used also recursively to expand the shebang command from scripts such as #!/usr/local/bin/tcc -run -L/usr/X11R6/lib -lX11 which arrives at tcc as only two argv's "tcc" "-run -L/usr/X11R6/lib -lX11"
* tcc.c: fix previous commit "Use CString to concat linker options"grischka2012-04-181-9/+7
| | | | | | | | | - remove redunant else branch - zero-terminate linker_arg - declare cstr_xxx as PUB_FUNC (which are functions used in tcc.c but not in the libtcc API. Useful for a tcc(.exe) that uses the libtcc.(so/dll)) - while at it, export PUB_FUNCs from dll
* Re-enable "Use CString to concat linker options"Gabriel Corneanu2012-04-181-13/+8
| | | | | | | This reverts commit 16202e054f0385499ec16463b87e23c97dc02328. Changed win32 build to use ONE_SOURCE just like libtcc.dll Therefore CString can be used again...
* Revert "Use CString to concat linker options"Thomas Preud'homme2012-04-101-8/+13
| | | | | | | | This reverts commit 1c11b857fe87a73d7047701dacdbe8394967b1d1. On windows, libtcc.c is compiled with ONE_SOURCE and then tcc.c is linked to it. Thus tcc.c can only use public functions which cstr_* are not.
* Use CString to concat linker optionsThomas Preud'homme2012-03-201-13/+8
| | | | | As suggested, change type of linker_arg variable to the more appropriate CString type, since linker_arg is about dynamically grown string.
* Fix use after free for linker_argThomas Preud'homme2012-03-161-2/+2
| | | | | | | | | elements in linker_arg are used in TCCState structure and must thus not be freed when option parsing is finished. Declare linker_arg as a global static variable and free it after tcc_delete has been called on TCCState structure. This fix commit 7fb0482a4645d59068ccefe44a3a022b649e5a3a
* Support linker options passed in several -Wl paramThomas Preud'homme2012-03-151-2/+16
| | | | | | | | | | | | ld support arguments to multiple-letter options being passed in two ways: * -opt=arg * -opt arg libtool generate command line of the second form. This commit add support for the second form so that libtool works with tcc. The way it is done is to concatenate all -Wl options into one and then pass it to set_linker.
* tcc.h: define TCC_IS_NATIVEgrischka2012-03-051-0/+4
| | | | | | - disable tccrun feature for non-native (cross-) compilers - define uplong for target adress size - fix using -Wl,-Ttext=... for Win64 (tccpe: ADDR3264 imagebase)
* rename error/warning -> tcc_(error/warning)grischka2011-08-111-11/+11
|
* libtcc: minor adjustmentsgrischka2011-08-111-34/+25
| | | | | | | | | | | | | | | | | - use {B} to substitute tcc_lih_path (instead of \b) - expand CONFIG_TCC_CRTPREFIX in CONFIG_TCC_LIBPATHS which fixes duplicate CONFIG_SYSROOT. - put default CONFIG_SYSROOT ("") into tcc.h - remove hack from commit db6fcce78f4d8ea25036dd6643e9fa83d8e52e5a because $(tccdir)/include is already in sysincludes - configure: error out for unrecognized options. - win32/build-tcc.bat: put libtcc into base dir where it will find lib/include automatically, and build libtcc_test example.
* libtcc: cleanup the 'gen_makedeps' stuffgrischka2011-08-061-13/+14
|
* tcc: fix -m32/64 & simplifygrischka2011-08-061-74/+53
| | | | | | | | | | This cleans up the mess from commit 8f985736580926ac53dc367fc293524bf2810cbb and preceeding. - make tcc -m64 work on windows - execvp on windows returns 0 always, replace by spawnvp - remove bizarre support for i386-win32-tcc -m64
* make: create native tcc from separate objectsgrischka2011-07-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | This was already possible using make NOTALLINONE=1 and is now the default. To build as previously from one big source, use make ONE_SOURCE=1 Cross compilers are still build from one source because using separate objects requires separate build directories one per platform which currently is not (yet) supported by the makefile. We could probably use gnu-makeish target variables like $(I386_CROSS): OUTDIR=build/i386 $(X64_CROSS): OUTDIR=build/x86-64 and so on ... Also NEED_FLOAT_TYPES for arm-gen is removed. It was about variables that are referenced from outside (libtcc, tccgen). We could declare them in tcc.h (as with reg_classes) or have them twice in arm-gen.c. I chose option 2.
* tcc: add sysinclude path with -B, like gcc doesJoe Soroka2011-02-021-1/+7
|
* add -isystem cmdline optionJoe Soroka2011-02-011-0/+5
|
* tcc.c: fix an error when you build an object file with '-pthread' key setSergei Trofimovich2011-01-041-5/+11
| | | | | | | | | | | | | | | | | | | The problem was partially fixed by Henry in the following patch: tcc.c: skip -lpthread when -c option specified But that patch had one brawback: it is sensitive to argument order, as decision is taken during commandline parsing: $ tcc -c a.c -o a.o -pthread # 1. works fine tcc: error: file 'a.c' not found $ tcc -pthread -c a.c -o a.o # 2. blows tcc: error: cannot specify libraries with -c This patch fixes case 2. Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
* tcc: add unsupported option -pedanticHenry Kroll III2010-12-201-0/+2
|
* tcc: -m32 prefix "win32-" when file extension is presentHenry Kroll III2010-12-131-4/+14
|
* tcc: fix format string in error handlerHenry Kroll III2010-12-081-4/+4
|
* tcc: oops, error handler does not accept format stringsHenry Kroll III2010-12-081-4/+4
|
* tcc: fix -m32 and add -m64 optionHenry Kroll III2010-12-081-25/+61
|
* tcc: move undef out of if blockHenry Kroll III2010-12-061-1/+1
|
* tcc: add -m32 option to x86_64 cross compilersHenry Kroll III2010-12-061-1/+34
|
* trim unnecessary bits from my previous 3 commitsHenry Kroll III2010-12-051-2/+0
|
* tcc: add option -s for gcc compatibility (ignored)Henry Kroll III2010-12-041-1/+5
|
* tcc.c: skip -lpthread when -c option specifiedHenry Kroll III2010-11-301-2/+4
|
* tcc: Linux -pthread option sets -D_REENTRANT and -lpthreadHenry Kroll III2010-11-241-0/+9
|
* tccmain: simplify option helpgrischka2010-09-081-4/+4
|
* tcc: Explicitly require -l<lib> for librariesKirill Smelkov2010-06-211-1/+1
| | | | | Previously it was possible to specify e.g. -q<lib> and still link with lib. Avoid such behaviour by checking for '-l' instead of '-l.'
* tcc: Draft suppoprt for -MD/-MF optionsKirill Smelkov2010-06-211-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In build systems, this is used to automatically collect target dependencies, e.g. ---- 8< (hello.c) ---- #include "hello.h" #include <stdio.h> int main() { printf("Hello World!\n"); return 0; } $ tcc -MD -c hello.c # -> hello.o, hello.d $ cat hello.d hello.o : \ hello.c \ hello.h \ /usr/include/stdio.h \ /usr/include/features.h \ /usr/include/bits/predefs.h \ /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h \ /usr/include/gnu/stubs.h \ /usr/include/bits/wordsize.h \ /usr/include/gnu/stubs-32.h \ /home/kirr/local/tcc/lib/tcc/include/stddef.h \ /usr/include/bits/types.h \ /usr/include/bits/wordsize.h \ /usr/include/bits/typesizes.h \ /usr/include/libio.h \ /usr/include/_G_config.h \ /usr/include/wchar.h \ /home/kirr/local/tcc/lib/tcc/include/stdarg.h \ /usr/include/bits/stdio_lim.h \ /usr/include/bits/sys_errlist.h \ NOTE: gcc supports -MD only for .c -> .o, but in tcc, we generate dependencies for whatever action is being taken. E.g. for .c -> exe, the result will be: $ tcc -MD -o hello hello.c # -> hello, hello.d hello: \ /usr/lib/crt1.o \ /usr/lib/crti.o \ hello.c \ hello.h \ /usr/include/stdio.h \ /usr/include/features.h \ /usr/include/bits/predefs.h \ /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h \ /usr/include/gnu/stubs.h \ /usr/include/bits/wordsize.h \ /usr/include/gnu/stubs-32.h \ /home/kirr/local/tcc/lib/tcc/include/stddef.h \ /usr/include/bits/types.h \ /usr/include/bits/wordsize.h \ /usr/include/bits/typesizes.h \ /usr/include/libio.h \ /usr/include/_G_config.h \ /usr/include/wchar.h \ /home/kirr/local/tcc/lib/tcc/include/stdarg.h \ /usr/include/bits/stdio_lim.h \ /usr/include/bits/sys_errlist.h \ /usr/lib/libc.so \ /lib/libc.so.6 \ /usr/lib/ld-linux.so.2 \ /lib/ld-linux.so.2 \ /usr/lib/libc_nonshared.a \ /lib/libc.so.6 \ /usr/lib/libc_nonshared.a \ /home/kirr/local/tcc/lib/tcc/libtcc1.a \ /usr/lib/crtn.o \ So tcc dependency generator is a bit more clever than one used in gcc :) Also, I've updated TODO and Changelog (in not-yet-released section). v2: (Taking inputs from grischka and me myself) - put code to generate deps file into a function. - used tcc_fileextension() instead of open-coding - generate deps only when compilation/preprocessing was successful v3: - use pstrcpy instead of snprintf(buf, sizeof(buf), "%s", ...)
* tcc: Refactor "compute default outfile name" into libtcc functionKirill Smelkov2010-06-201-25/+4
| | | | | | | | | | | | | | | | Since for upcoming -MD support default _compile_ output file be needed even when preprocesssing (tcc -E), let's move this code out of one particular condition block into a common function, so that we could use it in deps generation code too. v2: - As suggested by grischka, moved into libtcc function instead of always computing near start of main() - There is a FIXME about how to return result - I don't want to bother callers with allocating temp buffers, not I think it will be a good idea to hook default_target to TCCState. Clearly, I'm to used to things like std::string and python's str...
* Add input files/libs and reloc_output switch to TCCStateKirill Smelkov2010-06-201-0/+1
| | | | | | | | | | | | | | | | | files[0], and reloc_outpu will be needed for (upcoming in the next patch) "compute default outfile name" refactored into libtcc function. Also, since for symmetry and from libification point of view, it makes some sense to also put all information about what was given as input to compilation into TCCState, let's not only put files[0], but all files and all libraries given explicitely by user. One point: I've used bitfield for reloc_output & trimmed down output_type to 8 bits so that TCCState stays the same in size, and also access to output_type is (hopefully) is not slower. By the way -- as of today, sizeof(TCCState) on i686-pc-linux-gnu is 2884 bytes...
* tcc: Fix typo in error (it's '%s', not '%s)Kirill Smelkov2010-06-161-1/+1
|
* libtcc: Detect (but ignore) -init and -fini for -WlDetlef Riekenberg2010-04-051-1/+1
| | | | | -- By by ... Detlef
* libtcc: Allow multiple options for -Wl separated with ','Detlef Riekenberg2010-04-051-83/+2
| | | | | | | I moved the code to libtcc to prepare for a later tiny_ld -- By by ... Detlef
* Add support for --helpDetlef Riekenberg2010-01-261-0/+1
|
* Recognize -Wl,-BsymbolicDetlef Riekenberg2010-01-261-0/+2
| | | | | | | | | | | | | | | Without -Bsymbolic, a symbol/function in a *.so can be overridden by a symbol/function in the main module. That is the default search order, but not supported by tcc. With -Bsymbolic, the linker tries to resolve a symbol/function in the current module first. The loader in tcc implements this search order. We do not distinguish -Bsymbolic and -Bsymbolic-function -- By by ... Detlef