Commit Graph

408 Commits (d348a9a51d32cece842b7885d27a411436d7887b)

Author SHA1 Message Date
grischka 5280293d6b make: create native tcc from separate objects
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.
2011-07-14 18:45:37 +02:00
Joe Soroka db6fcce78f tcc: add sysinclude path with -B, like gcc does 2011-02-02 00:00:12 -08:00
Joe Soroka e939c4072c add -isystem cmdline option 2011-02-01 23:32:53 -08:00
Sergei Trofimovich 0a50e6c933 tcc.c: fix an error when you build an object file with '-pthread' key set
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>
2011-01-04 11:17:52 +02:00
Henry Kroll III d16722481f tcc: add unsupported option -pedantic 2010-12-20 04:23:30 -08:00
Henry Kroll III 8f98573658 tcc: -m32 prefix "win32-" when file extension is present 2010-12-13 00:00:18 -08:00
Henry Kroll III c6f5d819af tcc: fix format string in error handler 2010-12-08 01:05:50 -08:00
Henry Kroll III ffb9fcc5a2 tcc: oops, error handler does not accept format strings 2010-12-08 00:52:33 -08:00
Henry Kroll III b3be007afa tcc: fix -m32 and add -m64 option 2010-12-08 00:27:06 -08:00
Henry Kroll III f3d3ab5a69 tcc: move undef out of if block 2010-12-06 16:36:00 -08:00
Henry Kroll III bb7bb37fe2 tcc: add -m32 option to x86_64 cross compilers 2010-12-06 16:17:20 -08:00
Henry Kroll III 33f86ada92 trim unnecessary bits from my previous 3 commits 2010-12-05 12:47:50 -08:00
Henry Kroll III eb550ed23b tcc: add option -s for gcc compatibility (ignored) 2010-12-04 16:04:33 -08:00
Henry Kroll III 9e406656c7 tcc.c: skip -lpthread when -c option specified 2010-11-30 13:58:18 -08:00
Henry Kroll III 9036c18170 tcc: Linux -pthread option sets -D_REENTRANT and -lpthread 2010-11-24 16:42:08 -08:00
grischka a7fb00e887 tccmain: simplify option help 2010-09-08 19:13:36 +02:00
Kirill Smelkov 93de8d8038 tcc: Explicitly require -l<lib> for libraries
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.'
2010-06-21 20:49:46 +04:00
Kirill Smelkov 0c928da96d tcc: Draft suppoprt for -MD/-MF options
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", ...)
2010-06-21 20:49:02 +04:00
Kirill Smelkov bdae4a59c3 tcc: Refactor "compute default outfile name" into libtcc function
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...
2010-06-20 21:36:47 +04:00
Kirill Smelkov a919a373da Add input files/libs and reloc_output switch to TCCState
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...
2010-06-20 20:30:01 +04:00
Kirill Smelkov 66b54af8ea tcc: Fix typo in error (it's '%s', not '%s) 2010-06-16 16:51:55 +04:00
Detlef Riekenberg 34dabe496f libtcc: Detect (but ignore) -init and -fini for -Wl
--
By by ... Detlef
2010-04-05 22:56:33 +02:00
Detlef Riekenberg 78e83d8761 libtcc: Allow multiple options for -Wl separated with ','
I moved the code to libtcc to prepare for a later tiny_ld

