| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
| |
Matches GCC behavior.
|
| |
|
|
|
| |
Explicit node for static symbol (addresses). Should not break with edge
cases like the previous ad-hoc approach. And some other bugfixes
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Allow short-circuiting of constant logical expressions where the
unevaluated operand is not a constant expression (`1 || 0/0`)
- Allow constant integer expressions that evaluate to zero to be used
as null pointer constants (GNU extension).
+ According to the standard, `int *x = 5*0;` should be rejected.
But compilers evaluate `5*0 -> 0` and allow it as if a null pointer
literal.
|
| |
|
|
|
|
| |
I think globsym & expr2reloc should be rewritten to be more robust to
this kind of thing. Accumulate offsets whilst recursing into the child
node that might contain a direct global symbol reference kind of thing.
|
| |
|
|
|
| |
- frontend: __builtin_bswapX intrinsics
- backend: ObswapX instructions
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
A silly one, declsbuf.p can be realloc'd in the call to putdecl, but in
this statement that pointer could be fetched before the call.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
Because envdecls (now declsbuf) can be resized and invalidate those
pointers. I missed this because the default initialization size of that
buffer (and the fact that it would mostly only manifest with
function-local expressions) made it not really come up in practice.
Silly
|
| |
|
|
|
| |
Also change xcon to have a flagset for symbols (whether it's a function,
locally defined; later: thread local, etc).
|
| | |
|
| |
|
|
| |
declaration
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
It was all over the place for temporary data structures used by
individual passes. Now there is an arena specifically for that, which is
nicer.
|
| |
|
|
|
|
| |
C (or at least clang and gcc) allows declaring `static int f(...);` and
defining it later as `int f(...) {...}`, omitting the 'static' in the
latter definition.
|
| | |
|
| |
|
|
|
| |
Keeping the expr around in the decllist paves the way for VLA support
later on
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Interned strings are used pervasively, so it's a good idea to add a
layer of type safety to differentiate them from general cstrs and avoid
potential bugs from comparing non-interned and interned strings. Not
that that's happened so far that I can remember, but it could.
I'm 90% sure it's legal to alias `struct {char c;}` pointers with `char`
pointers. This specific typedef gives type safety but with a simple
one-way `internstr -> const char *` typecast (with `&istr->c`).
Converting the other way around is more intentional: a straight up cast
`(internstr)cstr` which sticks out as unchecked and probably wrong, or
calling the intern(cstr) function, which is the right way.
|
| | |
|
| | |
|
| |
|
|
| |
This is a common non-standard GNU extension.
|
| | |
|
| | |
|
| |
|
|
|
| |
Treated as unsized array T[]. This shows up in some linux headers
as a non-standard way to have flexible array members.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
With 59ca5a8db, querying if a symbol is defined is cheap. If we're
compiling code that calls foo() and we defined foo() in this compilation
unit, we already know its offset within the .text section, so use it
instead of emitting a relocation for the linker to handle. Also, put
small literal data in the .text section instead of .rodata. This seems
to improve performance (cache locality?), and as a bonus, it will be
good for aarch64's instr encoding with smallish PC-relative offsets.
|
| |
|
|
|
| |
sqlite3 was falling back to `((void*)&((char*)0)[X])` for INT_TO_PTR,
which this handles now.
|
| | |
|
| |
|
|
|
|
|
|
| |
For `extern int x[1];`, can use PCREL32 for &x. But for `extern int
x(int)`, must use GOTREL, when not being called directly (that's PLT).
Therefore the type of an external symbol (actually just whether it
denotes a function) matters when deciding what kind of relocation to
emit, so keep that information.
|
| |
|
|
| |
For duplicate cases, case value overflow
|
| | |
|
| |
|
|
|
|
| |
Function parameters qualifiers don't matter outside of function
definition. `int (const int)` should be compatible with `int(int)` etc.
So no need to store them in the typedata.
|
| | |
|
| | |
|