aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix removal of vnrottThomas Preud'homme2012-06-052-1/+2
| | | | Make vrotb ST_FUNC so that arm-gen.c can use vrotb.
* Only warn for unknown options in configure scriptThomas Preud'homme2012-05-281-1/+1
| | | | | This follows discussion started at http://lists.nongnu.org/archive/html/tinycc-devel/2012-05/msg00015.html
* Several multiarch/biarch fixesThomas Preud'homme2012-05-232-7/+8
| | | | | | | | * Add multiarch directories for arm and i386 * Fix detection of biarch: /lib64/ld-linux-x86-64.so.2 is mandated by ABI and is thus always present, even if there is no biarch * Define CONFIG_LDDIR directly with the right value in case of multiarch instead of defining it to /lib and then redifining it.
* Fix CONFIG_LDDIR usageThomas Preud'homme2012-05-221-10/+11
| | | | | | | | | | | | | | | | | | This patch fix 2 bugs in CONFIG_LDDIR usage: * CONFIG_LDDIR used for 2 purposes there is confusion between the directory to find libraries, crt* files and headers and the directory in which the program interpreter is. These two directories are not related. The latter is specified by the ABI and should not be configurable while the former depends on the system (single arch, biarch, multiarch). This end a longstanding issue with amd64 program interpreter later propagated to other architecture interpreters. * If multiarch is in effect, then the library directory should be /lib. /lib64 denotes biarch architecture, everything which is here would be in /lib/x86_64-linux-gnu instead.
* x86_64: Fix compares with NaNs.Michael Matz2012-05-132-2/+97
| | | | | | Comparisons with unordered doubles was broken, NaNs always compare unequal (and unordered) to everything, including to itself.
* 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.
* Fix comparing comparisonsMichael Matz2012-04-182-0/+38
| | | | | | | | | | | Sometimes the result of a comparison is not directly used in a jump, but in arithmetic or further comparisons. If those further things do a vswap() with the VT_CMP as current top, and then generate instructions for the new top, this most probably destroys the flags (e.g. if it's a bitfield load like in the example). vswap() must do the same like vsetc() and not allow VT_CMP vtops to be moved down.
* Make sizeof() be of type size_tMichael Matz2012-04-184-4/+37
| | | | | | | | 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).
* x86_64: Implement GET_CALLER_FPMichael Matz2012-04-181-0/+8
| | | | TCC always uses %rbp frames, so we can use that one.
* Fix parsing function macro invocationsMichael Matz2012-04-182-3/+22
| | | | | | If a function macro name is separated from the parentheses in an macro invocation the substitution doesn't take place. Fix this by handling comments.
* Fix detection of labels with a typedef nameMichael Matz2012-04-183-3/+33
| | | | | | | | | | | | | | This needs to be accepted: typedef int foo; void f (void) { foo: return; } namespaces for labels and types are different. The problem is that the block parser always tries to find a decl first and that routine doesn't peek enough to detect this case. Needs some adjustments to unget_tok() so that we can call it even when we already called it once, but next() didn't come around restoring the buffer yet. (It lazily does so not when the buffer becomes empty, but rather when the next call detects that the buffer is empty, i.e. it requires two next() calls until the unget buffer gets switched back).
* x86_64: Fix segfault for global dataMichael Matz2012-04-182-1/+31
| | | | | | | | | | | When offsetted addresses of global non-static data are computed multiple times in the same statement the x86_64 backend uses gen_gotpcrel with offset, which implements an add insn on the register given. load() uses the R member of the to-be-loaded value, which doesn't yet have a reg assigned in all cases. So use the register we're supposed to load the value into as that register.
* x86_64: Fix indirection in struct paramatersMichael Matz2012-04-182-28/+40
| | | | | | | | | | | | | The first loop setting up struct arguments must not remove elements from the vstack (via vtop--), as gen_reg needs them to potentially evict some argument still held in registers to stack. Swapping the arg in question to top (and back to its place) also simplifies the vstore call itself, as not funny save/restore or some "non-existing" stack elements need to be done. Generally for a stack a vop-- operation conceptually clobbers that element, so further references to it aren't allowed anymore.
* Fix bitfield loads into char/short.Michael Matz2012-04-182-2/+8
| | | | | | Removes a premature optimization of char/short loads rewriting the source type. It did so also for bitfield loads, thereby removing all the shifts/maskings.
* Fix conversion in a?0:ptr.Michael Matz2012-04-182-5/+27
| | | | | | (cond ? 0 : ptr)->member wasn't handled correctly. If one arm is a null pointer constant (which also can be a pointer) the result type is that of the other arm.
* libtcc: tcc_get_symbol uses the TCCState parametergrischka2012-04-183-2/+6
| | | | | This allows using tcc_get_symbol on some other than the current TCCState. (Suggested by David Mertens)
* support "x86_64-linux-gnu" subdirs with lib & includegrischka2012-04-182-15/+23
| | | | suggested for newer ubuntu by Damian Gryski
* tcc_realloc: auto "memory full" errorgrischka2012-04-183-12/+2
|
* tcc.h: unify multiple #ifdef CONFIG_TCC_BACKTRACEgrischka2012-04-181-9/+8
|
* cleanup some partially broken patchesgrischka2012-04-183-5/+5
| | | | | | | | | | | | | | | | | | | - tests/Makefile: fix commit de54586d5b45800e26952ec77b4f51ad4c1e0079 This hunk it unrelated to the other changes (which are about MacOSX). It is not useful and partially wrong. Optional tests are meant to stay optional, btest would work only for i386 - tcc.h: fix commit c52d79605a3c895a16e18f0b7193f1f4b480a60f by unknown The message says it's for MINTW but the patch has obviously no effect for MINGW (which defines __GNUC__). However the patch seems useful for MSC which however needs _strto(u)i64 with underscore. - Makefile: fix commit 5280293d6b16bbe24dfda76e37f32322fa2874ca Do not build tcc.o with -DONE_SOURCE because we finally build tcc from tcc.o and libtcc.a/so
* win32: tcc.exe uses libtcc.dllgrischka2012-04-182-5/+2
|
* tcc.c: fix previous commit "Use CString to concat linker options"grischka2012-04-184-22/+20
| | | | | | | | | - 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-182-14/+9
| | | | | | | This reverts commit 16202e054f0385499ec16463b87e23c97dc02328. Changed win32 build to use ONE_SOURCE just like libtcc.dll Therefore CString can be used again...
* add "nostdlib" option to libtccGabriel Corneanu2012-04-181-0/+2
|
* 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
* fix mingw compliationunknown2012-03-161-1/+1
|
* Support linker options passed in several -Wl paramThomas Preud'homme2012-03-152-2/+19
| | | | | | | | | | | | 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.
* Consider long int constant as 64 bits on x86-64Thomas Preud'homme2012-03-141-0/+4
| | | | | Quick and dirty hack to consider long int constant (as in 1UL or 1L) as 64 bits integer on x86-64 non Windows systems.
* Remove vnrott (duplicate vrotb)Thomas Preud'homme2012-03-143-19/+2
|
* Inform user that -b only exists on i386.Thomas Preud'homme2012-03-131-0/+2
|
* Further changes improving the OSX build. Everything builds. libtest passes.Milutin Jovanovic2012-03-064-11/+27
| | | | | | | | | | | | | | | | | | | | Other tests still have issues, currently with weak linking. One of the primary stumbling blocks on OSX is the lack of support for mach-o binaries. Therefore all tcc usage on OSX has to be limited to elf binaries, presumably produced by tcc itself. Therefore I had to enable building of tiny_libmaker for OSX. Then changed the make to use tcc and tiny_libmaker to compile the tcclib1. In order to compile the tests, specifically the parts that use weak linking, I have had to define MACOSX_DEPLOYMENT_TARGET to 10.2, which seems like a hack, but extensive searching seems to indicate that this is the only way to make apple gcc allow weak linking. Using any other value, bigger or smaller breaks weak linking. Also added _ANSI_SOURCE define required by some OSX headers, and some cosmetic gitignore changes. I believe these changes should not impact other platforms.
* x86_64: fix loading of LLOCAL floatsgrischka2012-03-052-5/+9
| | | | | | | | See also commit 9527c4949fd94adb2567229413c70c19b663a118 On x86_64 we need to extend the reg_classes array because load() is called for (at least) R11 too, which was not part of reg_classes previously.
* tcc.h: define TCC_IS_NATIVEgrischka2012-03-054-20/+34
| | | | | | - disable tccrun feature for non-native (cross-) compilers - define uplong for target adress size - fix using -Wl,-Ttext=... for Win64 (tccpe: ADDR3264 imagebase)
* Fix assumption of 32bit long on portions of ElfAndrew Mulbrook2012-03-033-18/+19
| | | | | | | | | 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-036-41/+24
| | | | 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-266-24/+41
| | | | | | | | | | | | | | | 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>
* Attempt to fix 32 bit OSX build. The fix consists of adding -m32 and -m64Milutin Jovanovic2012-02-162-4/+9
| | | | | | | | to the appropriate CFLAGS. In addition, memory hooks are very different on OSX, so build of bcheck.c had to be disabled for now. Change of the CFLAGS does affect builds on other platforms, and this needs to be tested.
* Patch attempting to build OSX TinyCC.Milutin Jovanovic2012-02-095-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | Applied patch found on stackoverflow (link below). I also found some related changes that looked like logically needed. The stackoverflow changes addressed only two registers which were breaking a compile. However reading the code in the same file shows two other register accesses that, while not breaking the build, should have the same fix. http://stackoverflow.com/questions/3712902/problems-compiling-tcc-on-os-x/3713144#3713144 The test driver was changed by changing 'cp -u' into 'cp' as '-u' is not supported on mac osx. I found that osx build required the WITHOUT_LIBTCC define. I suspect the reason for this is tcc unability to handle mach-o files. In order to properly address this I had to change 'configure' to propagate target os name to Makefile. Current state is that simple tests work, but not the whole 'make test' suite runs. To the best of my knowledge, these changes should not impact other platforms.
* i386: fix loading of LLOCAL floatsDaniel Glöckner2012-01-231-1/+3
| | | | These loads clobbered ebx as TinyCC wanted to load the address into st0.
* Error out when assigning void value.Thomas Preud'homme2012-01-221-0/+2
| | | | | | | | tcc should now error out when compiling code like: VOID ExitProcess(UINT uExitCode); (…) retCode = ExitProcess(pi.dwProcessId);
* s/derefencing/dereferencing/ in i386-gen.cThomas Preud'homme2012-01-081-1/+1
|
* Compile tccasm.c conditionally (TCC_CONFIG_ASM)Thomas Preud'homme2012-01-061-0/+2
| | | | | Only compile the content of tccasm.c if inline assembly is supported for this architecture by testing the presence of macro TCC_CONFIG_ASM.
* Fix linkage of named file in loader script.Thomas Preud'homme2012-01-041-44/+9
| | | | | | Remove the previous logic to link a named file with a loader script by using tcc_add_dll instead. Hence, all files can be linked, not only files ending in .so/.def.
* libtcc: add missing tcc_enable_debug()Nicolas Limare2011-10-031-0/+6
|
* Don't define strtold and strtof on *BSD + uClibcThomas Preud'homme2011-08-121-12/+0
| | | | | | | | | | | | | | Don't define strtold and strtof on *BSD and uClibc as they are already defined there since: * 2001 (FreeBSD 4.4) * 2009 (OpenBSD 4.5) * 2009 (DragonFlyBSD) * 2002 (uClibc) See http://lists.nongnu.org/archive/html/tinycc-devel/2011-07/msg00025.html for a bit more details.
* Fix problem with PLT and GOT relocs on armel.Daniel Glöckner2011-08-121-3/+12
| | | | | | | | | | | | | TinyCC fails to link correctly to libraries when both R_ARM_PLT32 and R_ARM_GOT32 relocation to a same symbol exist (see http://lists.nongnu.org/archive/html/tinycc-devel/2010-05/msg00032.html for more details). The patch marks all undefined weak symbols found in external libraries as strong. The value of all remaining weak symbols is set to zero just before the section is output. Note by Thomas Preud'homme: it's been 2 months in Debian without any new bug report, hence commiting.
* rename error/warning -> tcc_(error/warning)grischka2011-08-1115-285/+275
|