--
By by ... Detlef
2010-04-05 21:21:58 +02:00
Detlef Riekenberg 62ba135228 Add support for --help 2010-01-26 22:58:48 +01:00
Detlef Riekenberg 2650584ac4 Recognize -Wl,-Bsymbolic
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
2010-01-26 22:55:14 +01:00
grischka 88a3ccab9f allow tcc be build from separate objects
If you want that, run: make NOTALLINONE=1
2009-12-20 01:53:49 +01:00
grischka e81569bc70 tcc: add "-Wl,-rpath=path" option (library search path) 2009-12-19 22:16:20 +01:00
Frederic Feret b7d7af4fa2 ARM: first support for arm-pe target 2009-11-13 18:09:00 +01:00
Frederic Feret 2f73e42d87 various fixes and new options for PE format 2009-11-13 18:09:00 +01:00
grischka b08dfb8273 tcc: optionally build using libtcc 2009-07-18 22:08:01 +02:00
grischka 94ae3984b0 tccpe: set tcc_lib_path from DLL 2009-07-18 22:07:33 +02:00
grischka 0085c648f6 bcheck: restore malloc hooks when done 2009-07-18 21:54:47 +02:00
grischka c4b7e77bbe accept option -x <lang> 2009-06-17 02:11:27 +02:00
grischka 67aebdd5b7 enable making tcc using libtcc 2009-05-11 18:46:02 +02:00
grischka 0a35f9d66e move static prototypes to libtcc.c 2009-05-11 18:45:56 +02:00
grischka f9181416f6 move some global variables into TCCState 2009-05-11 18:45:44 +02:00
grischka 5c6509578e make tcc from tcc.c and libtcc from libtcc.c 2009-05-05 20:41:17 +02:00
grischka b8f6e1ae30 move minor things from libtcc.c to other files 2009-05-05 20:30:39 +02:00
grischka 9dc9cbf319 move libtcc interface and helper functions to libtcc.c 2009-05-05 20:18:53 +02:00
grischka 0d1ed74102 move parser/generator to tccgen.c 2009-05-05 20:18:10 +02:00
grischka 805990b94e move preprocessor to tccpp.c 2009-05-05 20:17:49 +02:00
grischka ae37bd5abc move declarations to tcc.h 2009-05-05 20:17:26 +02:00
grischka e9e89ad699 enable backtrace only when it's supported 2009-04-18 18:39:27 +02:00
grischka d165e87340 libtcc: new api tcc_set_lib_path 2009-04-18 15:08:03 +02:00
grischka 73ba078d2f tcc_relocate: return error and remove unused code 2009-04-18 15:08:03 +02:00
Shinichiro Hamaji d36fea34e3 Call relocate_sym() before we return the offset, so user doesn't need to check the return value twice. 2009-04-18 15:08:03 +02:00
grischka dd5630ff95 tcc -E: fix pasting empty tokens
/* test case */
#define t(x,y,z) x ## y ## z
int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
        t(10,,), t(,11,), t(,,12), t(,,) };

tcc -E: xpected result:
int j[] = { 123, 45, 67, 89,
 10, 11, 12, };
2009-04-18 15:08:02 +02:00
grischka 0f0ed4a8bf tcc -E: preserve spaces, alternative solution
/* test case */
#define STR(x) #x
#define MKSTR(x) STR(x)
MKSTR(-A-)
MKSTR(+ B +)

tcc -E: expected result:
"-A-"
"+ B +"
2009-04-18 15:08:02 +02:00
grischka 90697c4c56 CONFIG_TCC_STATIC: add dummy for dlclose 2009-04-18 15:08:02 +02:00
grischka d62301b050 avoid warning uninitialized 2009-04-18 15:08:02 +02:00
Shinichiro Hamaji 9a7173bf69 x86-64: Fix tcc -run. We need extra memory for PLT and GOT.
Size of the extra buffer is too large for now.
2009-04-18 15:08:02 +02:00
grischka e6ba81b012 get rid of 8 bytes memory leak 2009-04-18 15:08:02 +02:00
grischka b1697be691 change tcc_add/get_symbol to use void* 2009-04-18 15:08:02 +02:00
grischka 795f67428e alternative int tcc_relocate(TCCState *s1, void *ptr); 2009-04-18 15:08:02 +02:00
grischka 9a8b2912ed TOK_builtin_malloc: alternative solution 2009-04-18 15:08:02 +02:00
Shinichiro Hamaji 39a4b859d4 x86-64: Fix cast from integers to pointers.
Now,

