Ziyao
39ea340a31
Add option -e for setting ELF file's entry
2022-04-18 14:26:15 +08:00
Ziyao
0366924047
Add support of ldmxcsr and stmxcsr instructions on x86_64 and i386
2022-04-18 14:25:11 +08:00
Ziyao
8777ae984c
Allowing 'tcc -ar' to create empty archives
2022-04-18 14:23:03 +08:00
herman ten brugge
d3e4664629
Optimize prolog code on arm64
...
Only store registers that are needed in arm64 gfunc_prolog code.
Fix code in gen_bounds_epilog.
2022-04-15 20:11:18 +02:00
herman ten brugge
e86aae4f6d
Add default case to relocate function for x86_64
2022-04-12 07:11:52 +02:00
herman ten brugge
c1725a8f6e
Only define alloca on i386/x86_64
2022-04-12 07:07:40 +02:00
herman ten brugge
a5588501ab
Fix vla support for arrays with no size
2022-04-12 07:03:33 +02:00
Detlef Riekenberg
aea68dbb40
arm-asm, arm64-link: Silence warnings for unused functions
...
The code needs to be fixed: use the functions or remove them.
arm-asm.c:
asm_parse_vfp_regvar()
arm64-link:
gotplt_entry_type()
create_plt_entry()
Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
2022-04-12 02:11:06 +02:00
Detlef Riekenberg
ac42d6826b
tccgen: Avoid warnings in callers of the type_size() function.
...
Warnings reported in in x86_64-gen.c and arm-gen.c:
warning: ‘align’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
2022-04-12 01:30:44 +02:00
Detlef Riekenberg
ecf8e5a00e
tccelf: Avoid a compiler warning with snprintf
...
Target buffer must be larger as the format string + the replacement for %s
to avoid a warning [-Wformat-truncation=]
Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
2022-04-12 01:06:10 +02:00
Detlef Riekenberg
fe6b5c08dc
configure: Use the environment variable CC when compiling tcc
...
Using the environment CC is a common used feature to
select a compiler to build any software,
so it should be supported when building tcc.
The old way using the parameter --cc still works.
Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
2022-04-12 00:33:35 +02:00
herman ten brugge
6bb41a05d7
Update for gcc12 on x86_64
...
gcc12 uses the xmm registers a lot more.
- save xmm0/xmm1 in gen_bounds_epilog
- align stack for call to (__bound_)memmove call in gfunc_call
2022-04-11 08:21:34 +02:00
Detlef Riekenberg
5fb582ab7f
libtcc: Accept "-g0" to disable debug in addition to "-g", "-g1", "-g2" and "-g3"
...
This does not change our generated code.
Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
2022-04-10 18:26:14 +02:00
Detlef Riekenberg
3ce7bc6efc
Accept option "-Os" and define "__OPTIMIZE_SIZE__"
...
Some headers and source code change macros and
implementation, when __OPTIMIZE_SIZE__ is defined.
This does not change our generated code.
Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
2022-04-10 17:32:38 +02:00
Detlef Riekenberg
b3bebdb20a
libtcc: Allow more values for the -std= option
...
With this code, we can compile more projects,
who expect gcc or clang as compiler. (-std=gnu11 used in Makefiles)
As a further extension, it would be easy to disable gcc extensions
Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
2022-04-10 00:55:11 +02:00
Detlef Riekenberg
8759b2581d
Makefile: Use the .exe extension only on Windows for the c2str helper program
...
Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
2022-04-07 02:18:19 +02:00
Detlef Riekenberg
e2e5377e7b
Makefile: Add a doc target.
...
"make help" already documents a "doc" target,
but it was not present.
Signed-off-by: Detlef Riekenberg <wine.dev@web.de>
2022-04-01 21:26:55 +02:00
herman ten brugge
4a03f1fb20
Fix bounds checking struct return on arm/arm64
2022-03-28 09:07:09 +02:00
herman ten brugge
0244320b88
Add vla support for arrays with no size
...
Support vla arrays like arr[][s]
- tcc.h: add nesting parameter
- tccgen.c: use nesting to test for illegal vla's
- test/tcctest.c: add test case
2022-03-24 10:16:37 +01:00
Christian Jullien
750f0a3e3f
As suggested by Herman, move comment to the next line otherwise it incorrectly handles --config-bcheck=no --config-backtrace=no
2022-03-23 09:03:54 +01:00
herman ten brugge
313855c232
Fix multi dimensional vla arrays on stack
...
There is no code generation in post_type for vla arrays. This code
generation has to be delayed until gen_function.
- post_type save code in type info.
- gen_function use this code to generate vla code.
- enable testcode for vla arrays.
2022-03-21 11:40:43 +01:00
herman ten brugge
8a3d0a0557
Fix multidimensional arrays on stack
2022-03-18 07:26:07 +01:00
herman ten brugge
4efcada291
Fix when bound checking and test coverage is used at the same time
2022-03-17 18:06:02 +01:00
herman ten brugge
184d845838
Fix riscv64 test 90 after struct init commit
2022-03-17 17:16:24 +01:00
herman ten brugge
291eccc154
Vla fix for 64 bits targets
2022-03-17 10:06:24 +01:00
grischka
719d96665e
tccgen: Allow struct init from struct
...
Example:
struct S {int x,y;}
a = {1, 2},
b = {3, 4},
c[] = {a, b}, // new
d[] = {b, (struct S){5,6}}; // new
2022-03-16 19:18:16 +01:00
grischka
0c6adcbe53
tccgen: multi-dimensional vla: bug fixes
...
fixes these cases:
ptr - ptr (-> ptrdiff_t)
ptr +/- num (-> ptr)
sizeof (ptr+/-num) (-> size_t)
Also some cleanups
2022-03-16 19:18:16 +01:00
grischka
ec5d94291c
tccgen: accept array-size expressions in function paramters
...
Modify function parameter parser such that symbols are
put into token-table temporarily. Benefits are:
- detects redefinitions, as with
int foo(int a, int a);
- detects reserved symbols, as with
int foo(int if);
- can parse expressions like
int main(int argc, char *argv[argc + 1]);
- doesn't fix this one
int main(int argc, char *argv[++argc]);
Also: fix unexpected "function might return no value"
with statement expression
int f() { ({ return 0; }); }
2022-03-16 19:16:29 +01:00
Steffen Nurpmeso
917aad3bcf
Add some missing fdopen(3) checks (Domingo Alvarez Duarte)
2022-02-28 21:19:41 +01:00
herman ten brugge
308d8d17dc
Fix get thread id in lib/bcheck.c for freebsd
...
The api for getting the thread id is different for freebsd.
2022-02-21 09:15:43 +01:00
Christian Jullien
7225282ea5
Small patch from collective work to better support FreeBSD.
2022-02-20 15:45:24 +01:00
herman ten brugge
e9f59c804d
Update for freebsd 13.0
...
Add __RUNETYPE_INTERNAL define in include/tccdefs.h
2022-02-08 18:53:16 +01:00
Christian Jullien
4e0e9b8f21
Add '#define __LITTLE_ENDIAN__ 1' which was missing for macOS port
2022-01-11 07:06:09 +01:00
herman ten brugge
d33b189427
Fix vla bug
...
This fixes a vla bug. Probably more fixes are needed.
Add testcode for bug.
2021-12-27 11:39:52 +01:00
herman ten brugge
1692060fb0
Fix cross compiling tcc on freebsd
2021-12-27 11:32:35 +01:00
herman ten brugge
6c0e0b998b
Fix memcpy1/memcpy2 asm testcode on x86_64
2021-12-27 11:24:33 +01:00
Riccardo Schirone
027b8fb9b8
Add rpath to the library paths instead of state->rpath
2021-12-15 17:45:16 +01:00
Riccardo Schirone
d88857b210
If the DLL has a RPATH, use it when looking for NEEDED libraries
2021-12-15 17:30:25 +01:00
Alexander Sosedkin
da11cf6515
Don't skip weak symbols during ar creation
...
```
$ echo 'int __attribute__((__weak__)) f(void) { return 4; }' > w.c
$ tcc -c w.c -o w.o
$ tcc-old -ar rc w.a w.o; nm -s w.a # previous behaviour, not indexed
w.o:
0000000000000000 W f
$ ar rc w.a w.o; nm -s w.a # GNU binutils behaviour, indexed
Archive index:
f in w.o
0000000000000000 W f
$ tcc-new rc w.a w.o; nm -s w.a # new behaviour, indexed
Archive index:
f in w.o
0000000000000000 W f
```
2021-10-30 16:07:00 +02:00
mingodad
1645616843
Revert "Move almost all global variables to TCCState, actually all tests pass on Ubuntu 18.04 x86_64"
...
This reverts commit af686a796b
.
2021-10-22 07:39:54 +02:00
mingodad
2ce2dbcb09
Revert "Fix some errors on arm64-asm.c, rename some variables, fix several code style declarations"
...
This reverts commit 61537d899a
.
2021-10-22 07:39:26 +02:00
mingodad
d33f582e25
Revert "Fix missing parameter"
...
This reverts commit 1a8fb94350
.
2021-10-22 07:37:39 +02:00
mingodad
1a8fb94350
Fix missing parameter
2021-10-22 07:37:15 +02:00
mingodad
61537d899a
Fix some errors on arm64-asm.c, rename some variables, fix several code style declarations
2021-10-22 07:20:00 +02:00
mingodad
af686a796b
Move almost all global variables to TCCState, actually all tests pass on Ubuntu 18.04 x86_64
2021-10-21 20:09:42 +02:00
Ryan Burns
ca11849ebb
Permit '=' character in configure options
...
By replacing the `-f 2` field selection with `-f 2-`, we select fields
2 and beyond, so that arguments containing the '=' character are not
truncated.
This option qualifier list format is POSIX standard and tested
to work with the `cut` program from:
* GNU coreutils
* macOS (FreeBSD)
* NetBSD
* toybox
* busybox
* uutils-coreutils
In my case, this is useful because I'm trying to use an installation
prefix which contains an equals sign.
2021-10-09 17:28:42 -07:00
coltrane
15e9b7384e
Add few Windows API that can be used to detect the exact Windows version we are running on.
2021-09-16 08:52:35 +02:00
grischka
e97e108d0b
tccpe: #pragma pack(push) - support this form
2021-09-01 19:36:24 +02:00
Tyge Løvset
c7a57bf1fa
Prepended branch name to githash (tcc -v). WIN32: added githash support.
...
- E.g. "tcc version 0.9.27 mob:675046b (x86_64 Windows)"
- WIN32: Replaced compiler opt -O1 and -Os with -O2 (only 1% larger executable).
2021-08-21 09:10:56 +02:00
grischka
675046bd59
tcc/lib: reduce number of files
...
271 insertions(+), 292 deletions(-), -21 lines, -5 files
Also:
- tccdefs.h: WIN32: less (no) __builtins
- libtcc.c: simply ignore -arch
2021-08-03 22:49:18 +02:00