Commit Graph

941 Commits

Author SHA1 Message Date
grischka
d59bd8be8e tccrun: rt_printline: fix no-stabs case 2011-07-14 19:11:10 +02:00
grischka
af83993810 tccrun: improve rt_printline output format
Prefix line with "file:linenumber:" such that editors
can easily jump to the source location
2011-07-14 19:11:08 +02:00
grischka
df4c0892f3 tccrun: win64: add unwind function table for dynamic code
This works only when tcc.exe is compiled using MSC.  MinGW does
something in the startup code that defeats it.
2011-07-14 19:09:49 +02:00
grischka
232650f8b3 tccgen: reset aligned attribute for next type
Basically, with:
    typedef __attribute__((aligned(16))) struct _xyz {
         ...
    } xyz, *pxyz;

we want the struct aligned but not the pointer.

FIXME: This patch is a hack, waiting for someone in the knowledge
of correct __attribute__ semantics.
2011-07-14 19:00:46 +02:00
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
Thomas Preud'homme
4ccb5662cb Fix array_test: move params to local vars
array_test is declared and called with no parameters but defined with
one parameter. Compilation succeed (definition is after the use so the
compiler consider the declaration) as well as link (the function exist
and has the right name) but running the test segfault on i386 platforms.

This patch moves the parameter to local variable. If the intention was
to call it with an array parameter then feel free to fix it again.
2011-07-12 15:10:59 +02:00
grischka
45184e01d8 win32: add -Wl,--stack=xxx switch
For example:

    $ tcc -Wl,--stack=4194309

which means 4 MB.  Default is 1 MB.
2011-07-11 18:47:16 +02:00
grischka
7b573dc239 win32/include: enable _timezone etc variables.
which live in msvcrt.dll and need __declspec(import) which
works by now.

Also:
- _mingw.h: conditionally define WIN32_LEAN_AND_MEAN
- malloc.h: don't undef alloca
2011-07-11 18:44:47 +02:00
Joe Soroka
436c1a734f allow defining sysroot at compile-time 2011-07-11 00:20:48 -07:00
Joe Soroka
c71798c376 handle arrays with a flexible member but no initializer 2011-07-11 00:18:36 -07:00
Joe Soroka
cd3d1a45f3 better constant handling for expr_cond 2011-07-11 00:00:47 -07:00
Joe Soroka
38756b506f fix self-referential token pasting 2011-07-08 02:51:06 -07:00
Thomas Preud'homme
5cf5871aaf Use CONFIG_TCC_LDDIR for ld.so on all linux archs 2011-07-08 11:16:34 +02:00
Thomas Preud'homme
13121e220c Fix problem spotted in <4E15F966.4090102@gmx.de>
* Rename tcc_split_path_components
* Move tcc_split_path below memory wrapper section
* Ident tcc_split_path by 4
* Remove prefix and suffix clutter in tcc_split_path
* Don't dereference beyond the end of the search paths string
2011-07-08 10:51:26 +02:00
Joe Soroka
d01f65ef93 fix end-of-scope for self-referential macros 2011-07-08 00:55:34 -07:00
Thomas Preud'homme
f8656fbc3c Remove useless changes from 31ca000d in configure
After commit 4d6a4a26e0, the changes in
configure are no longer needed.
2011-07-07 15:32:20 +02:00
Thomas Preud'homme
27a428cd0f Make ex1.c and ex4.c be executable on any systems
Use /usr/bin/env to make ex1.c and ex4.c on any systems, wherever is
installed tcc.
2011-07-07 12:17:04 +02:00
Thomas Preud'homme
a03346c06e Document in README that ex4.c can be executed. 2011-07-07 12:15:43 +02:00
Thomas Preud'homme
571465d32b Revert "Make examples' shebang use target tcc bindir path"
This reverts commit cb2138f8b0.
2011-07-07 12:14:08 +02:00
Thomas Preud'homme
4d6a4a26e0 Add configuration of include subdirectories
Add the possibility to search headers in several subdirectories of
/usr/local/include and /usr/include. A possible use case would be for
tcc to search for headers in /usr/local/include/x86_64-linux-gnu,
/usr/local/include, /usr/include/x86_64-linux-gnu and /usr/include in
turn.
2011-07-07 12:10:57 +02:00
Thomas Preud'homme
a6775fc154 Introduce tcc_split_path_component for 31ca000d
Rewrite code introduced by 31ca000d and following commits around a new
function tcc_split_path_component.
2011-07-07 11:48:37 +02:00
Thomas Preud'homme
ca6ff4fada Free extra_libdir_str after use. 2011-07-06 10:26:46 +02:00
Thomas Preud'homme
38de06e334 Fix commit 31ca000d
* CONFIG_TCC_*LDDIR should not be exported if no --*lddir option is used.
* Don't write a : at the beginning of extralddir
2011-07-05 23:49:53 +02:00
Thomas Preud'homme
31ca000d72 Add multiarch dirs to linker search path
By default, tcc search libraries in /lib and /usr/local/lib while crt*.o
files are searched in /usr/lib and ld.so is searched in /lib.
Unfortunetely the path are hardcoded in source code. This patch allow
tcc to look in an other directory and also to look in extra directories.
It's then possible to make tcc search libraries in /lib/x86_64-linux-gnu
and /usr/local/lib/x86_64-linux-gnu while crt*.o files are searched in
/usr/lib/x86_64-linux-gnu and ld.so is searched in
/lib/x86_64-linux-gnu.
2011-07-05 11:16:12 +02:00
Thomas Preud'homme
cb2138f8b0 Make examples' shebang use target tcc bindir path
Use @BINDIR@ in shebang of examples to put the right path on the target
system. That is, use #!/usr/local/bin/tcc if tcc is installed in /usr/local/bin
and #!/usr/bin/tcc if tcc is installed in /usr/bin/tcc.
2011-06-18 00:45:20 +02:00
Thomas Preud'homme
3511e6e2a8 Default to create progs with symbols (incl. debug)
* Set CFLAGS entirely in configure if not already set.
* Compile bcheck.c with the same flags as the other source files
* Don't strip binaries by default (GB are cheap now) but provide a
  --strip-binaries option in configure script.