./tcc -run -DTCC_TARGET_X86_64 tcc.c -run tcctest.c

works!
2009-04-18 15:08:02 +02:00
Shinichiro Hamaji 83fd36333a Fixes for issues I've just found/introduced to x86 TCC.
- Cast from pointer to long long makes TCC output an error. Use cast to int before we apply shift operation for a pointer value.
- Removed test cases for casts from pointer to char/short because they produce warning.
2009-04-18 15:08:01 +02:00
Shinichiro Hamaji be43c8e0ed x86-64: Cast from 64bit pointer to long long must not generate movslq. 2009-04-18 15:08:01 +02:00
grischka a9c78d04f2 win32: accept uppercase filename suffixes 2009-04-18 15:08:01 +02:00
Shinichiro Hamaji b879ffa193 x86-64: There can be valid addresses which is greater than 0xc0000000. 2009-04-18 15:08:01 +02:00
Shinichiro Hamaji de3f0a46fe Fix for x86-64: The first and second arguments of memcpy must be pointers. 2009-04-18 15:08:01 +02:00
Shinichiro Hamaji 2e9b57b6d0 Fix silly typos in the previous change. 2009-04-18 15:08:01 +02:00
Shinichiro Hamaji 9fe28b610e x86-64: Make ABI for long double compatible with GCC.
- Now we use x87's stack top the long double return values.
- Add rc_fret and reg_fret, wrapper functions for RC_FRET and REG_FRET.
- Add a test case to check if strto* works OK.
2009-04-18 15:08:01 +02:00
Shinichiro Hamaji fcf2e5981f x86-64: Combine buffers of sections before we call tcc_run().
- Now we can run tcc -run tcc.c successfully, though there are some bugs.
- Remove jmp_table and got_table and use text_section for got and plt entries.
- Combine buffers in tcc_relocate().
- Use R_X86_64_64 instead of R_X86_64_32 for R_DATA_32 (now the name R_DATA_32 is inappropriate...).
2009-04-18 15:08:01 +02:00
Shinichiro Hamaji 830b7533c9 Generate PIC code so that we can create shared objects properly.
- Add got_table in TCCState. This approach is naive and the distance between executable code and GOT can be longer than 32bit.
- Handle R_X86_64_GOTPCREL properly. We use got_table for TCC_OUTPUT_MEMORY case for now.
- Fix load() and store() so that they access global variables via GOT.
2009-04-18 15:08:01 +02:00
grischka 6c10429aa5 check for absolute include paths
Suggested by Sandor Zsolt <narkoskatona@yahoo.com>
2009-04-18 15:07:28 +02:00
grischka 29c8e1545a get rid of "free_section problem" with private sections 2009-04-18 15:07:28 +02:00
grischka 5818945ef6 accept "restrict" in array-decl (STDC 199901) 2009-04-18 15:07:27 +02:00
grischka 0e015988cc i386: apply "align=8 for doubles ..." for PE only 2009-04-18 15:07:27 +02:00
Shinichiro Hamaji e6db5f5fb6 x86-64 bug fix: Use stack with alignment just like 32bit environments. 2009-04-18 15:07:09 +02:00
Shinichiro Hamaji ebb874e216 Remove multiple definition error caused by combination of x86-64 and va_list.
We need malloc and free to implement va_start and va_end.
Since malloc and free may be replaced by #define, we add __builtin_malloc and __builtin_free.
2009-04-18 15:07:09 +02:00
Shinichiro Hamaji 6512d9e2ea Add check for invalid numbers.
If there are some characters after TCC parses a number, it is an error.

This bug was reported on list:

http://www.mail-archive.com/tinycc-devel@nongnu.org/msg02014.html
2009-04-18 15:07:09 +02:00
Shinichiro Hamaji af6cbc48d1 Fix overrun in decl_initializer_alloc.
This bug was reported on

