aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
Commit message (Collapse)AuthorAgeFilesLines
* make: new lib/Makefile for libtcc1.a on more platformsgrischka2010-12-041-25/+3
| | | | | | win32/64 cross-compilers now build libtcc1.a and install it together with the windows headers in a 'win32' sub-directory of TCCDIR.
* split cross libtcc1.a to separate directoriesHenry Kroll III2010-12-021-1/+27
|
* libtcc: fix s->include_stack_ptr used uninitialized in tcc_opengrischka2010-11-261-0/+1
|
* x86_64: finish biarch path fixupHenry Kroll III2010-11-251-1/+1
|
* libtcc: new function tcc_open_bf to create BufferedFilegrischka2010-11-251-68/+53
| | | | | | | | Use it in: - tcc_open - tcc_compile_string - tcc_define_symbol - tcc_assemble_inline
* x86_64: fix --with-libgcc and simplify biarch pathsHenry Kroll III2010-11-251-9/+3
|
* Move asm label functions from tccasm.c to tccgen.cThomas Preud'homme2010-09-141-6/+0
| | | | | | | | | | * Move functions parse_asm_str and asm_label_instr from tccasm.c to tccgen.c * Remove CONFIG_TCC_ASM_LABEL macro as asm label are available on all archs. See: http://lists.nongnu.org/archive/html/tinycc-devel/2010-09/msg00026.html for the rationale.
* Add support for __REDIRECT_NTH needed with eglibc.Thomas Preud'homme2010-09-121-0/+3
| | | | | | Add support for __REDIRECT_NTH as eglibc makes use of this macro to redirect long double functions to long functions on arch not supporting long double.
* Add support for __FreeBSD_kernel__ kernelThomas Preud'homme2010-09-101-0/+3
| | | | | Add support for kfreebsd-i386 and kfreebsd-amd64 Debian arch with thanks to Pierre Chifflier <chifflier@cpe.fr>.
* Add support of asm label for functions.Thomas Preud'homme2010-09-101-1/+10
| | | | | | Add support for asm labels for functions, that is the ability to rename a function at assembly level with __asm__ ("newname") appended in function declaration.
* tcc_set_linker: mimic all option forms as supported by GNU ldKirill Smelkov2010-08-121-11/+55
| | | | | | | | | Namely * `-option' or `--option' (start with double or single dash) * `-param=val' or `-param,val' See GNU ld manual (2.1 Command Line Options)
* Avoid crash with "Avoid a crash with weak symbols for "make test""grischka2010-06-301-1/+1
| | | | | | | This fixes commit 197a6acb30940068d1dc3d0fa53c9f0863309885 which fixed commit 95b9a477b6743004e0e9bf728b25bf63d2908777 Also remove useless example files
* Document what tcc_fileextension doesKirill Smelkov2010-06-211-0/+4
| | | | This is evident, but won't hurt
* tcc -E: Let output_default be <file>.o instead of a.outKirill Smelkov2010-06-211-1/+3
| | | | | | | | | | | | | | | | | | This affectes where `tcc -E -MD file.c` will place generated dependency information -- previously, for `tcc -E` output_default was a.out, and so deps were put into a.d . Avoid this behaviour, by treating `tcc -E` as `tcc -c` with respect to output_default computation. This will not hurt anything else (preprocessor outputs to either stdout, or to explicitely given (-o <file>) destination, so no default filename is used here), and on the other hand `tcc -E -MD file.c` now puts dependencies into file.d (the same behaviour as for gcc -E). v2: - restructured condition a bit to make it more clear
* tcc: Draft suppoprt for -MD/-MF optionsKirill Smelkov2010-06-211-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+28
| | | | | | | | | | | | | | | | 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/+8
| | | | | | | | | | | | | | | | | 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...
* make --with-selinux work with libtcc, tooHenry Kroll III2010-04-241-0/+5
|
* libtcc.c: fix compilation failure (inconsistent tcc_add_file_internal)Sergei Trofimovich2010-04-191-1/+1
| | | | | | | | | gcc -o libtcc1.o -c lib/libtcc1.c -O2 -Wall libtcc.c: At top level: libtcc.c:1063: error: static declaration of 'tcc_add_file_internal' follows non-static declaration tccelf.c:2915: note: previous implicit declaration of 'tcc_add_file_internal' was here Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
* libtcc: Detect (but ignore) -init and -fini for -WlDetlef Riekenberg2010-04-051-11/+20
| | | | | -- By by ... Detlef
* libtcc: Support -soname for the linkerDetlef Riekenberg2010-04-051-0/+3
| | | | | -- By by ... Detlef
* libtcc: Allow multiple options for -Wl separated with ','Detlef Riekenberg2010-04-051-0/+111
| | | | | | | I moved the code to libtcc to prepare for a later tiny_ld -- By by ... Detlef
* Avoid a crash with weak symbols for "make test"Timo VJ Lähde2010-04-051-1/+1
| | | | | | | Patch from the mailing list by Timo VJ Lähde -- By by ... Detlef
* weak function symbolsManuel Simoni2010-02-271-2/+6
|
* fill got table for static linkingAli Gholami Rudi2010-02-051-0/+9
|
* Added patch to detect and use the paths for 64bit libraries asNikos Mavrogiannopoulos2010-01-281-1/+7
| | | | used by CentOS (affects X86_64 only).
* win64: defined size_t and ptrdiff_t to unsigned long longgrischka2010-01-141-7/+12
|
* x86-64: use uplong for symbol valuesgrischka2010-01-141-1/+1
|
* tccpe: improve dllimport/export and use for tcc_add_symbolgrischka2010-01-141-20/+24
|
* build from multiple objects: fix other targetsgrischka2009-12-201-0/+7
|
* allow tcc be build from separate objectsgrischka2009-12-201-624/+108
| | | | If you want that, run: make NOTALLINONE=1
* win32: enable bounds checker & exception handlergrischka2009-12-191-2/+6
| | | | exception handler borrowed from k1w1. Thanks.
* tcc_relocate: revert to 0.9.24 behaviorgrischka2009-12-191-0/+1
|
* tccrun: new filegrischka2009-12-191-497/+9
| | | | factor out -run support
* tccpe: improve dllimportgrischka2009-12-191-0/+5
|
* integrate x86_64-asm.c into i386-asm.cgrischka2009-12-191-8/+8
| | | | | Also, disable 16bit support for now as it causes bugs in 32bit mode. #define I386_ASM_16 if you want it.
* tccpe: allow linkage to extern symbols from asmgrischka2009-12-191-0/+1
|
* tccasm: make VT_VOID symbols ST_NOTYPE, elf-wisegrischka2009-12-191-0/+2
| | | | | | | This was confusing objdump such that it did not print disassembly with -d. Also, put filename as with C compilation
* solve tccelf problem on FreeBSDLuigi Rizzo2009-12-011-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Sun, Nov 22, 2009 at 05:43:14PM +0100, Luigi Rizzo wrote: > Hi, > there is a well known problem with tcc and FreeBSD in the generation > of elf objects -- see > http://lists.gnu.org/archive/html/tinycc-devel/2005-07/msg00070.html > > Apparently Sergey Lyubka has tried a partial fix to the problem. > I was wondering if Sergey or someone can post some more detail on > what needs to be done so we can try to help fixing this issue I think i have managed to solve the problem and produce almost valid elf files on FreeBSD. The two patches attached address a few problems (trying to explain to the best of my knowledge; i am not very familiar with ELF and the FreeBSD ELF conventions): 1. ELF file format tcc produces an ELF executable which is good for linux but not for FreeBSD. It misses the PHDR section which is almost mandatory for shared executables, puts in the .dynsym section some relocation info that FreeBSD expects to be in .got, and expect the relocation sections to be contiguous. patch-tccelf.c tries to address the above problem using conditional sections (so hopefully can be imported upstream) and also adds the ability to override the name of the dynamic loader through an environment variable (this is important to debug tcc). 2. predefined macros patch-libtcc.c adds/fixes some predefined macros when compiling on FreeBSD: these are __FreeBSD__ and the usual set of __i386__ and __unix__ variants. It also sets __INTEL_COMPILER so we can grab the __aligned macro from cdefs.h , otherwise many programs would fail The resulting elf file is still not 100% correct -- if you strip it, the program will not run (presumably there is some dangling reference). Other than that, program do seem to run correctly. It would be nice to integrate these patches in the main repository. The FreeBSD specific code is in #ifdef so it should not harm linux users cheers luigi
* various fixes and new options for PE formatFrederic Feret2009-11-131-0/+4
|
* first support of x86_64 assemblyFrederic Feret2009-11-131-0/+6
|
* added 16-bit x86 assembly supportFrederic Feret2009-11-131-0/+3
|
* #define __TINYC__ = version-numbergrischka2009-11-131-1/+5
|
* x86-64: change the type of size_t and ptrdiff_t.Shinichiro Hamaji2009-08-241-2/+2
| | | | size_t and ptrdiff_t should be unsigned long and long, respectively.
* tccpe: set tcc_lib_path from DLLgrischka2009-07-181-28/+7
|
* tccpe: load dll on the flygrischka2009-07-181-86/+127
|
* win64: fix pointer <-> unsigned long typecast issuesgrischka2009-07-181-6/+7
|
* pe32+ target: add in various #define'sgrischka2009-07-181-0/+7
|
* tccpe: build IAT vector with with -run toogrischka2009-07-181-8/+5
| | | | | This prepares for x86_64 where we need the vector for far jumps. Also, resolve DLL symbols in place
* cleanup: stop abuse of sym->c for #define tokenstreamsgrischka2009-07-181-0/+3
|