2011-06-17 22:22:04 +02:00
Thomas Preud'homme
330d2ee0fa Update Changelog
* Mention the various ARM improvement
* Make changelog consistent with regards to initial capital letters
* Fix credits for VLA
* Fix entry about asm label (variable are also supported)
2011-05-17 23:40:49 +02:00
Thomas Preud'homme
eb152022a0 make test work when LIBTCC1 not defined
Make libtest depends on LIBTCC1 instead of ../libtcc1.a and define
LIBTCC1 to $(TOP)/$(LIBTCC1) if LIBTCC1 is defined
2011-05-17 23:30:32 +02:00
grischka
c449ef2e1f tcc-doc: remove obsolete '-o option must also be given' 2011-05-17 21:55:05 +02:00
Daniel Glöckner
28a5b702f4 Fix calling ARM EABI functions returning big structures
The wrong type was tested to determine the size of the structure.
2011-05-17 02:24:45 +02:00
Thomas Preud'homme
8123e334e9 Support scratchbox, Nokia N900 and qemu arm archs
Add arm, armv5tejl and armv7l to the list of supported arm architectures
2011-05-16 15:30:52 +02:00
Thomas Preud'homme
66d992d883 Remove unused variables
Declare float type conditionally to not declare them conditionally when
they are not used.
2011-05-16 15:21:25 +02:00
Thomas Preud'homme
ee06ef9dd3 Remove unused variables
Remove unused local variables and declare them conditionally when they
are used only on some architectures.
2011-05-16 14:15:32 +02:00
Thomas Preud'homme
db9d5f0fa4 Improve weak aliases handling
* Include only the STB_GLOBAL alias symbol in .dynsym section
* Stop the loop when STB_GLOBAL symbol is found
* Reword / simplify comment
2011-05-16 13:49:08 +02:00
Thomas Preud'homme
921f002a6d make clean work when LIBTCC1 not defined
Don't call make -C lib clean if LIBTCC1 is not defined, else make clean
fails (for example of arm).
2011-05-14 16:21:45 +02:00
Joe Soroka
7391cf01a7 fix spurious vstack-leak warnings on error 2011-05-02 00:05:36 -07:00
Joe Soroka
48d81a796e libtcc.c: report vstack "leaks" only if compile succeeded 2011-04-14 01:02:42 -07:00
Joe Soroka
2b7a8eb8f5 use of TOK_alloca breaks cross compiler build
VLA inserts a call to alloca via enum TOK_alloca, but TOK_alloca
only exists on I386 and X86_64 targets.  This patch just emits an
error at compile-time if someone tries to compile some VLA code
for a TOK_alloca-less target. The best solution might be to just
push the problem to link-time, since the existence-or-not of a
alloca implementation can only be determined by linking.  It seems
like just declaring TOK_alloca unconditionally would achieve that,
but for now, this at least gets the cross compilers to build.
2011-04-12 00:17:08 -07:00
Joe Soroka
46e2dd7c32 tcctok.h: fix ifdef target/host confusion 2011-04-12 00:11:47 -07:00
Joe Soroka
812781cd11 simplify/rollback VLA pointer subtraction
I don't know if it makes a difference to gen_op(TOK_PDIV) or not,
but logically the ptr1_is_vla test in TP's VLA patch seems out of
order, where the patch to fix it would be:
------------------------------------------------------------------
@@ -1581,15 +1581,15 @@ ST_FUNC void gen_op(int op)
                 u = pointed_size(&vtop[-1].type);
             }
             gen_opic(op);
