seyko
50cdccf3ef
Added a gcc preprocessor options -P, -P1
...
tcc -E -P
do not output a #line directive, a gcc compatible option
tcc -E -P1
don't follow a gcc preprocessor style and do output a standard
#line directive. In such case we don't lose a location info when
we going to compile a resulting file wtith a compiler not
understanding a gnu style line info.
2015-03-03 14:19:14 +03:00
seyko
40418f87c7
Move a line_ref variable from tcc_preprocess() function into struct BufferedFile.
...
This id needed for a right ouput in other places,
precisely to calculate a number of empty lines which are waiting to output.
2015-03-03 14:15:28 +03:00
seyko
5e3e321474
A preprocessor should Interpret an input line "# NUM FILENAME" as "#line NUM FILENAME"
...
A cpp from gcc do this.
A test case:
tcc -E tccasm.c -o tccasm.i
tcc -E tccasm.i -o tccasm.ii
After a patch the line numbers in tccasm.ii are the same
as in tccasm.i
2015-03-03 14:06:05 +03:00
Edmund Grimley Evans
1706d2254b
arm64-gen.c: Improve generation of stack offsets.
2015-03-02 20:51:03 +00:00
Edmund Grimley Evans
1d41da9590
arm64-gen.c: Rename some functions and add comments.
2015-03-02 20:45:58 +00:00
Edmund Grimley Evans
86e8dcd5e2
arm64: Improve constant generation, with tests.
2015-03-02 20:39:28 +00:00
Edmund Grimley Evans
883fd365c7
arm64-gen.c: Better explanation of relocation choice.
2015-03-01 11:31:10 +00:00
Edmund Grimley Evans
fc119f9840
73_arm64.c: Avoid taking address of return value.
2015-02-26 12:27:00 +00:00
Edmund Grimley Evans
8329facdfa
Add 73_arm64 for testing some arm64 things, mostly PCS.
2015-02-25 22:51:41 +00:00
Edmund Grimley Evans
a4d43618fb
arm64-gen.c: In gen_va_arg, handle the remaining HFA cases.
2015-02-25 22:51:41 +00:00
Edmund Grimley Evans
36bb8994dd
Relicensing TinyCC
2015-02-25 07:52:39 +00:00
Edmund Grimley Evans
97e08be344
tests/tcctest.c: Test COMPAT_TYPE(char *, signed char *).
2015-02-24 19:35:31 +00:00
Edmund Grimley Evans
40f7e11c53
tccgen.c: Make sure that gen_op always returns an rvalue.
...
Either this fix, or an alternative one, is required for arm64.
2015-02-23 22:51:10 +00:00
Michael Matz
6d055312a2
aarch64: Fix -run.
...
This adds some more support for properly transfering some
offsets over the different stages of a relocations life.
Still not at all psABI compliant and DSOs can't yet be generated.
But it runs the testsuite in qemu-arm64.
2015-02-23 22:51:10 +00:00
Edmund Grimley Evans
b14ef0e24b
Add arm64 (AArch64) as a target architecture.
2015-02-23 22:51:03 +00:00
Edmund Grimley Evans
738606dbd5
Use RELA relocations properly for R_DATA_PTR on x86_64.
...
libtcc.c: Add greloca, a generalisation of greloc that takes an addend.
tcc.h: Add greloca and put_elf_reloca.
tccelf.c: Add put_elf_reloca, a generalisation of put_elf_reloc.
tccgen.c: On x86_64, use greloca instead of greloc in init_putv.
2015-02-21 21:29:03 +00:00
Edmund Grimley Evans
86c850fc58
tcc-doc.texi: Explain VT_LLOCAL a bit better.
...
And delete the sentence about it being removed.
2015-02-20 23:29:21 +00:00
Edmund Grimley Evans
ff3f9aa6ba
Fix handling of case_reg in switch statement.
...
The back end functions gen_op(comparison) and gtst() might allocate
registers so case_reg should be left on the value stack while they
are called and set again afterwards.
2015-02-20 23:16:00 +00:00
Thomas Preud'homme
a6c3ce6ec0
The "open a whisky and cut your finger open" patch
...
Make integer constant parsing C99 compliant
2015-02-18 07:01:03 +00:00
Reimar Döffinger
ff783b94c7
Add support for .p2align asm directive.
...
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2015-01-20 08:49:49 +01:00
Reimar Döffinger
fb6331e0fa
Fix macro expansion of empty args.
...
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2015-01-18 22:00:10 +01:00
Reimar Döffinger
a6149c6dbb
Set CONFIG_MULTIARCHDIR for cross compilers.
...
Chances a cross-compiler will find a working crt*.o
in /usr/lib are more or less 0.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2015-01-18 21:21:59 +01:00
Reimar Döffinger
ae09558d71
Build also WinCE cross compiler when cross compilers enabled.
...
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2015-01-18 21:16:34 +01:00
seyko
e260b03686
Allow tcc to understand a setob,... opcodes as alias to seto,...
...
PS: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20101122/112576.html
This is fix PR8686 for llvm: accepting a 'b' suffix at the end
of all the setcc instructions.
2015-01-06 22:59:19 +03:00
seyko
c334b59142
Warn about a conflicting compile options spectified on the command line.
...
Try "tcc -E -c tccasm.c -o tccasm.o"
2015-01-06 22:19:45 +03:00
seyko
b93179f3c0
.i as file extension
...
Add a ".i" extension as alias for ".c"
GCC and file extensions:
.i C source code which should not be preprocessed.
Before a patch:
./tcc -E tccasm.c -o tccasm.i
./tcc -c tccasm.i -o tccasm.o
tccasm.i:1: error: unrecognized file type
2015-01-06 16:01:41 +03:00
seyko
524abd46b4
round() in test (24_math_library) fail because there are no defs included.
...
gcc complain but work right and tcc simply fail to compile right.
2015-01-05 18:23:32 +03:00
Carlos Montiers
77ef3b2929
crt1.c revision
2014-12-30 00:25:52 -03:00
Lee Duhem
5a76c5d2f3
Fix parsing of binary floating point number
...
* tccpp.c (parse_number): `shift' should be 1 while parsing binary
floating point number.
* tests/tests2/70_floating_point_literals.c: New test cases for
floating point number parsing.
2014-12-15 16:32:08 +08:00
Lee Duhem
20a5845a47
tcc.h (BufferedFile): Remove unnecessary static memory allocation
...
The memory needed by `buffer' will be allocated in `tcc_open_bf',
these is no need to allocate them in BufferedFile statically.
2014-12-11 10:04:22 +08:00
Lee Duhem
f1703e2b2f
libtcc.c (put_extern_sym2): Extend the scope of buf to match its use
...
After leaving the code block that `buf' is defined, `buf' will not
exist, so `name' will point to a variable that does not exist.
2014-12-11 10:04:22 +08:00
Lee Duhem
4bf3f6c965
.gitignore: Ignore Emacs temporary files
2014-12-11 10:04:22 +08:00
Lee Duhem
73e8f6b60a
Makefile: Add rules to create tags and TAGS.
2014-11-28 23:25:05 +08:00
Lee Duhem
4ae462b668
.gitignore: Ignore generated files.
2014-11-28 23:24:55 +08:00
Carlos Montiers
9b14e8715a
little optimization to crt1
2014-11-23 01:51:38 -03:00
Carlos Montiers
f40b82295e
__getmainargs compatibility checking success
2014-11-22 19:00:49 -03:00
James Buren
1e07ea71d3
win32: fix implicit function warning
...
This includes windows.h to fix a warning about
an implicit function usage of ExitProcess().
2014-11-03 16:17:15 -06:00
Matteo Cypriani
26b26f355f
Filter-out warning about softfloat in tests2
2014-10-17 16:37:54 -04:00
grischka
9d7fb33360
tccgen: use lvalue as result from bitfield assignment
...
test case:
#include <stdio.h>
int main(int argc, char **argv)
{
struct _s { unsigned a:9, b:5, c:7; } _s, *s = &_s;
int n = 250;
s->a = s->b = s->c = n + 4;
printf("--> %d / %d / %d\n", s->a, s->b, s->c);
return 0;
}
before:
--> 254 / 30 / 126
now:
--> 30 / 30 / 126
2014-09-23 12:30:08 +02:00
Matteo Cypriani
87d879aa7b
Accept CPPFLAGS from the environment
...
Don't override CPPFLAGS so that it can be passed through the
environment.
(This is a patch Thomas Preud'homme wrote for Debian in February 2013.)
2014-09-07 12:07:04 -04:00
Matteo Cypriani
63376d7712
tccelf: layout_sections: add missing param strsec
...
This fixes compilation on (k)FreeBSD.
2014-09-07 12:04:53 -04:00
Matteo Cypriani
b84cdf6214
Clear CFLAGS & LDFLAGS in tests
...
Clear CFLAGS and LDFLAGS to build the tests, in case the main Makefile
passes some flags that aren't handled by tcc (we are not compiling tcc
here, we are using tcc to compile the tests).
2014-09-07 11:15:31 -04:00
Matteo Cypriani
178275dc0c
Don't build libtcc1 with -fstack-protector-strong
...
Prevent libtcc1.a to be compiled with -fstack-protector-strong, so that
linking with tcc doesn't fail because symbol '__stack_chk_fail_local' is
not present in libtcc1.a. This is useful only if the CFLAGS passed from
the main Makefile contain this flag.
2014-09-07 10:56:03 -04:00
grischka
14745bdeb7
tccgen: nocode_wanted: do not output constants
...
This for example suppresses string constants such as with
int main()
{
return sizeof "foo";
}
Actually, setting
nocode_wanted = 1;
in libtcc.c for the initial global level seemed wrong, since
obviously "nocode_wanted" means code as any side effects, also
such as string constants.
This reverts a part of 2de1b2d14c
(documented as "Some in-between fixes" in Changelog)
2014-08-01 10:59:38 +02:00
grischka
12f43953ed
win64: fix resource file support
2014-08-01 10:51:28 +02:00
Carlos Montiers
73a7dd79af
Removed the error message and minor changes.
2014-07-17 01:08:47 -04:00
Carlos Montiers
7c474b4da3
__getmainargs return int, not void, and on error, it return -1 and let argv untouched, also argc. Added a if checking the result of it.
2014-07-16 22:22:05 -04:00
Carlos Montiers
f2ee6b1759
Fix mistake. Change jb by jbe. tiny c round (INT_MAX = 0x7FFFFFFF) to a DWORD boundary and it becomes 0x80000000. Jle treats as -214783648, but Jbe treats as 214783648. Thanks to Jason Hood for explain me this.
2014-07-10 20:41:51 -04:00
Carlos Montiers
8257829623
Fix problem using alloca function, executable crashed even with a exception handler function, when try to allocate INT_MAX. Patch provided by Jason Hood in private e-mail, when I ask to him for help. He say: Feel free to pass it on to the mailing list.
2014-07-10 00:37:20 -04:00
jiang
89000c18dc
Rename:
...
68_macro_concat.c -> 68_macro_param_list_err_1.c
69_macro_concat.c -> 69_macro_param_list_err_2.c
and Remove spaces
2014-07-01 23:54:49 +08:00