| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
Some more subtle issues with code suppression:
- outputting asms but not their operand setup is broken
- but global asms must always be output
- statement expressions are transparent to code suppression
- vtop can't be transformed from VT_CMP/VT_JMP when nocode_wanted
Also remove .exe files from tests2 if they don't fail.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Restore ebx from *ebp because alloca might change esp.
Also disable USE_EBX for upcoming release.
Actually the benefit is less than one would expect, it
appears that tcc can't do much with more than 3 registers
except with extensive use of long longs where the disassembly
looks much prettier (and shorter also).
Also: tccgen/expr_cond() : fix wrong gv/save_regs order
|
| |
|
|
|
|
|
|
|
|
|
| |
handle mms-bitfields as sub-options of -m. (-mfloat-abi
is still special because it requires arguments)
tcc.c: help():
- list -mms-bitfields under 'Target specific options'
libtcc.c/MEM_DEBUG
- add check for past buffer writes
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Also ...
tcctest.c:
- exclude stuff that gcc doesn't compile on windows.
libtcc.c/tccpp.c:
- use unsigned for memory sizes to avoid printf format warnings
- use "file:line: message" to make IDE error parsers happy.
tccgen.c: fix typo
|
| |
|
|
|
| |
uses 'nocode_wanted' as a level couter instead of
'saved_nocode_wanted' everywhere.
|
| |
|
|
|
| |
making shure that both the active and the passive branches
do exacly the same thing.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tccgen.c: remove any 'nocode_wanted' checks, except in
- greloca(), disables output elf symbols and relocs
- get_reg(), will return just the first suitable reg)
- save_regs(), will do nothing
Some minor adjustments were made where nocode_wanted is set.
xxx-gen.c: disable code output directly where it happens
in functions:
- g(), output disabled
- gjmp(), will do nothing
- gtst(), dto.
|
| |
|
|
|
| |
See testcase. Function pointer use was hosed when the destination
function wasn't also called normally by the program.
|
| |
|
|
|
|
|
|
|
| |
on 32bit long long support was sometimes broken. This fixes
code-gen for long long values in switches, disables a x86-64 specific
testcase and avoid an undefined shift amount. It comments out
a bitfield test involving long long bitfields > 32 bit; with GCC layout
they can straddle multiple words and code generation isn't prepared
for this.
|
| |
|
|
| |
This got lost when splitting reloc handling to individual files.
|
| |
|
|
| |
VT_PTR needs to be handled like VT_LLONG.
|
| |
|
|
| |
82_nocode_wanted.c:kb_wait_2_1 was miscompiled on arm64.
|
| |
|
|
|
|
| |
when an alignment is explicitely given on the member itself,
or on its types attributes then respect it always. Was only
allowed to increase before, but GCC is allowing it.
|
| |
|
|
|
|
|
|
| |
The linux kernel has some structures that are page aligned,
i.e. 4096. Instead of enlarging the bit fields to specify this,
use the fact that alignment is always power of two, and store only
the log2 minus 1 of it. The 5 bits are enough to specify an alignment
of 1 << 30.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Another corner case:
struct foo6_1
{
char x;
short p:8;
short :0;
short :0;
short p2:8;
char y;
};
In MS layout the second anon :0 bit-field does _not_ adjust size or
alignment of the struct again. The first one does, though.
|
| |
|
|
|
| |
Fixes some corner cases in PCC layout. Testcases coming
up.
|
| |
|
|
|
|
|
|
| |
Bit-fields are layed out differently in visual C, this implements
a compatible mode. Checked against Visual C/C++ 2016.
Unfortunately the GCC implementation of MS layout (behind
-mms-bitfields) actually is different, and hence not compatible
with MS in all cases :-/
|
| |
|
|
|
|
| |
Anonymous sub-sub-members weren't handled correctly. Bit-fields
neither: this implements PCC layout for now. It temporarily disables
MS-compatible bit-field layout.
|
| |
|
|
|
|
|
|
|
|
|
| |
Such struct decl:
struct S { char a; int i;} __attribute__((packed));
should be accepted and cause S to be five bytes long (i.e.
the packed attribute should matter). So we can't layout
the members during parsing already. Split off the offset
and alignment calculation for this.
|
| |
|
|
| |
We need to access cur_text_section, not text_section.
|
| |
|
|
|
|
|
| |
See testcases. We now support 64bit case constants. At the same time
also 64bit enum constants on L64 platforms (otherwise the Sym struct
isn't large enough for now). The testcase also checks for various
cases where sign/zero extension was confused.
|
| |
|
|
|
|
|
|
|
| |
See testcase. We must always paste tokens (at least if not
currently substing a normal argument, which is a speed optimization
only now) but at the same time must not regard a ## token
coming from argument expansion as the token-paste operator, nor
if we constructed a ## token due to pasting itself (that was already
checked by pp/01.c).
|
| |
|
|
|
|
|
|
|
|
|
| |
libtcc1 is the compiler support library and therefore needs
to function in a freestanding environment. In particular
it can't just use fprintf or stderr, which it was on x86-64
(but only when compiled by GCC). The tight integration between
libtcc1 and tcc itself makes it impossible to ever reach that
case so the abort() there is enough. abort() is strictly speaking
also not available in a freestanding environment, but it often is
nevertheless.
|
| |
|
|
|
|
|
|
| |
In certain very specific situations (involving switches
with asms inside dead statement expressions) we could generate
invalid code (clobbering the buffer so much that we generated
invalid instructions). Don't emit the decision table if the
switch itself is dead.
|
| |
|
|
| |
the last one wins, i.e. "-O2 -O0" does _not_ set __OPTIMIZ__.
|
| |
|
|
| |
so that e.g. make CPPFLAGS=-DSOMETHING works.
|
| |
|
|
|
|
| |
If a symbolic reference is offsetted by a constant > 32bit
the backends can't deal with that, so don't construct such
values.
|
| |
|
|
|
|
|
| |
The callee saved registers (among them r12-r15) really need
saving/restoring if mentioned in asm clobbers, even if TCC
itself doesn't use them. E.g. the linux kernel relies on that
in its switch_to() implementation.
|
| |
|
|
|
|
|
| |
When intializing members where the initializer needs relocations
and the member is initialized multiple times we can't allow
that to lead to multiple relocations to the same place. The last
one must win.
|
| |
|
|
|
|
|
|
|
| |
Similar to GCC a local asm register variable enforces the use of a
specified register in asm operands (and doesn't otherwise
matter). Works only if the variable is directly mentioned as
operand. For that we now generally store a backpointer from
an SValue to a Sym when the SValue was the result of unary()
parsing a symbol identifier.
|
| |
|
|
| |
See testcase.
|
| |
|
|
|
| |
A pointer is 64 bit as well, so it needs a full
register for register operands.
|
| |
|
|
|
| |
When copying the content of compound literals we must
include relocations as well.
|
| |
|
|
|
|
| |
If the destination is an indirect pointer access (which ends up
as VT_LLOCAL) the intermediate pointer must be loaded as VT_PTR,
not as whatever the pointed to type is.
|
| |
|
|
|
| |
This disables generation of any SSE instructions (in particular
in stdarg function prologues). Necessary for kernel compiles.
|
| |
|
|
|
|
|
|
| |
Some routines were using the wrong type (int) in passing addends,
truncating it. This matters when bit 31 isn't set and the high
32 bits are set: the truncation would make it unsigned where in
reality it's signed (happen e.g. on the x86-64 with it's load
address at top-2GB).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This target has _32 and _32S relocs (the latter being for signed
32 bit entities). All instruction displacements have to use
the 32S variants. Normal references like
.long s
normally would use the _32 variant. For normal executables this
doesn't matter. For shared libraries neither (which use PC-relative
relocs). But it matters for things like the kernel that are linked
to high addresses (signed ones). There the GNU linker would error
out on overflow for the _32 variant.
To keep life simple we simply switch from _32 to _32S altogether.
Strictly speaking it's still wrong, but in practice using _32 is
more often wrong than using _32S ;)
|
| |
|
|
|
| |
Inside dead code don't regard inline functions as being
referenced.
|
| |
|
|
|
| |
Our architectures don't need anything special for this
builtin, just pass through the argument.
|
| |
|
|
|
|
| |
We didn't handle constants in logical expressions when they weren't
the first operand. Some reordering in the loop structure is enough
to handle them.
|
| |
|
|
|
| |
As we can optimize dead code a bit already it's fitting
to disable code emission after break and goto.
|
| |
|
|
|
|
|
| |
If a condition is always zero/non-zero we can omit the
then or else code. This is complicated a bit by having to
deal with labels that might make such code reachable without
us yet knowing during parsing.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Not fully thought out. You can't jump inside stmt exprs,
but you can jump out of them. So there's a difference
between undefined but declared labels at the end of stmt
exprs and those defined inside. Additionally it should
also be checked if a label defined inside a stmt expr
was tentatively created as declared from outside.
I'm not prepared doing that right now, so simply revert.
This reverts commit 9160e4cab9147d77840cc44a285031fdb4640cf9.
|
| |
|
|
| |
Creating condition_3way for this.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
One can't jump into statement expressions from outside
them, like the following:
int i = ({ label: foo(); 42; });
goto label;
We reject this by making the labels simply not available
outside (GCC has a nicer error message about jumping into
a statement expression).
|
| |
|
|
|
|
|
| |
In statement expression we really mustn't emit backward jumps
under nocode_wanted (they will form infinte loops as no expressions
are evaluated). Do-while and explicit loop with gotos weren't
handled.
|
| |
|
|
| |
Use correct width ELF structure.
|
| |
|
|
|
| |
The sizes of VLAs need to be evaluated even inside sizeof,
i.e. when nocode_wanted is set.
|
| |
|
|
|
| |
was incorrectly treated as constant because the vpop removed
all traces of non-constness.
|