http://lists.gnu.org/archive/html/tinycc-devel/2009-03/msg00035.html

This happens because parser of array initializer doesn't stop to read until semi-colon or comma.
2009-04-18 15:07:09 +02:00
Shinichiro Hamaji 006c907da7 Code cleaning: utilize vpushll(). 2009-04-18 15:07:09 +02:00
Shinichiro Hamaji 4f056031f4 Support long long bitfields for all architectures.
- Modified gv() and vstore(), added vpushll().
- Added a test case for long long bitfields.
- Tested on x86 and x86-64.
2009-04-18 15:07:09 +02:00
Shinichiro Hamaji ae607280c5 Allow long long as a type of bitfields on x86-64. 2009-04-18 15:07:08 +02:00
grischka 3116744bdd i386: align=8 for double and long long 2009-04-18 15:07:08 +02:00
grischka b41fc95566 win32: fix for VC8Express compiler 2009-04-18 15:07:08 +02:00
Kirill Smelkov 00f0932760 tcc -E: preserve spaces (partial solution)
Recently I needed to trim storage space on an embedded distro which has
X.

X depend on cpp which is ~8MB in size as shipped in Debian, so the idea
was to remove cpp and use `tcc -E` instead where appropriate.

I've done this with the following 'hack' put inplace of /usr/bin/cpp :

    #!/bin/sh -e
    TCC=/home/kirr/local/tcc/bin/tcc
    last="${!#}"

    # hack to distinguish between '... -D...'  and '... file'
    if test -r "$last"; then
        exec $TCC -E "$@"
    else
        exec $TCC -E "$@" -
    fi

But the problem turned out to be in `tcc -E` inability to preserve
spaces between tokens. So e.g. the following ~/.Xresources

    XTerm*VT100*foreground: black
    ...

got translated to

    XTerm * VT100 * foreground : black

which is bad, bacause now X don't understand it.

Below is a newbie "fix" for the problem.

It still does not preserve spaces on macro expansion, but since the fix
cures original problem, I think it is at least one step forward.

Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
2009-04-18 15:07:08 +02:00
Alexander Egorenkov 5a044b67bb type_size function returned incorrect size
of multi dimensional arrays if dimension is divisable by 2
2009-04-18 15:07:08 +02:00
grischka 64147b346b fix constant optimization for unsigneds 2009-04-18 15:07:08 +02:00
grischka 7c3f19c079 fix data overflow with init_putv
The simplest code to reproduce this bug seems to be
    int a[][] = {{1,1,1,1,1,1,1}};
2008-12-02 02:36:27 +01:00
Shinichiro Hamaji 0a9873aa22 Add support of x86-64.
Most change was done in #ifdef TCC_TARGET_X86_64. So, nothing should be broken by this change.

Summary of current status of x86-64 support:

