| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
Use this fact in some foldings of comparisons. See testcase.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The return value of statement expressions might refer to local
symbols, so those can't be popped. The old error message always
was just a band-aid, and since disabling it for pointer types it
wasn't effective anyway. It also never considered that also the
vtop->sym member might have referred to such symbols (see the
testcase with the local static, that used to segfault).
For fixing this (can be seen better with valgrind and SYM_DEBUG)
simply leave local symbols of stmt exprs on the stack.
|
| |
|
|
|
|
| |
The include directive needs to be parsed as pp-tokens, not
as token (i.e. no conversion to TOK_STR or TOK_NUM). Also fix
parsing computed includes using quoted strings.
|
| |
|
|
|
|
| |
Register operands of type _Bool weren't correctly getting
the 8-bit sized registers (but rather used the default 32-bit
ones).
|
| | |
|
| |
|
|
|
|
| |
GCC allows register loads for asms based on type mode,
and correctly sized structs/union have an allowed mode
(basically 1,2,4,8 sized aggregates).
|
| |
|
|
|
| |
It's now possible to use symbols defined in C code to be used
from later inline asm blocks. See testcase.
|
| |
|
|
|
|
|
|
|
|
| |
That, as well as "sym = expr", if expr contains symbols.
Slightly tricky because a definition from .set is overridable,
whereas proper definitions aren't.
This doesn't yet allow using this for override tricks from C
and global asm blocks because the symbol tables from C and asm
are separate.
|
| |
|
|
|
|
|
| |
But like GCC do warn about changes in signedness. The latter
leads to some changes in gen_assign_cast to not also warn about
unsigned* = int*
(where GCC warns, but only with extra warnings).
|
| | |
|
| |
|
|
|
| |
str accepts rm16/r32/r64, and push/pop defaults to 64 when given
memory operands (to 32 on i386).
|
| | |
|
| |
|
|
| |
Implement missing support for range init for local variables.
|
| |
|
|
|
|
|
| |
This requires correctly handling the REX prefix.
As bonus we now also support the four 8bit registers
spl,bpl,sil,dil, which are decoded as ah,ch,dh,bh in non-long-mode
(and require a REX prefix as well).
|
| | |
|
| |
|
|
| |
See testcase.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
For
union U { struct {int a,b}; int c; };
union U u = {{ 1, 2, }};
The unnamed first member of union U needs to actually exist in the
structure so initializer parsing isn't confused about the double braces.
That means also the a and b members must be part of _that_, not of
union U directly. Which in turn means we need to do a bit more work
for field lookup.
See the testcase extension for more things that need to work.
|
| |
|
|
|
| |
Some parameters aren't actually necessary. Also join the
two parsing loops for the initializer list of arrays and structs.
|
| |
|
|
|
|
|
| |
Remove dead code and variables. Properly check for unions when
skipping fields in initializers. Make tests2/*.expect depend
on the .c files so they are automatically rebuilt when the latter
change.
|
| |
|
|
|
|
| |
E.g. "struct { struct S s; int a;} = { others, 42 };"
if 'others' is also a 'struct S'. Also when the value is a
compound literal. See added testcases.
|
| |
|
|
|
|
| |
Start reimplementing the whole initializer handling to be
conforming to ISO C. This patch just reimplements current
functionality to prepare for further changes, all tests pass.
|
| |
|
|
| |
"int * __attribute__((something)) *" is supported by GCC.
|
| |
|
|
|
|
|
|
| |
This snippet is valid:
void foo(void);
... foo + 42 ...
the function designator is converted to pointer to function
implicitely. gen_op didn't do that and bailed out.
|
| |
|
|
|
|
|
|
|
|
|
| |
This must compile:
typedef int arrtype1[];
arrtype1 sinit19 = {1};
arrtype1 sinit20 = {2,3};
and generate two arrays of one resp. two elements. Before the fix
the determined size of the first array was encoded in the type
directly, so sinit20 couldn't be parsed anymore (because arrtype1
was thought to be only one element long).
|
| |
|
|
|
| |
Like __FILE__ but always refers to the command line file name also
from inside headers.
|
| |
|
|
| |
Follows GCC implementation.
|
| | |
|
| |
|
|
|
|
|
| |
lar can accept multiple sizes as well (wlx), like lsl. When using
autosize it's important to look at the destination operand first;
when it's a register that one determines the size, not the input
operand.
|
| |
|
|
|
| |
When the .size directive was closed with a ';' tcc eat everything after
it up to lineend.
|
| |
|
|
|
| |
Some new opcodes and some aliases: ljmp[wl], prefetch{nta,t0,t1,t2},
bswap[lq], sysretq, swapgs.
|
| |
|
|
|
| |
GAS has alias lgdtq for lgdt (similar for saves and GDT). It doesn't
have the same for LDT.
|
| |
|
|
|
| |
This is like 'r' but only accepts the eight legacy regs. Currently
that's the same as 'r' because we don't support the high ones.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
Given this code:
struct __attribute__((...)) Name {...};
TCC was eating "Name", hence generating an anonymous struct.
It also didn't apply any packed attributes to the parsed
members. Both fixed. The testcase also contains a case
that isn't yet handled by TCC (under a BROKEN #define).
|
| | |
|
| |
|
|
|
| |
This is meant to be a (sign-extended) 32bit constant (possibly
symbolic). We don't do any checks and simply regard it as "i".
|
| |
|
|
|
| |
This really should be handled implicitly in the preprocessor,
but for now this is enough.
|
| |
|
|
|
|
| |
A 'P' template modifier should avoid adding a '$' to literal
arguments. Also accept the numbered r8+ registers in an inline
asm clobber list (ignoring them for now).
|
| |
|
|
| |
Those should use long or long long type, and generate a 64bit reloc.
|
| |
|
|
| |
Implement some more opcodes, syscall, sysret, lfence, mfence, sfence.
|
| |
|
|
|
| |
I.e. implement < > <= >= == !=. Comparisons are signed and result
is -1 if true, 0 if false.
|
| |
|
|
|
| |
The x86-64 target has 64bit relocs, and hence can accept
generic expressions for '.quad'.
|
| |
|
|
|
| |
'p' is conservatively the same as 'r' and 'P' as template
modifier can be ignored in TCC.
|
| | |
|
| |
|
|
|
|
| |
In particular subtracting a defined symbol from current section
makes the value PC relative, and .org accepts symbolic expressions
as well, if the symbol is from the current section.
|
| | |
|
| |
|
|
|
|
|
| |
struct S { /*nothing*/; int a; };
is an acceptable struct declaration, there may be stray semicolons
in the member list.
|
| |
|
|
| |
In inline extended asm '%q1' refers to the 64bit register of operand 1.
|
| |
|
|
|
| |
attribute(section("one" "two")) should be accepted (the section
name being "onetwo"), it's normal string concatenation.
|
| |
|
|
|
|
|
| |
These are preprocessor cmdline arguments, but even in GCC they
aren't specified but rather left as being subject to changes.
Nobody should use them, but let's to a half-assed attempt
at accepting them.
|