Commit Graph

616 Commits (ab24b2874752d75dfc4cebdf771fe3a1863789ec)
 

Author SHA1 Message Date
grischka ab24b28747 tcc xref experiment
This is an experiment to let TCC create a symbol cross-reference of
itself (or any other target).

#
# how to run:
#
# run:
#   $ ./tcc -vvvv -D__inline= tcc.c -ldl > xref.out
#   $ perl admin/tccxref.pl xref.out main
# or for instance to generate an xref for the preprocessor only:
#   $ perl admin/tccxref.pl xref.out next -- error warning expr_const
#
# If you have an IDE with an output window that can run these
#  commands, you can click the linenumbers to jump to the source.
2009-12-04 23:46:39 +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
grischka 834b782a9c tccpe: fill checksum header field 2009-08-24 13:30:02 +02:00
grischka 569c20f104 tccpp: fix quirk with cached headers and #else
Such as with

    #ifndef FOO_H
    ...
    #else
    ...
    #endif
2009-08-24 13:30:01 +02:00
grischka 1026ca5888 fix "symbol not defined" if symbol has offset 0 2009-08-24 13:30:01 +02:00
grischka d923e652f2 tccpp: avoid double free with macro_ptr_allocated (after errors) 2009-08-24 13:30:00 +02:00
grischka 0d34c2136e tccgen: free inline functions correctly 2009-08-24 13:30:00 +02:00
grischka 697f9e305d win64: fix bat 2009-08-24 13:28:02 +02:00
grischka b08dfb8273 tcc: optionally build using libtcc 2009-07-18 22:08:01 +02:00
grischka f88350b611 fix some warning 2009-07-18 22:07:51 +02:00
grischka c998985c74 cleanup: constify some global data 2009-07-18 22:07:42 +02:00
grischka 94ae3984b0 tccpe: set tcc_lib_path from DLL 2009-07-18 22:07:33 +02:00
grischka 1df662c1b0 tccpe: load dll on the fly 2009-07-18 22:07:25 +02:00
grischka 9fda4f4248 win32: treat long double as double 2009-07-18 22:07:17 +02:00
grischka 97738d1ae9 win32: reformat examples, crt etc 2009-07-18 22:07:10 +02:00
grischka bb5e0df79a x86-64: fix load() for const pointers: (void*)-2 2009-07-18 22:07:03 +02:00
grischka fc977d56c9 x86-64: chkstk, alloca 2009-07-18 22:06:54 +02:00
grischka c0fc0fa0c4 win64: add x64 target to build-tcc.bat 2009-07-18 22:06:46 +02:00
grischka dc251a7d8d win64: use new headers from mingw 2009-07-18 22:06:37 +02:00
grischka 06aed3d171 win64: update tiny_impdef, tiny_libmaker (Elf64) 2009-07-18 22:06:14 +02:00
grischka 09ac9faf59 win64: align jmp_buf 2009-07-18 22:06:07 +02:00
grischka 035918ef2f win64: fix pointer <-> unsigned long typecast issues 2009-07-18 22:05:58 +02:00
grischka 459875796b pe32+ target: adjust x86_64-gen.c
- calling conventions are different:
  * only 4 registers
  * stack "scratch area" is always reserved
  * doubles are mirrored in normal registers
- no GOT or PIC there
2009-07-18 22:05:49 +02:00
grischka 3ba1532cfb pe32+ target: add to makefile 2009-07-18 22:05:40 +02:00
grischka 3ea4acb9b9 pe32+ target: add in various #define's 2009-07-18 22:05:27 +02:00
grischka 719ba918dd tccpe: use more official structs 2009-07-18 21:55:32 +02:00