aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Only use blx if availableThomas Preud'homme2012-10-162-8/+19
| | | | | | | | Introduce ARM version for the target architecture in order to determine if blx instruction can be used or not. Availability of blx instruction allows for more scenarii supported in R_ARM_CALL relocation. It should also be useful when introducing support for the R_ARM_THM_CALL relocation.
* Fix R_ARM_CALL when target fonction is ThumbThomas Preud'homme2012-10-101-4/+12
| | | | | | With R_ARM_CALL, if target function is to be entered in Thumb mode, the relocation is supposed to transform bl in blx. This is not the case actually so this commit is there to fix it.
* Support for R_ARM_[THM_]MOV{W,T}_ABS[_NC} relocsThomas Preud'homme2012-10-102-0/+36
| | | | | | | | | Add support for relocations R_ARM_MOVW_ABS_NC and R_ARM_MOVT_ABS as well as their Thumb2 counterpart R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_ABS. These are encountered with gcc when compiling for armv7-a and a data is loaded in a register, either in arm or Thumb2 mode. The first half of the data is loaded with movw ; the second half is loaded with movt.
* fix #include_next infinite loop bug, see http://savannah.nongnu.org/bugs/?31357Sergey Vinokurov2012-09-201-0/+27
|
* tccrun: another incompatible change to the tcc_relocate APIgrischka2012-09-013-6/+15
| | | | | | We are now compatible with the 0.9,25 version though. A special value for the second (ptr) argument is used to get the simple behavior as with the 0.9.24 version.
* Disable callsave_test for armThomas Preud'homme2012-07-301-0/+2
| | | | | Disable callsave_test for arm since it uses alloca which is unavailable on this platform.
* Add multiarch directory for arm hardfloat variantThomas Preud'homme2012-07-291-1/+3
| | | | | | | Arm hardfloat variant uses a different ABI than arm and uses thus a different multiarch directory for headers and libraries. This commit detect whether the system uses the hardfloat variant and configure the multiarch directory accordingly.
* get_reg(): try to free r2 for an SValue firstThomas Preud'homme2012-07-111-4/+5
| | | | | | | | | | To be able to load a long long value correctly on i386, gv() rely on the fact that when get_reg() look at an SValue it tries first to free the register in r2 and then r. More information about the context can be found at http://lists.nongnu.org/archive/html/tinycc-devel/2012-06/msg00017.html and later at http://lists.nongnu.org/archive/html/tinycc-devel/2012-07/msg00021.html
* Fix R_ARM_REL32 relocationThomas Preud'homme2012-07-091-0/+1
| | | | Add missing break in the code handling R_ARM_REL32 relocation.
* Incorrect shift result type on unsigned short first argument.Vincent Lefevre2012-07-061-1/+3
| | | | | | The code for shifts is now similar to code for binary arithmetic operations, except that only the first argument is considered, as required by the ISO C standard.
* Tests on left-shift type.Vincent Lefevre2012-07-063-1/+55
|
* tests: Minor adjustments selecting which tests are run on each platform.Milutin Jovanović2012-06-272-11/+41
| | | | | | | | | | | The intent is for 'make test' to pass cleanly on each platform, and thus easier spotting of regressions. Linux is best supported by most tests running and passing. Mac OSX passes mosts tests that do not make/link with binary files, due to lack of mach-o file support. !!! I have very limited knowledge of Windows platform, and cannot comment why all tests(1) fail. I have posted to newsgroup asking for someone to test Windows platform.
* Incorrect shift result type with 64-bit ABIVincent Lefevre2012-06-271-0/+3
| | | | | | | | | | | | | | | On 2012-06-26 15:07:57 +0200, Vincent Lefevre wrote: > ISO C99 TC3 says: [6.5.7#3] "The integer promotions are performed on > each of the operands. The type of the result is that of the promoted > left operand." I've written a patch (attached). Now the shift problems no longer occur with the testcase and with GNU MPFR's "make check". -- Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
* tests: Added numerous tests.Milutin Jovanović2012-06-18111-0/+2988
| | | | | | | | | | | | The tests are taken almost verbatim from the open source project PicoC. It can be found at https://code.google.com/p/picoc/. The tests range from very simple/trivial ones to more complicated. My view is that the more tests the better. Without tests like this I was very reluctant to make any changes to tcc for the fear of breaking things. The tests pass on Win32, OSX, Linux x86 and x86_64. One or two tests fail on each platform due to differences in the runtime library.
* Detect multiarch on Kfreebsd and HurdThomas Preud'homme2012-06-131-0/+3
|
* Evaluate configure argumentsThomas Preud'homme2012-06-121-0/+1
| | | | | | Evaluate configure arguments to reproduce autotools behavior. Autotools actually only expands a few variable and do it at make time but it makes the change much simpler.
* Revert "Make ex1.c and ex4.c be executable on any systems"grischka2012-06-122-2/+2
| | | | | | | | Using /usr/bin/env tcc doesn't work as it was reported. Revert to using the full path which fails if the user installs tcc in non-default location. Then again this is just an example. This reverts commit 27a428cd0fae475d7377e1dbe218c064ee217d85.
* 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"
* osx: Removed some optimizations for x86 builds as they were causing seg faults.Milutin Jovanović2012-06-102-0/+3
| | | | | | | | | | | | | When using gcc compiler (as opposed to llvm) to build 32 bit tcc, compiler flags -mpreferred-stack-boundary=2, -march=i386 and -falign-functions=2 were being used. -march is redundant as -m32 is already being used. The other two seem to be corrupting stack. I am not sure why this is the case, as the explanation of the flags states that only running code size should be affected, but it does. I think that is is safe to remove these flags altogether for all compilers and platforms, especially since they are not being used for 64 bit builds. However I do not want to apply such wide change without agreement from the people on the mailing list.
* x86-64: Fix call saved register restoreMichael Matz2012-06-102-2/+22
| | | | | | Loads of VT_LLOCAL values (which effectively represent saved addresses of lvalues) were done in VT_INT type, loosing the upper 32 bits. Needs to be done in VT_PTR type.
* tccelf.c: Add R_ARM_REL32 relocationThomas Preud'homme2012-06-051-0/+2
|
* Add support for arm hardfloat calling conventionThomas Preud'homme2012-06-055-76/+330
| | | | | See Procedure Call Standard for the ARM Architecture (AAPCS) for more details.
* 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
|