Rangi
0888600cb7
Avoid OOM allocation error from invalid too-high bank numbers
2026-08-22 18:31:26 -04:00
Rangi
8bc7de35f9
Prevent SECTION FRAGMENT combined sizes from overflowing their uint16_t size
2026-08-22 18:24:17 -04:00
Rangi
ed0a2d1075
Fix infinite loop when a symbol name in an invalid object file starts with an invalid UTF-8 byte like 0xC0
2026-08-22 18:06:32 -04:00
Rangi
ec5e6cbabb
Handle -Wtruncation for link-time jr values
...
Fixes #2028
2026-07-21 14:51:58 -04:00
Rangi
c691ec6607
Use std::optional<uint64_t> instead of long with a special -1 sentinel for seekSize
2026-07-21 14:31:05 -04:00
Rangi
9def9c9aa8
Fix an SDAS object error message to use the valid section name variable
2026-07-21 13:41:53 -04:00
Rangi
106ec399d5
Fix reading value of relocations symbol/section index from SDAS objects
2026-07-21 13:14:35 -04:00
Rangi
d9c0d37fd5
Explicitly allow JR offsets to wrap around in RGBLINK
...
This reverts commit f27a8132d9 .
2026-07-20 19:23:11 -04:00
Rangi
c0e2f8340b
Output negative values with correct with in .sym files
2026-07-20 00:09:06 -04:00
Rangi
8883251bf9
Avoid UB from FileStackNodeType(type) on an invalid type
2026-07-20 00:06:09 -04:00
Rangi
f27a8132d9
Avoid truncating too-large JR offset from an invalid object file
2026-07-20 00:02:39 -04:00
Rangi
8d2275dc48
Use rpnErrorAt wrapper to ensure setting isError on all RPN errors
...
Two possible RPN errors were missing `isError = true;`
2026-07-19 23:45:45 -04:00
Rangi
57c9bab3a5
Addresses are 16-bit in .map files, consistent with .sym files
2026-07-15 22:59:50 -04:00
Rangi
4ada3e85d8
Avoid overflow for very large ROMs (e.g. TPP1)
2026-07-15 22:57:25 -04:00
Rangi
ba4a7f2e6a
Explicitly assume what was verified earlier by readSection
2026-07-15 22:56:43 -04:00
Rangi
b0948566bb
Fail-safe treat 16-bit alignment as a fixed address even in RGBLINK
...
RGBASM does this itself, so should not output sections with 16-bit
alignment, but an invalid object file could otherwise cause
`getPlacement` to infinitely loop.
2026-07-15 22:46:57 -04:00
Rangi
b13b0c8eb8
Fix the same shifting UB for SDAS objects as for RGBDS ones
2026-07-14 11:13:30 -04:00
Rangi
7e2a3491a5
Encapsulate fseek+ftell idiom in seekSize
...
This allows a single check for the return value of `seekSize`
to verify all three `fseek`+`ftell`+`fseek` calls.
2026-07-14 01:32:18 -04:00
Rangi
19e60d9864
Fix large ds in linker script overflowing the PC
2026-07-14 00:42:42 -04:00
Rangi
5869e0dc60
Fix RGBLINK scrambling algorithm to work for SRAM
...
Since SRAM sections start from 0, we had been using a signed
`int8_t curScrambleSRAM` counter to allow 0 as a scrambled bank,
but this actually just placed all floating SRAM sections in bank 0.
2026-07-13 22:39:41 -04:00
Rangi
304cbb464f
Factor out verboseDo to encapsulate magenta output color
2026-07-13 18:05:55 -04:00
Rangi
f0419eb183
More guards against invalid object file patch data
2026-07-13 17:47:38 -04:00
Rangi
08354cf573
Explicitly encode assumption that an overlapping section exists
2026-07-13 17:47:38 -04:00
Rangi
417b5212d4
Fix OOM for too-small overlay files in 32K mode (rgblink -t)
2026-07-13 16:17:30 -04:00
Rangi
66312f55dd
Avoid unsigned overflow/truncation from bad offset values in invalid object files
2026-07-13 13:17:09 -04:00
Rangi
e9fa1e4e94
Avoid closing stdin/stdout/stderr standard streams
2026-07-13 13:02:46 -04:00
Rangi
0e1e5e80f6
Use correct PRIu32 format spec for uint32_t usedTotal
2026-07-10 17:01:43 -04:00
Rangi
b8011947a8
Correct assumption to avoid UB with 1 << 31
2026-07-09 21:36:34 -04:00
Rangi
30fd4514dc
Add fail-safe for invalid RPN commands in bad object files
2026-07-07 17:02:46 -04:00
Rangi
08e83601f5
Fix CRLF check in parsing SDAS objects
2026-07-07 17:02:46 -04:00
Rangi
e606f4e997
Fix condition for invalid bank range check ( #2016 )
2026-07-07 17:02:35 -04:00
Rangi
3883c2a2b8
Reuse scrambleLimit instead of its equivalent expression
2026-07-06 22:50:31 -04:00
Rangi
46a6966b70
Fix $8000_0000 % -1 to warn with -Wdiv like $8000_0000 / -1 does ( #2012 )
2026-07-06 15:08:44 -04:00
Rangi
be3fc61859
Fix included linker scripts with no newline at EOF ( #2011 )
2026-07-06 14:01:40 -04:00
Rangi
6e643406a2
Refactor warning diagnostic code to reduce repeated output logic
2026-07-04 23:02:16 -04:00
Rangi
de36a11be7
Prevent rgblink -Wno-* disabled warnings from printing a location trace anyway
...
Fixes #2005
2026-07-04 23:02:16 -04:00
Rangi
0996a2f5ed
Encapuslate UTF-8 decoder state in a struct
2026-07-03 19:35:23 -04:00
Rangi
fc7d9ad573
Handle more numeric literal syntax errors in linker scripts
2026-06-09 18:46:51 -04:00
Rangi
0b91bf654b
Rename BaseV to ValidBaseV
2026-06-09 17:55:38 -04:00
Rangi
6b2b6e6000
Fix off-by-one error with INCLUDEd linker script line numbers
2026-06-09 16:16:21 -04:00
Rangi42
f72a4d53e2
Add -Wlarge-constant to RGBLINK as it is for RGBASM
2026-06-09 16:16:21 -04:00
Rangi
673c62414f
Use std::string_view keys for UpperMap
...
This avoids constructing temporary `std::string` objects on lookup
2026-05-27 22:01:20 -04:00
Rangi
ed19806434
Don't hard-code std::string as the key type for InsertionOrderedMap
2026-05-25 14:21:18 -04:00
Rangi
dce14fd4b8
Use C++20 concepts to require constraints on template parameters ( #1977 )
2026-05-22 17:54:34 -04:00
Rangi
48fcd9a0ca
Use templates to reduce the redundant number-lexing functions ( #1963 )
2026-05-21 23:13:09 +02:00
Rangi42
ca23210f18
Refactor and rename some numeric literal lexing for asm and linkerscript consistency
2026-04-29 12:15:14 +02:00
Rangi42
12186fdccc
Keep more non-declaration initialization within the for loop clause
2026-04-19 22:01:56 +02:00
ISSOtm
6b994b1737
Fix some warnings raised by MSVC
2026-04-16 00:57:33 +02:00
Rangi
efd4373a56
Check for a SDAS "Def" or "Ref" line before reading a subsequent integer
...
Without checking `token[0]` through `token[2], `readInt` starting at
`&token[3]` could go out of bounds on a badly-formed SDAS .rel object file
2026-03-30 19:45:44 -04:00
Eldred Habert
7c1e1fe515
Reference the file that actually provides the linker script lexer
2026-01-27 12:54:06 +01:00