+            if (ptr1_is_vla)
+                vswap();
             /* set to integer type */
 #ifdef TCC_TARGET_X86_64
             vtop->type.t = VT_LLONG;
 #else
             vtop->type.t = VT_INT;
 #endif
-            if (ptr1_is_vla)
-                vswap();
-            else
+            if (!ptr1_is_vla)
                 vpushi(u);
             gen_op(TOK_PDIV);
         } else {
------------------------------------------------------------------

Instead of that patch, which increases the complexity of the code,
this one fixes the problem by just rolling back and retrying with
a simpler approach.
2011-04-11 23:39:27 -07:00
Joe Soroka
1b0f42f8ad update documentation to reflect VLA changes 2011-04-09 23:41:16 -07:00
Joe Soroka
1b8c094f39 remove no-longer-necessary naive fix for vla vstack leak 2011-04-09 23:04:01 -07:00
Joe Soroka
c85f77de70 prevent internal segfault on apparent VLA at file scope 2011-04-09 22:59:35 -07:00
Joe Soroka
1446b543ae VLA fix [3/3]: store VLA sizeofs in anonymous runtime stack vars 2011-04-09 22:52:25 -07:00
Joe Soroka
7c7ca3c6aa VLA fix [2/3]: removed VT_ARRAY from VT_VLA types
A VLA is not really an array, it's a pointer-to-an-array.
Making this explicit allows us to back out a few parts
of the original VLA patch and paves the way for the next
part of the fix, where a VLA will be stored on the runtime
stack as a pointer-to-an-array, rather than on the compile-
time stack as a Sym*.
2011-04-08 01:09:39 -07:00
Joe Soroka
cb2fa5eab9 VLA fix [1/3]: added testcase demonstrating VLA bug 2011-04-08 01:07:17 -07:00
Joe Soroka
174d61a56e move a comment to its correct location 2011-04-08 00:46:32 -07:00
Joe Soroka
b714af0405 add naive workaround for VLA vstack leak 2011-04-08 00:44:01 -07:00
Joe Soroka
6eb97c70b7 VLA leaks vstack. added warning to detect future leaks 2011-04-08 00:41:55 -07:00
Joe Soroka
c94f80502e VLA bcheck works via bound alloca; add test, remove warning 2011-04-06 15:27:45 -07:00