Commit Graph

1007 Commits

Author SHA1 Message Date
Jaroslav Kysela
ab73c9bc4e fix another static struct init issue (arrays with unknown size at end) 2011-02-22 12:15:45 +01:00
Jaroslav Kysela
dbefae52b0 Fix complex static initializers (handle additional '}' and '{' brackets)
- added an example to test suite
- the "warning: assignment discards qualifiers from pointer target type"
  is present but harmless
2011-02-22 12:15:44 +01:00
grischka
a3ebdd0aeb tccpe: support leading underscore for symbols
To make this the default, enable this line in libtcc.c:tcc_new:

    #if defined(TCC_TARGET_PE) && 0
        s->leading_underscore = 1;

and then recompile tcc and also libtcc1.a
2011-02-13 17:44:12 +01:00
Thomas Preud'homme
11b2d33523 Add support of asm label for variables.
Add support for asm labels for variables, that is the ability to rename
a variable at assembly level with __asm__ ("newname") appended in
its declaration.
See http://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc/Asm-Labels.html for more
details.
2011-02-09 00:12:57 +01:00
Thomas Preud'homme
32a682b88f Fix fct asm label: only valid for declaration
- Fix function assembly label mechanism introduced in commit
  9b09fc376e to only accept alternative
  name for function declaration.
- merge the code with the one introduced in commit
  264a103610.
- Don't memorize token for asm label but directly the asm label.
2011-02-09 00:12:57 +01:00
Thomas Preud'homme
c23400278a Fix incorrect use of basic type as bitflags.
Fix incorrect use of basic types as bitflags and inefficiency in commit
cf36410e30
2011-02-07 23:46:20 +01:00
Thomas Preud'homme
cf36410e30 Complain for static fct declared w/o file scope
Error out on static function without file scope and give an explaination
to the user

This is a rewrite of e9406c09a3 but
considering problems raised about static local function pointers in
632ee5a540.
2011-02-06 22:50:05 +01:00
Joe Soroka
3b4b3b75a6 revert "update VT_STRUCT_SHIFT for new VT_VLA" 2011-02-04 17:54:08 -08:00
Thomas Preud'homme
db560e9439 Revert "Implement C99 Variable Length Arrays"
This reverts commit a5a50eaafe.
2011-02-05 02:33:46 +01:00
Thomas Preud'homme
38f6467c06 Revert "Reorder increasingly VT_* constants in tcc.h"
This reverts commit 7f00523e2e.
2011-02-05 02:33:46 +01:00
Thomas Preud'homme
c1b7267a2f Revert "Make TOK_alloca available for x86-64"
This reverts commit af26ac56bf.
2011-02-05 02:33:45 +01:00
Thomas Preud'homme
4b8470f3ae Revert "Disable C99 VLA when alloca is unavailable."
This reverts commit e3e5d4ad7a.
2011-02-05 02:33:45 +01:00
Joe Soroka
b0c50fbd4d update VT_STRUCT_SHIFT for new VT_VLA 2011-02-04 14:33:38 -08:00
grischka
2775173d4d fix crash with get_tok_str() in skip()
crash was triggered by numbers etc. as unexpected token, i.e.
everything that requires additional information with the token.
2011-02-04 20:23:43 +01:00
Thomas Preud'homme
e3e5d4ad7a Disable C99 VLA when alloca is unavailable.
* Disable C99 VLA detection when alloca is unavailable and protect the
  new reference to TOK_alloca in decl_initializer in order to compile
  and run for architecture without working alloca.

  Not all code of C99 VLA is commented as it would required many ifdef
  stanza. Just the detection is commented so that VT_VLA is never set
  any type and the C99 VLA code is compiled but never called. However
  vpush_global_sym(&func_old_type, TOK_alloca) in decl_initializer needs
  to be protected by an ifdef stanza as well because it uses TOK_alloca.

* include alloca and C99 VLA tests according to availability of
  TOK_alloca instead of relying on the current architecture
