aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
Commit message (Collapse)AuthorAgeFilesLines
* 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).
* libtcc: tcc_get_symbol uses the TCCState parametergrischka2012-04-181-0/+1
| | | | | This allows using tcc_get_symbol on some other than the current TCCState. (Suggested by David Mertens)
* tcc_realloc: auto "memory full" errorgrischka2012-04-181-4/+2
|
* add "nostdlib" option to libtccGabriel Corneanu2012-04-181-0/+2
|
* Support linker options passed in several -Wl paramThomas Preud'homme2012-03-151-0/+3
| | | | | | | | | | | | 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.
* Fix assumption of 32bit long on portions of ElfAndrew Mulbrook2012-03-031-5/+4
| | | | | | | | | Modify tcc to accept convert full 64bits of specified text section when converting on Win64. Write high bytes to the elf section address as well. This allows creation of elf binaries located in offsets using full 64 bit addresses. Signed-off-by: Andrew Mulbrook <andrew262@gmail.com>
* Revert "Multiple fixes for 64 bit sections"Andrew Mulbrook2012-03-031-4/+5
| | | | This reverts commit d7a7c3769d0a1dcb8400258cd8adf78a8566de61.
* Add __REDIRECT needed for Large File Support API on linuxRamsay Jones2012-02-291-0/+1
| | | | | | | | | | | | | | | Since commit 9b09fc3 ("Add support of asm label for functions", 05-09-2010) tcc has had the capability to rename functions at the assembly level. This capability was subsequently used by commit 2596273 ("Add support for __REDIRECT_NTH needed with eglibc", 11-09-2010) to redirect long double functions on platforms which did not support long double. Here we add the companion macro __REDIRECT which is used (along with __REDIRECT_NTH) in the glibc headers on Linux to support the Large File API (when _FILE_OFFSET_BITS is set to 64). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Multiple fixes for 64 bit sectionsmob2012-02-261-5/+4
| | | | | | | | | | | | | | | This changeset attempts to fix a few problems when giving using the high 32bits of a 64bit section offset. There are likely more issues (or perhaps regressions) lurking in the muck here. In general, this moves a few data type declarations to use uplong. Also, add support for 64bit mingw32 building under cygwin. Because native types are used for 64 bit offsets, this won't fix challenges with cross compiling from 32bit -> 64bit. Tested under cygwin, against binary compiled with -Wl,-Ttext=0xffffff8000000000 Signed-off-by: Andrew Mulbrook <andrew262@gmail.com>
* libtcc: add missing tcc_enable_debug()Nicolas Limare2011-10-031-0/+6
|
* rename error/warning -> tcc_(error/warning)grischka2011-08-111-17/+17
|
* libtcc: minor adjustmentsgrischka2011-08-111-22/+7
| | | | | | | | | | | | | | | | | - 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: support more than one crtprefixgrischka2011-08-061-24/+33
| | | | Looks like gcc has that. Oh Deer!
* libtcc: cleanup the 'gen_makedeps' stuffgrischka2011-08-061-22/+13
|
* configure: add switches to set search pathsgrischka2011-08-061-28/+14
| | | | | | | | | | | | | | | | | | | --sysincludepaths=.. specify system include paths, colon separated" Sets CONFIG_TCC_SYSINCLUDEPATHS --libpaths=... specify system library paths, colon separated" Sets CONFIG_TCC_LIBPATHS --crtprefix=... specify location of crt?.o" Sets CONFIG_TCC_CRTPREFIX --elfinterp=... specify elf interpreter" Sets CONFIG_TCC_ELFINTERP Also the CONFIG_TCC_XXX were renamed to make them look more consistent. Also move the elf_interp definitions to tcc.h.
* Revert "Add a --multiarch-triplet switch to configure"Thomas Preud'homme2011-08-031-18/+6
| | | | This reverts commit 76adc5770f4ab5b1aaa2e5dde6104efc06431fe2.
* Add a --multiarch-triplet switch to configureThomas Preud'homme2011-08-021-6/+18
| | | | | | | | | | | | | Add a --multiarch-triplet switch to configure. The switch will allow files to be search for each default path in path/<triplet> and then path. Default paths handled that way: - CONFIG_TCC_SYSINCLUDE_PATHS - CONFIG_TCC_LIBPATH - path to crt*.o - path to libgcc_s.so.1 Path missing: elf interpreter path (will be handled in another commit)
* Set CONFIG_TCC_CRT_PREFIX relative to CONFIG_SYSROOTThomas Preud'homme2011-08-011-2/+2
| | | | | Set CONFIG_TCC_CRT_PREFIX relative to CONFIG_SYSROOT for consistency with CONFIG_TCC_LDDIR.
* Accept colon separated paths with -L and -Igrischka2011-08-011-107/+56
| | | | | | | | | | | | | | | | | | This allows passing colon separated paths to tcc_add_library_path tcc_add_sysinclude_path tcc_add_include_path Also there are new configure variables CONFIG_TCC_LIBPATH CONFIG_TCC_SYSINCLUDE_PATHS which define the lib/sysinclude paths all in one and can be overridden from configure/make For TCC_TARGET_PE semicolons (;) are used as separators Also, \b in the path string is replaced by s->tcc_lib_path (CONFIG_TCCDIR rsp. -B option)
* fixed Makefile test targetsJoe Soroka2011-07-221-1/+1
|
* make: create native tcc from separate objectsgrischka2011-07-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | 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.
* win32: add -Wl,--stack=xxx switchgrischka2011-07-111-6/+4
| | | | | | | | For example: $ tcc -Wl,--stack=4194309 which means 4 MB. Default is 1 MB.
* Fix problem spotted in <4E15F966.4090102@gmx.de>Thomas Preud'homme2011-07-081-35/+33
| | | | | | | | * Rename tcc_split_path_components * Move tcc_split_path below memory wrapper section * Ident tcc_split_path by 4 * Remove prefix and suffix clutter in tcc_split_path * Don't dereference beyond the end of the search paths string
* Add configuration of include subdirectoriesThomas Preud'homme2011-07-071-2/+17
| | | | | | | | Add the possibility to search headers in several subdirectories of /usr/local/include and /usr/include. A possible use case would be for tcc to search for headers in /usr/local/include/x86_64-linux-gnu, /usr/local/include, /usr/include/x86_64-linux-gnu and /usr/include in turn.
* Introduce tcc_split_path_component for 31ca000dThomas Preud'homme2011-07-071-20/+41
| | | | | Rewrite code introduced by 31ca000d and following commits around a new function tcc_split_path_component.
* Free extra_libdir_str after use.Thomas Preud'homme2011-07-061-0/+1
|
* Add multiarch dirs to linker search pathThomas Preud'homme2011-07-051-0/+24
| | | | | | | | | | | By default, tcc search libraries in /lib and /usr/local/lib while crt*.o files are searched in /usr/lib and ld.so is searched in /lib. Unfortunetely the path are hardcoded in source code. This patch allow tcc to look in an other directory and also to look in extra directories. It's then possible to make tcc search libraries in /lib/x86_64-linux-gnu and /usr/local/lib/x86_64-linux-gnu while crt*.o files are searched in /usr/lib/x86_64-linux-gnu and ld.so is searched in /lib/x86_64-linux-gnu.
* Remove unused variablesThomas Preud'homme2011-05-161-0/+1
| | | | | Declare float type conditionally to not declare them conditionally when they are not used.
* fix spurious vstack-leak warnings on errorJoe Soroka2011-05-021-3/+3
|
* libtcc.c: report vstack "leaks" only if compile succeededJoe Soroka2011-04-141-2/+3
|
* VLA leaks vstack. added warning to detect future leaksJoe Soroka2011-04-081-0/+4
|
* tccpe: support leading underscore for symbolsgrischka2011-02-131-1/+1
| | | | | | | | | To make this the default, enable this line in libtcc.c:tcc_new: #if defined(TCC_TARGET_PE) && 0 s->leading_underscore = 1; and then recompile tcc and also libtcc1.a
* Fix fct asm label: only valid for declarationThomas Preud'homme2011-02-091-4/+4
| | | | | | | | | - Fix function assembly label mechanism introduced in commit 9b09fc376e8c212a767c875e71ca003e3b9a0d2e to only accept alternative name for function declaration. - merge the code with the one introduced in commit 264a103610e3ee86b27b8cbb0e4ec81cd654d980. - Don't memorize token for asm label but directly the asm label.
* add -isystem cmdline optionJoe Soroka2011-02-011-1/+1
|