- produces x86-64 object files and executables.
- the x86-64 code generator is based on x86's.
-- for long long integers, we use 64bit registers instead of tcc's generic implementation.
-- for float or double, we use SSE. SSE registers are not utilized well (we only use xmm0 and xmm1).
-- for long double, we use x87 FPU.
- passes make test.
- passes ./libtcc_test.
- can compile tcc.c. The compiled tcc can compile tcc.c, too. (there should be some bugs since the binary size of tcc2 and tcc3 is differ where tcc tcc.c -o tcc2 and tcc2 tcc.c -o tcc3)
- can compile links browser. It seems working.
- not tested well. I tested this work only on my linux box with few programs.
- calling convention of long-double-integer or struct is not exactly the same as GCC's x86-64 ABI.
- implementation of tcc -run is naive (tcc -run tcctest.c works, but tcc -run tcc.c doesn't work). Relocating 64bit addresses seems to be not as simple as 32bit environments.
- shared object support isn't unimplemented
- no bounds checker support
- some builtin functions such as __divdi3 aren't supported
2008-12-02 02:30:47 +01:00
Shinichiro Hamaji 1e776b29d3 Suport LDOUBLE_SIZE == 16 environment. 2008-12-02 02:26:40 +01:00
Shinichiro Hamaji c92daa02e4 One more s/int/long/ 2008-12-02 02:26:11 +01:00
Shinichiro Hamaji 2355fc7686 Use long instead of int to hold pointer values. 2008-12-02 02:26:03 +01:00
Shinichiro Hamaji d6072d3703 Add __builtin_frame_address(0)
Adding the GCC extension __builtin_frame_address(). We support only zero as the argument for now.
With this functionality, we can implement GCC compatible stdarg by macros in x86-64.
2008-12-02 02:25:59 +01:00
Shinichiro Hamaji 7dd792ef51 Introduce ElfW macro and ELFW to encapsulate the difference between Elf32_* and Elf64_*. Also, introduce ElfW_Rel and SHT_RELX for difference between REL and RELA. 2008-12-02 02:25:45 +01:00
Daniel Glöckner 76b02c2a03 Futher changes to casts
nocode_wanted can't be used to enforce constant expressions, as it is
set f.ex. by __builtin_constant_p.

A null pointer is unequal to a pointer to any object or function.
Assuming symbols always point to memory, a symbol+constant cast to bool
is always true.
2008-11-30 07:21:49 +01:00
Daniel Glöckner 5fd6f7bd44 Fix get_tok_str wrt wide characters
Fixes both, character constants and string literals.
2008-11-30 07:21:46 +01:00
Daniel Glöckner deb410710c Rewrote '?' for constants
The condition is now cast to _Bool and it now works with return
types bigger than 32 bit.
2008-11-30 07:21:42 +01:00
Daniel Glöckner 1b599ea7f8 Cast parameter of '!' to _Bool 2008-11-30 07:21:35 +01:00
Daniel Glöckner 2d9b5e0bb8 Rewrote casts
Casting of constants was done only inside functions.
I restructured the code and used intermediate types (long double/long long)
for most conversions to have less ifs.

Please review.
There are lots of cases to take care of and lots of mistakes to make.
2008-11-30 07:21:30 +01:00
grischka 83466c6151 line-numbers output for TCC -E 2008-11-30 07:21:01 +01:00
grischka 7bebf1f59a was hash, not link 2008-09-15 02:07:55 +02:00
Daniel Glöckner a80acab4fc Display error on statement expressions with complex return type
The return type of a statement expression (a GCC extention) may
involve elements on the symbol stack that have been put there by
the expression. These will be freed at the end of the expression
so that the calling block can not use them.

Contrary to the comment (written in 2003), this bug no longer shows
up in Valgrind, as freed symbols are now put onto a stack for later
reuse.
2008-09-12 22:23:02 +02:00
Daniel Glöckner 3783b33508 Fix bitfields with non-int types and in unions
The ISO C draft allow only signed/unsigned int and _Bool as base type
for bitfields. TinyCC ever since allowed a wider range of types, but
there were many bugs that shifted values when they shouldn't, etc..
The patch introduces a restriction to the layout of bitfields with
mixed types that makes it incompatible with GCC. In

struct {
  typeA x:1;
  typeB y:1;
};

y is combined with x in the same byte iff typeA is typeB (neglecting
signedness). This is done to avoid alignment issues and exceeding the
width of typeA.
2008-09-12 22:23:01 +02:00
Daniel Glöckner 43a34d354a Force null pointer exception for code outside of a function
TinyCC sometimes has problems to evaluate constant expressions at
compile time. This leads to code being generated outside of functions.
Without this patch some of these bugs are not caught, because
cur_text_section still points to the section of the last function.
Before the first function cur_text_section is uninitialized.
Setting cur_text_section to a null pointer should make TinyCC die in
all cases.
2008-09-12 22:23:00 +02:00
Daniel Glöckner 5a92536cea Optimize arithmetic with pointer to value on stack + constant 2008-09-12 22:23:00 +02:00
Daniel Glöckner e263ee3cbf Fix gv for long longs
long long a();
long long b() {
  return a();
}

At the end of b there will be some useless register shuffling.
This is because return wants to have the result of a in REG_IRET.
gv checks if this is the case for BOTH registers of the long long.
After this test it uses REG_LRET for the second register if the
first is supposed to be REG_IRET. In other cases it uses RC_INT.

The patch compares the second register against the class it will
have in the end instead of the register class the first register
will have.

At this point I would like to remind those who pick up the patches
that there are two other mails by me with uncommitted fixes:
http://lists.gnu.org/archive/html/tinycc-devel/2003-10/msg00044.html
http://lists.gnu.org/archive/html/tinycc-devel/2008-08/msg00007.html

  Daniel
2008-09-12 22:22:59 +02:00
Daniel Glöckner 256f6e6200 A prefix for default library/include search paths
This patch is useful for cross compilers. Without this patch tcc
tries to use the host's libraries, crt*.o and include files.
The patch prepends a string to all default paths. The string can
be passed to configure with --sysroot=string.

  Daniel
2008-09-12 22:22:58 +02:00
Daniel Glöckner 12265da6cd Runtime lib functions
Yesterday I felt the urge to change a few things in TinyCC.
This is the first and biggest change of all of them.

- use __aeabi_*divmod functions in ARM EABI to make binaries depend
  solely on standardized library functions

- refactor ARM floating point <-> integer conversion a bit

- rename long long->float and shift library functions to correspond to
  the names used by GCC

- compile more tokens conditionally to reduce the size of TinyCC

The intention is primarily to allow users of the ARM target to use
libgcc (which is usually available as a shared library) instead of
libtcc1 (which can't be compiled for ARM due to lack of an inline
assembler).

Changing the EABI target to use the divmod functions in theory allows
to use it without libtcc1 on any (not necessarily GCC based) ARM EABI
system.

  Daniel
2008-09-12 22:22:36 +02:00
grischka 2c6cd08bcc fix isidnum_table for CH_EOF (-1) 2008-09-12 02:36:05 +02:00
grischka 1300cec38c free_section bugfix 2008-09-12 02:36:01 +02:00
grischka f9bf48d643 release loaded dlls cleanly (Sam K) 2008-05-05 22:40:49 +00:00
grischka 96bd8f2b25 enable pe-output from libtcc (Shmuel Zeigerman) 2008-05-05 22:39:43 +00:00
grischka f2698687fb fix options in C scripts after -run 2008-04-27 18:50:35 +00:00
grischka 5247bbc2f0 fix stabstr with linked objects 2008-04-27 18:49:31 +00:00
grischka 23594b6980 enable multiple states and fix minor memory leaks 2008-04-27 18:47:35 +00:00
grischka f22e961f80 update manual, changelog 2008-03-31 19:50:58 +00:00
grischka a327c7a552 added verbosity levels (-vv -vvv) 2008-03-31 19:49:14 +00:00
grischka 4d9aaacc85 Accept standard input as an inputstream (Hanzac Chen) 2008-03-31 18:42:56 +00:00
grischka 9bcc0b970b Add -soname linker option (Marc Andre Tanner) 2008-03-25 21:04:47 +00:00
grischka 6ed868c51c Enable -B option for library path on win32 2008-03-08 20:00:56 +00:00
grischka 3667408a57 Just warn about unknown directives, define __STDC_VERSION__=199901L 2008-01-16 20:16:35 +00:00
grischka 5342b32eef Switch to newer tccpe.c (includes support for resources) 2007-12-19 17:36:42 +00:00
grischka adb1456472 Handle backslashes within #include, #error, #warning 2007-12-17 19:35:15 +00:00
grischka 6c96c41ee4 Import changesets (part 4) 428,457,460,467: defines for openbsd etc. 2007-12-16 18:24:44 +00:00
grischka 34140dd627 Use _WIN32 for a windows hosted tcc and define it for the PE target. 2007-12-13 19:07:19 +00:00
grischka f99d3de221 Import 409,410: ARM EABI by Daniel Glöckner 2007-12-04 20:38:09 +00:00
grischka 2de1b2d14c Some in-between fixes (See Changelog for details). 2007-11-25 22:14:35 +00:00
grischka d778bde7f9 Import more changesets from Rob Landley's fork (part 2) 2007-11-21 17:16:31 +00:00
grischka 54bf8c0556 Import some changesets from Rob Landley's fork (part 1) 2007-11-14 17:34:30 +00:00
bellard fb2c34f8cd fixed sign extension in some type conversions (Dave Dodge) 2006-10-28 14:47:39 +00:00
bellard 52b7254b9c fixed multiple typedef specifiers handling 2006-10-28 14:28:02 +00:00
bellard 0bea5c7f21 workaround for function pointers in conditional expressions (Dave Dodge) 2006-10-28 14:15:37 +00:00
bellard 24a19cc37e discard type qualifiers when comparing function parameters (Dave Dodge) 2006-10-28 14:13:28 +00:00
bellard 3b8cd565be fixed multiple concatenation of PPNUM tokens (initial patch by Dave Dodge) 2006-10-28 14:05:19 +00:00
bellard 200b58dad8 initial implementation of -E option 2006-10-16 19:44:00 +00:00
bellard 62c5a5466a fixed parsing of function parameters 2005-09-03 22:51:34 +00:00
bellard 7bc5e51847 anonymous union/struct support (Filip Navara) 2005-09-03 22:33:53 +00:00
bellard e9c64e3f47 windows style fastcall (Filip Navara) 2005-09-03 22:21:22 +00:00
bellard 81f957ae09 normalized slashes in paths (Filip Navara) 2005-09-03 22:18:51 +00:00
bellard 6f8b8887b1 added support for win32 wchar_t (Filip Navara) 2005-09-03 21:54:47 +00:00
bellard 44738b516a fixed function type check 2005-09-03 21:07:35 +00:00
bellard b0b8ac13ce mark executable sections as executable when running in memory 2005-09-03 18:31:43 +00:00
bellard 4d7eadb2fa preprocessor function macro parsing fix (grischka) - disabled -fleading-underscore for win32 2005-06-17 22:05:58 +00:00
bellard f6db2edc40 added -f[no-]leading-underscore - '@' symbol for asm 2005-06-15 22:32:29 +00:00
bellard fe9b1f60ce win32 merge (grischka) 2005-04-17 13:15:54 +00:00
bellard 4821702fb4 win32 merge 2005-04-14 23:49:21 +00:00
bellard 0bca832c18 #pragma pack support (grischka) 2005-04-13 21:30:51 +00:00
bellard 8f2d519203 #include_next support (Bernhard Fischer) 2005-04-10 22:18:53 +00:00
bellard 2c538d7a2b initial PE format support 2005-04-10 21:46:58 +00:00
bellard fc72e41a55 better gcc compatibility (Jon Griffiths) 2004-12-16 22:19:28 +00:00
bellard 48c85f1b15 optimisations: hash table for include file search, pool for symbol allocation - sympler token string allocation - '-b' fix with '-run' option 2004-11-07 15:45:19 +00:00
bellard 1d0e5e8b01 stack full fix 2004-11-02 21:55:13 +00:00
bellard 1e1d3ff687 packed attribute support 2004-10-29 23:55:13 +00:00
bellard 736b565766 fixed const and volatile function parameters typing - fixed string parsing when skipping code 2004-10-28 21:14:30 +00:00
bellard 6b52984ce4 added _Bool in bit-fields 2004-10-27 21:42:06 +00:00
bellard c9c05ca5f0 copyright update 2004-10-27 21:38:03 +00:00