2011-02-04 15:24:48 +01:00
Thomas Preud'homme
af26ac56bf Make TOK_alloca available for x86-64
TOK_alloca is now available on x86-64 so make put definition of
TOK_alloca outside the BCHECK conditional macro definition but test if
arch is i386 or x86-64. This makes C99 VLA works (understand compile) on
x86-64.
2011-02-04 13:25:38 +01:00
Thomas Preud'homme
7f00523e2e Reorder increasingly VT_* constants in tcc.h 2011-02-04 02:22:25 +01:00
Thomas Preud'homme
a5a50eaafe Implement C99 Variable Length Arrays
Implement C99 Variable Length Arrays in tinycc:
- Support VLA with multiple level (nested vla)
- Update documentation with regards to VT_VLA
- Add a testsuite in tcctest.c
2011-02-04 02:22:25 +01:00
Thomas Preud'homme
d35a3ac375 Correct Changelog wrt. to fix attribution
Correctly attribute the patch bringing support for Debian GNU/kFreeBSD
kernels to Pierre Chifflier.
2011-02-04 02:22:15 +01: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
Joe Soroka
b88677454b tcctest: plugged memleak (was polluting valgrind reports) 2011-02-01 16:05:57 -08:00
Joe Soroka
0d9376da70 tccasm: accept bracketed offset expressions 2011-02-01 15:53:48 -08:00
Joe Soroka
47b4cf22cd tccasm: accept "fmul/fadd st(0),st(n)" (dietlibc ipow/atanh) 2011-02-01 15:49:37 -08:00
Joe Soroka
87d84b7cb8 tccasm: allow one-line prefix+op things like "rep stosb" 2011-02-01 15:37:58 -08:00
Joe Soroka
a25325e9be tccasm: define __ASSEMBLER__ for .S files, like gcc does 2011-02-01 15:26:21 -08:00
Joe Soroka
75c6695932 tccpp: fix bug in handling of recursive macros 2011-02-01 13:23:40 -08:00
Joe Soroka
cf08675702 weak definitions overrule non-weak prototypes 2011-02-01 09:41:03 -08:00
Joe Soroka
c59d3426b8 tccasm: support .weak labels 2011-02-01 08:43:54 -08:00
Joe Soroka
4d5105c8f1 support weak attribute on variables 2011-02-01 00:37:53 -08:00
Joe Soroka
6839382480 asmtest: avoid testing against complex nop alignment in gas
.align #,0x90 in gas ignores the 0x90 and outputs any kind
of nop it feels like.  the one avoided by this patch is a 7
byte nop, which gas has been doing since at least 1999:
http://sourceware.org/ml/binutils/1999-10/msg00083.html

In order to match what gas does, we would need to make
code alignment target-specific, import a lot of code, and
face the question: exactly which gas {version,target,tune}
combo are we trying to match?  see i386_align_code in:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-i386.c?annotate=1.460&cvsroot=src

The smart noppery is turned on via the special casing of 0x90
at line 438 in md_do_align in:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-i386.h?annotate=1.1&cvsroot=src
2011-01-23 16:46:24 -08:00
Joe Soroka
2047f88334 i386-asm: accept retl as a synonym for ret 2011-01-21 01:35:28 -08:00
Joe Soroka
f43fafc680 accept multiple comma separated symbols for .globl/.global directives, like gas does 2011-01-20 02:00:50 -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
Sergei Trofimovich
d97a25fbdd lib/alloca*: mark ELF stack access flags as nonexecutable
Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
2011-01-04 10:38:52 +02:00
Sergei Trofimovich
288831854b Makefile: respect LDFLAGS (set via --extra-ldflags=)
Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
2011-01-04 10:22:02 +02:00
Shinichiro Hamaji
0ed7ba3f5e Support struct arguments with stdarg.h
- add __builtin_va_arg_types to check how arguments were passed
- move most code of stdarg into libtcc1.c
- remove __builtin_malloc and __builtin_free
- add a test case based on the bug report
  (http://www.mail-archive.com/tinycc-devel@nongnu.org/msg03036.html)
2010-12-28 19:32:40 +09:00
Shinichiro Hamaji
07fd82b411 Make alignments for struct arguments 8 bytes
The ABI (http://www.x86-64.org/documentation/abi.pdf) says
"The size of each argument gets rounded up to eightbytes"
2010-12-28 19:09:59 +09:00
Shinichiro Hamaji
83f0a7b6f8 Test va_copy in tcctest.c 2010-12-28 17:53:56 +09:00
Shinichiro Hamaji
45e1ae2896 One more fix for tcc -run
We don't need r_addend for addresses in PLT.
2010-12-28 17:44:51 +09:00
Shinichiro Hamaji
d457addfc3 Fix for the previous commit.
R_X86_64_PLT32 for .so doesn't need DLL relocation.
2010-12-28 16:52:21 +09:00
Shinichiro Hamaji
0ae39f1957 Handle r_addend and R_X86_64_PLT32 properly.
- r_addend should be applied for PLT entries as well
- R_X86_64_PLT32 should be handled just like R_X86_64_PC32
- spec says GLOB_DAT and JUMP_SLOT don't need r_addend (not tested)
  http://www.x86-64.org/documentation/abi.pdf

Now we can -run ELF objects generated by GCC.
2010-12-28 16:14:30 +09:00
Henry Kroll III
48e325df3c configure: --sharedir defaults to /usr/local/share 2010-12-23 06:36:07 -08:00
Henry Kroll III
f449f98dec configure: --sharedir documentation root 2010-12-22 04:42:39 -08:00
Henry Kroll III
44f7055a04 make: fix cannot find -ltcc with --disable-rpath 2010-12-21 09:47:17 -08:00
Henry Kroll III
73cb4392ab make: fix install with CC=tcc and potential link problem 2010-12-20 06:20:08 -08:00
Henry Kroll III
90355c78ed configure: add --disable-rpath option (Fedora) 2010-12-20 05:55:54 -08:00
Henry Kroll III
3b3a7cc8ba configure: improvements to option --tccdir 2010-12-20 05:38:59 -08: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