If the next release is going to break compatibility with older object
file formats it doesn't make sense to keep this.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
If they don't have quotes when passed to sym_AddString() they can't be
used at all by the assembler. I suppose nobody actually used them, they
seem to have been broken forever.
Added a comment to the function to say how to use it correctly for
strings.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
IMPORT is simply useless, any symbol that isn't found in the current
file is automatically flagged as imported symbol.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
Files can now be included with the following syntax:
INCLUDE "path.link"
The maximum include depth is 5.
Fixed linkerscript parser and lexer error messages so that they are more
informative (show file and line of the error).
Man page updated.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
The error message shouldn't specify the name of the binary, that's
supposed to be known by the caller.
Update test reference outputs.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
It compares the results of the operators with the expected result if
doing the same thing manually.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
They work with the 16-bit registers BC, DE and HL, returning the
corresponding 8-bit register. HIGH() works with AF as well, returning A.
They also work with any kind of constant or symbol, generating a RPN
patch in the object file if the value is not defined at assembly time.
They work with macro arguments as well.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
A lot of warnings are being added (and more will come) so it makes sense
to be able to disable them in legacy source that generates warnings but
is otherwise correct.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
Remove support for RGB0 and RGB1-2 object files, reducing the amount of duplicate work that needs doing when maintaining the linker in the future.
A new error message has also been implemented if an unsupported object file version has been encounted, which informs the user that they should reassemble.
Replace spaces by tabs for consistency. The rest of the codebase uses
tabs, so the linkerscript parser has to change.
Removed trailing tabs in all codebase.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
getsymbank() is used for more things than just when the code explicitly
has a BANK() operator, which causes a lot of noise when building code
that has more than one object file and places variables on HRAM or OAM.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
When calculating the difference of addresses between two labels, for it
to be defined, either:
- Both of them must have their absolute address defined.
- They belong to the same section, so their relative addresses are
compatible.
This patch adds a check to make sure that any other case is detected so
that the programmer can correct the code.
This applies to rgbasm. The difference of labels can be used, for
example, as argument of DS. The linker can't resize sections, which
means that the final value must be defined when creating the object
file.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
Instead of converting from ROMX to ROM0 with -t and preventing the use
of WRAMX at all with -w, make each option prohibit the type of section
they affect.
This is a good idea because it can prevent a developer from making
mistakes when switching from using the options to not using them.
Generally, a change from using one single bank to multiple banks is
something that will take a lot of effort, and forgetting sections in
ROM0 or WRAM0 will only make the free space of those areas to be
reduced (and maybe prevent compilation), but it won't cause any problems
because of a forgotten bank swap in the code.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
Check all sections when testing BANK().
Add scripts to verify the tests and update the reference if needed.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
Improve error messages generated by `errx()`, `warnx()` and similar.
Set `progname` to a static string with the name of the program so that
the path of the binary isn't included in error messages.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
Instead of returning the internal representation of the linker, return
0 when using BANK() on a label in HRAM.
Also, generate a warning when calculating the bank of labels in OAM
and HRAM, as there is no valid reason for doing it, so it's likely a
programming mistake.
Signed-off-by: AntonioND <antonio_nd@outlook.com>