You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
intx[2] = {1, 1};
int*y=x;
// or more commonly...char*message="hi";
The compiler will complain unsupported label+addend.
chibicc writes
// Only the following expressions are allowed in an initializer://// 1. A constant such as a number or a string literal// 2. An address of another global variable with an optional addend//// It is obvious that we can embed (1) to an object file as static data.// (2) may not be obvious why that can result in static data, but// the linker supports an expression consisting of a label address// plus/minus an addend, so (2) is allowed.
But uxnasm doesn't really support (2) so I stubbed it out with this unsupported label+addend error message.
Instead what you'd need to do in uxnasm is put another label on the same data…
@x
@y
0001
0001
@message
@.L.data.0
68
69
Which hurts the single-pass-y-ness a little bit. And if we want to support the "addend" thing, something like
intx[5] = {1, 2, 3, 4, 5};
int*y=x+2;
would have to be
@x
0001
0002
@y
0003
0004
0005
which is even trickier.
The text was updated successfully, but these errors were encountered:
Instead what you'd need to do in uxnasm is put another label on the same data…
@x
@y
Hmm I don't think that's right, the value of y isn't the same as x but rather its value is the address of x. I think we can do this with the “raw absolute addressing rune”:
These aren't supported:
The compiler will complain
unsupported label+addend
.chibicc writes
But uxnasm doesn't really support (2) so I stubbed it out with this
unsupported label+addend
error message.Instead what you'd need to do in uxnasm is put another label on the same data…
Which hurts the single-pass-y-ness a little bit. And if we want to support the "addend" thing, something like
would have to be
which is even trickier.
The text was updated successfully, but these errors were encountered: