Commit Graph

236 Commits

Author SHA1 Message Date
ISSOtm 2f60e0a59e Use meaningful types for byte output functions 2020-02-10 03:36:51 +01:00
ISSOtm a4fe274c25 Unify all section declarations 2020-02-10 03:35:55 +01:00
ISSOtm 34597ce6a0 Mark some section functions as const 2020-02-10 03:34:58 +01:00
ISSOtm 4a2af807b2 Remove legacy forward declaration 2020-02-10 03:34:58 +01:00
ISSOtm d0ec35628f Split section management into its own file 2020-02-10 03:34:58 +01:00
ISSOtm bfdbd00092 Do some misc cleanup of output.c 2020-02-10 03:25:03 +01:00
ISSOtm 5014f55c48 Treat PC as a symbol as well 2020-02-10 02:51:48 +01:00
ISSOtm 1d78cd0f03 Axe the constexpr expression evaluator
This avoids redundancy between them (and also having to port fixes and features)
The error messages have been preserved through a string reporting mechanism
2020-02-10 02:51:48 +01:00
ISSOtm 9ce8a9f5f0 Add comments to RPN expr struct 2020-02-10 02:47:12 +01:00
ISSOtm cc59730c5b Cleanup the RPN evaluator somewhat
Make the bool field an actual bool
Rename `iReloc` to a more exact `isKnown` (as was already pointed out by some
comments)
Make the value of `BANK(symbol)` consistent when the argument is invalid
2020-02-10 02:47:12 +01:00
ISSOtm 0a04904b75 Refactor RPN binary expressions into a single func
This mirrors what the constexpr evaluator is doing, and removes a lot of code shared
between all of them
2020-02-10 02:47:12 +01:00
ISSOtm ea52e45335 Fix @
The symbol's evaluation by the assembler and linker was very inconsistent
2020-02-07 13:19:50 +01:00
ISSOtm 28473d314a Make implicit truncation a warning 2020-02-05 13:20:51 +01:00
ISSOtm f363541611 Introduce revision number field 2020-02-03 21:10:05 +01:00
ISSOtm fa1fba7fd9 Increase object version to RGB9 2020-02-03 21:07:46 +01:00
ISSOtm b1cd730db2 Add link-time RST instruction
This allows using a label as the argument to a `rst` instruction
Fixes rednex#448
2020-02-03 21:07:12 +01:00
ISSOtm fd32b2252f Define additional variable when doing make develop 2020-02-03 19:58:02 +01:00
ISSOtm 877e0e0b91 Get rid of BANK_COUNT_* symbols
They weren't used save for the definitions right below, so Occam's razor applies
2020-02-03 15:19:48 +01:00
ISSOtm da1d9f68c7 Remove and reorder bank counts
Why was this an enum in the first place, anyways?
2020-02-03 15:19:48 +01:00
ISSOtm 24f41ef897 Expose link def arrays to RGBASM 2020-02-03 15:19:48 +01:00
ISSOtm 09dff85d5b Merge common.h into linkdefs.h 2020-02-03 14:50:00 +01:00
Eldred Habert 20e5685c1a Merge pull request #424 from ISSOtm/better_deps
Improve dependency generation
2020-02-03 03:50:09 +01:00
Eldred Habert ac6232bc87 Merge pull request #473 from ISSOtm/shift_ub
Remove undefined behavior from shifts
2020-02-03 03:49:38 +01:00
ISSOtm ed72baca2a Make more symbol functions const
Can't hurt to specify those as they are now. Perhaps it'll enable slightly more
compiler optimizations, too?
2020-01-30 02:38:33 +01:00
ISSOtm 6d4b128611 Avoid unnecessary copies in symbol init 2020-01-30 02:15:43 +01:00
ISSOtm b11d121c48 Remove undefined behavior from shifts
`asl` and `asr` in `src/link/patch.c` courtesy of @pinobatch, and rearranged in RGBASM
evaluators.
2020-01-28 12:37:38 +01:00
ISSOtm 08ab34cf57 Fix a few checkpatch warnings in symbol.h 2020-01-26 18:26:57 +01:00
ISSOtm 12f2f654dd Add -MG
This option allows for automatic dependency detection and generation:
as soon as a missing file is found, it is output to the dep file, and
assembly immediately aborts. (No .o file is produced, even if `-o` was
speicified.) This doesn't cause an error, either; the point is that once
the file is added to the dep file, the Makefile is re-parsed, and this
time the file will be generated, so the dep list builds up automatically.
This mimicks GCC's option and behavior.
2020-01-26 15:33:36 +01:00
ISSOtm 1fb9f90f0f Add -MT option
Allows overriding the output file in dependencies, which also allows
outputting those without also outputting the object file.
This, again, mimicks GCC's option.
2020-01-26 15:32:45 +01:00
ISSOtm bfa8da78a6 Add -MP option
Adds a phony target to every included file, mimicking gcc's
2020-01-26 15:32:45 +01:00
ISSOtm ab9307ac61 Clean up symbol management
Stop using that bitfield for everything, including what can be determined otherwise
It also makes it easier to have a sane state, since some bits were (supposedly)
mutually exclusive
2020-01-24 02:51:48 +01:00
ISSOtm e3ef194b4f Remove local label error checking
This is actually not necessary, because RGBLINK would warn about missing labels.
Besides, through semi-esoteric ways, it is possible to define more labels in this scope,
and there's no reason to prevent that.
2020-01-24 02:51:48 +01:00
ISSOtm a7c0616cd8 Rename export type enum to that
This prevents a conflict in the next commit
2020-01-24 02:51:48 +01:00
ISSOtm 4fe44447a2 Add license headers where missing 2020-01-19 11:11:36 +01:00
Antonio Niño Díaz 6003be3fae Fix declaration of constexpr_BankSymbol() 2020-01-08 23:33:42 +00:00
Eldred Habert 676800476d Merge pull request #430 from ISSOtm/known_selfbank
Make `BANK(@)` and `BANK("section")` known to RGBASM
2020-01-08 18:56:28 +01:00
Eldred Habert 4dfa3157e5 Merge pull request #454 from ISSOtm/unlocked_windows
Fix mingw build
2020-01-08 13:14:13 +01:00
ISSOtm b49e025703 Allow BANK() in constexpr expressions 2019-12-07 23:43:02 +01:00
ISSOtm 74f43d4e09 Add a way to seek a SECTION by name without creating one 2019-12-07 22:15:07 +01:00
ISSOtm f710f21ad8 Reorder warnings alphabetically 2019-12-06 12:06:21 +01:00
ISSOtm b1d4be66e4 Remove deprecated "section charmap" feature 2019-12-04 01:56:06 +01:00
ISSOtm 2d7d9eef9f Fix some make checkcodebase errors
- Reorder checkpatch ignore flags alphabetically
- Fix checkpatch WARNINGs and CHECKs when they make sense
- Add more checkpatch ignores
2019-12-04 00:16:28 +01:00
ISSOtm d93ad2e650 Rename all functions imported from musl
This is to avoid conflicting with libraries, which occurred in the mingw builds
2019-11-23 23:08:44 +01:00
ISSOtm 191ee4ba1f Add support for toggleable warnings 2019-11-18 20:45:21 +01:00
ISSOtm faa7893761 Fix develop error in getopt_long_only
The error was due to casting `const` away for permuting argv
elements, which is necessary for a libc for compatibility with older
systems, but not for us.

Checkpatch will complain about the style not being followed, but this is not
our code, so it can be ignored.
2019-11-09 00:48:00 +01:00
ISSOtm 7233f568a7 Report overlapping sections whenever possible 2019-11-06 08:40:13 +01:00
Eldred Habert 197f1e9b7b Merge pull request #444 from ISSOtm/fix_develop
Fix errors in `make develop`
2019-11-06 08:34:37 +01:00
ISSOtm 0649e6d65f Add long options 2019-11-06 00:48:41 +01:00
ISSOtm 072c965ba5 Add musl's implementation of getopt_long_only
Both `getopt_long` and `getopt_long_only` are GNU-specific, so we'll be
copying musl's implementation for portability.
This was retrieved as of commit 90251cf73dfdd44e7a3f085d236e89a7dff1b00b.

musl is licensed as MIT, which is compatible (being identical...) to RGBDS'.
The file is being copied as-is, without a copyright notice or attribution,
but this is only to have a verbatim copy in the history. Those will be added
in the next commit.
2019-11-06 00:40:55 +01:00
Eldred Habert ff8e38fcc6 Merge pull request #441 from ISSOtm/linker_error_stack
Make linker output error stacks instead of their top level
2019-11-03 16:41:09 +01:00