Commit Graph

640 Commits

Author SHA1 Message Date
grischka
903b6001e7 update Makefiles 2009-12-20 20:34:35 +01:00
grischka
0de95730ad build from multiple objects: fix other targets 2009-12-20 20:33:41 +01:00
grischka
b54862406e x86-64: fix gtst, back to only 5 regs for now 2009-12-20 20:33:21 +01:00
grischka
070b86a870 x86-64: use r8/r9 as generic integer registers 2009-12-20 02:19:51 +01:00
grischka
0e5c0ee045 x86-64: use r8,r9 as load/store registers 2009-12-20 01:54:39 +01:00
grischka
cda8c41ef3 win32: add size_t to _mingw.h 2009-12-20 01:54:38 +01:00
grischka
4a01eb09d8 use vpushv in some places 2009-12-20 01:54:38 +01:00
grischka
50b040ef83 win64: add tiny unwind data for setjmp/longjmp
This enables native unwind semantics with longjmp on
win64 by putting an entry into the .pdata section for
each compiled fuction.

Also, the function now use a fixed stack and store arguments
into X(%rsp) rather than using push.
2009-12-20 01:54:37 +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
7fa712e00c win32: enable bounds checker & exception handler
exception handler borrowed from k1w1. Thanks.
2009-12-19 22:22:43 +01:00
grischka
8bbde91f62 tcc_relocate: revert to 0.9.24 behavior 2009-12-19 22:16:23 +01:00
grischka
3db219477a tccrun: new file
factor out -run support
2009-12-19 22:16:22 +01:00
grischka
41e112360f fix uninitialized warnings with 'type.ref' 2009-12-19 22:16:22 +01:00
grischka
3020a4765d tccpe: with -l try also with "lib" prefix
-lfoo searches: foo.def, libfoo.def, foo.dll, libfoo.dll
2009-12-19 22:16:21 +01:00
grischka
94bf4d2c22 tccpe: improve dllimport 2009-12-19 22:16:21 +01:00
grischka
1308e8ebcf integrate x86_64-asm.c into i386-asm.c
Also, disable 16bit support for now as it causes bugs
in 32bit mode.  #define I386_ASM_16 if you want it.
2009-12-19 22:16:20 +01:00
grischka
e81569bc70 tcc: add "-Wl,-rpath=path" option (library search path) 2009-12-19 22:16:20 +01:00
grischka
dd3d4f7295 x86-64: fix udiv, add cqto instruction 2009-12-19 22:16:19 +01:00
grischka
1445fea582 tccpe: allow linkage to extern symbols from asm 2009-12-19 22:16:18 +01:00
grischka
b5e2238483 tccasm: make VT_VOID symbols ST_NOTYPE, elf-wise
This was confusing objdump such that it did not print
disassembly with -d.

Also, put filename as with C compilation
2009-12-19 22:16:18 +01:00
grischka
ab4a4ab25e x86-64: in gv(): ignore second register 2009-12-19 22:16:17 +01:00
grischka
d79b867d55 win64: adjust for two args with setjmp(buf,ctx) 2009-12-19 22:16:17 +01:00
Christian Jullien
614790dc14 x86-64: Fix Wrong comparisonbetweenpointerandlongcste
main (int argc, char *argv[])
{
    char *p = (char *)0x12345678ABCD000F;
    int res;
    res = (p != (char *)0x12345678ABCD000F);
    return res;
}
2009-12-19 22:16:16 +01:00
grischka
e500c9118a i386-asm: fix imul
With imul the 3rd operand defaults to the 2nd on.  The previous
logic left 'op_type[2]' uninitialized which caused the bug to
show up only sometimes.
2009-12-06 17:41:22 +01:00
grischka
56d6abdb3d tccgen: propagate alignment from typedef
Store (part of) the AttributeDef structure in the (int)sym-r
field of the typedef symbol (kludgy).
2009-12-06 17:37:33 +01:00
bobbl
c0620c8a00 avoid needless register save when storing structures
When storing structs with a memcpy call in vstore(),
so far a needless entry remaining on the vstack
sometimes resulted in an useless store generated by
save_regs() in gfunc_call() for the memcpy routine.
2009-12-01 17:59:30 +01:00
Bernhard Reutner-Fischer
b573072300 document -print-search-dirs
Signed-off-by: aldot <rep.dot.nop@gmail.com>
2009-12-01 17:59:29 +01:00
Bernhard Reutner-Fischer
d2e125186f improve handling of --help
Previously ./configure --prefix=/foo --help didn't show the help-text

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-12-01 17:59:29 +01:00
Luigi Rizzo
55cb2170cd solve tccelf problem on FreeBSD
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
2009-12-01 17:59:28 +01:00
grischka
720a32ede4 win32: remove #define alloca from mingw headers 2009-12-01 17:58:39 +01:00
grischka
679f0794f8 win32: explain usage of mingw w32api package 2009-11-30 17:14:41 +01:00
grischka
a5279b2c05 tccpe: fclose FILE*
Reported by Martin Ettl (thanks)
2009-11-30 17:14:37 +01:00
grischka
a26bf10de3 win64: Use tcc's own assembler
Now that we have it thanks to Mr. Féret
2009-11-21 23:43:38 +01:00
grischka
50055880f9 asm 32/64: replace (long)sym->next by sym->jnext 2009-11-21 23:43:30 +01:00
grischka
1383055b17 x86_64: fix asm 2009-11-14 21:48:37 +01:00
grischka
0a3bcb57f6 fix 32bit asm
The new 16bit code was causing wrong 0x66 prefixes
in 32bit code.

The fix possibly breaks the feature on 16bit asm.
2009-11-14 20:05:22 +01:00
Feret@.(none)
c15e37edad Removed binary executable output support
This broke writing executables.
2009-11-13 18:09:02 +01:00
Bernhard Reutner-Fischer
2fdb45f577 fix ambiguity
Signed-off-by: aldot <rep.dot.nop@gmail.com>
2009-11-13 18:09:02 +01:00
Frederic Feret
3065e70630 Fixed compilation error in i386-asm.c 2009-11-13 18:09:01 +01:00
Frederic Feret
ae23c46ce2 fixed and added missing file for x86_64 assembly 2009-11-13 18:09:01 +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
Frederic Feret
526c464504 first support of x86_64 assembly 2009-11-13 18:08:59 +01:00
Frederic Feret
0d768b9713 added 16-bit x86 assembly support 2009-11-13 18:08:58 +01:00
Frederic Feret
2349efa61b add binary executable output support 2009-11-13 18:08:58 +01:00
Daniel Glöckner
bc48cc1edb fix sizeof(array + integer)
Previously sizeof would return the size of the array although the
expression is always a plain pointer of 4 (or 8) bytes.
2009-11-13 18:05:15 +01:00
grischka
5b113f3ee3 win32: handle __declspec(dllimport) 2009-11-13 18:04:56 +01:00
grischka
dd70d19267 #define __TINYC__ = version-number 2009-11-13 17:11:52 +01:00
Shinichiro Hamaji
5dadff3de5 x86-64: Fix stab debug information.
We need 32bit relocations for code and 64bit for debug info.
Introduce a new macro R_DATA_PTR to distinguish the two usages.
2009-08-24 13:30:03 +02:00
Shinichiro Hamaji
3a1380120d x86-64: change the type of size_t and ptrdiff_t.
size_t and ptrdiff_t should be unsigned long and long, respectively.
2009-08-24 13:30:03 +02:00