Skip to content

Releases: llvm-mos/llvm-mos-sdk

SDK v12.0.0

13 Feb 03:54
3729744
Compare
Choose a tag to compare

Breaking changes

  • llvm-mos/llvm-mos@9a4523b -- Make all types prefer int to short
    • This follows AVR, and it make int promotions work more like expected.
      • size_t is now unsigned int, was unsigned short
      • ptrdiff_t is now signed int, was signed short
      • intptr_t is now signed int, was signed short
      • char16_t is now unsigned int, was unsigned short
      • wint_t is now signed long, was unsigned long (now accomodates a -1
        WEOF)
  • 1475f49 -- Targets should now implement the default SIGABRT handler __sigabrt() instead of abort(). abort() now invokes raise() as required by the standard.
  • ea8aea8 - Break character conversion out of __putchar into __char_conv
    • __putchar now simply outputs to the target equivalent of file descriptor
      zero; it no longer converts to the target character set. Accordingly, __putchar now replaces __chrout on most targets; __chrout has been removed. Character conversion functionality has been moved to a new __char_conv.
  • 72e3379 -- Translate to shifted PETSCII at runtime; shift on startup if translation used.
    • This is likely to be a bit controversal; see the commit message for a detailed rationale. The jist is that the language of the standard essentially requires that outputting characters in our execution character set (ASCII) to the screen display their normal representation, as far as is possible. For the C64, that means shifting the character set. Accordingly, we do this in a constructor tied to the inclusion of __char_conv.
  • 597971d -- Translate to ATASCII control codes
  • Similar to the above, but probably less controversal. ASCII '\t', '\a', and '\b' are now translated at runtime to their ATASCII equivalents.
  • #300 - Normalize Atari cartridge target naming - @cwedgwood
    • atari5200-super is now atari5200-supercart (Super Cart cartridge)
    • atari8-stdcart is now atari8-cart-std (Standard cartridge)
    • atari8-xegs is now atari8-cart-xegs (XEGS catridge)
    • atari-mega is now atari8-cart-megacart (Megacart cartridge)

New features

  • llvm-mos/llvm-mos#442 - Lower fptoui.sat and fptosi.sat saturating float to integer intrinsics
    • Lowers them to fmax and fmin, which aren't yet implemented. Still, the compiler no longer crashes.
  • 8d67b8d -- Add a stub for getenv
  • 81161eb -- Add a stub for 'system'
  • 1475f49 -- Add a minimal <signal.h>
  • c0f1c7a -- Add qsort
  • 2f99463 -- Add bsearch
  • 543b5a9 -- Finish <string.h> (add strcspn and strstr).
  • #294 - Add all remaining RP6502 OS calls -- @rumbledethumps

Bug fixes

  • llvm-mos/llvm-mos@981c2b6 -- Correct handling of aliases to globals allocated to zero page
  • llvm-mos/llvm-mos#422 -- Replace CMPTerm then BR with a new family of CmpBr pseudo-instructions
    • This fixes a longstanding ugly fragility in the backend, but it required rewriting quite a few routines.
  • 90f616f -- Fix xregn varargs UB in RP6502 target
  • c49a529 -- Remove incorrectly coped .ifdef __ATARIXL__ from atari.inc
  • 3e94be4 -- Nonstandard strtox were prefixed with an underscore
  • 543b5a9 -- strrev in <string.h> has been renamed to _strrev to match Microsoft's current recommendations, and since it's not a standard function.
  • #296 -- Don't allow inline of Atari __putchar, since it uses RTS trick - @cwedgwood
  • #297 -- Use HATABS for Atari __putchar - @cwedgwood
  • #305 -- Add C++ extern "C" to <rp6502.h> - @rumbledethumps
  • #295 -- Remove va_start warning from RP6502 xregn - @rumbledethumps

SDK v11.0.0

29 Jan 18:29
621228d
Compare
Choose a tag to compare

Breaking changes

  • d231325 - Remove _exit
    • This function comes from POSIX, and it's properly part of <unistd.h>, which we don't have, not <stdlib.h>. Accordingly, it was suspect for us ever to have included it, especially since the standard has an equivalent in <stdlib.h>, _Exit. Accordingly, all uses of _exit in the SDK have been rewritten to use _Exit, and this should be the mechanism defined by new targets going forward.

New targets

New library features

  • #292 -- Implement aligned_alloc.
    • This is a version of malloc that supports a power of two alignment specification. This can be useful when sizes of allocated objects are naturally powers of two, since it allows stashing data in the low bits of pointers to the objects. Plus it's in the C standard ;)
  • ac77ee4 - Implement the quick_exit family
    • quick_exit allows exiting from the program without running C++ destructors, but while still doing other process-related cleanup. (Once we have a stdio, this will typically mean flushing and closing open files.) It also adds an at_quick_exit to allow registering callbacks to occur on quick exit (atexit handlers do not).

Optimizations

  • #292 - Rewrite malloc
    • This makes our implementation of malloc a standard Knuth boundary tag allocator that allocates in first fit FIFO order. This removes all O(n) operations that except the single first-fit freelist scan; accordingly, free is now constant time instead of O(n). It also removes all heap space overhead except the two byte header per malloc. The cost is a modestly increased code size and that heap objects are now two-byte aligned.

Bug fixes

  • #289 -- NES GTROM -- Declare write_ppu to return void -- @cwedgwood
  • e61baad - calloc now correctly detects integer overflow in its multiplication and returns NULL, rather than producing undefined behavior.

SDK v10.0.0

17 Jan 00:05
Compare
Choose a tag to compare

Breaking changes

  • llvm-mos/llvm-mos@2550bb7 - Make (u)int16_t (unsigned) int, not (unsigned) short.
    • This has a very fine distinction with little to no runtime effect, but it now follows AVR, and it makes the e.g. PRI16d format specifier just d rather than hd. Code is very unlikely to break, but it still seems possible.

New features

  • Implemented the all max-width functions in <inttypes.h> (except the wide character versions).
  • a1a8d22 - Implement the strtox family of instructions using PDCLib.
  • 546bf8b - Define MB_CUR_MAX from <stdlib.h> in line with other clang targets.
  • eaf7bd5 - Implement atox family of functions using PDCLib.
  • 08494f6 - Implement rand and srand using a 16-bit xorshift.
    • The implementation is a tradeoff; it's relatively small and fast, and its statistical properties are good for each bit of the output, but it has a short period of 65536. The standard puts no requirements on period, and this is the smallest PRNG I could find with good quality output within its period. We could use a 16-bit add-only LCG, which may be smaller but has worse behavior, or a 32-bit xorshift, which would provide a non-permutation in the low 16 bits returned by rand() and a POSIX compliant 2^32 period, but it would be considerably slower and larger.

Bug fixes

  • llvm-mos/llvm-mos@10e7734 - Define __STDC_HOSTED__ to 0; we're not yet a hosted implementation.
  • 2f0c6cd - Define __STDC_NO_COMPLEX__ to 1, since <complex.h> is unavailable.
  • 885708d - Define __STDC_NO_ATOMICS__ to 1, since atomics are not yet supported.

Miscellaneous

SDK v9.1.0

09 Jan 21:02
Compare
Choose a tag to compare

New targets

  • #272 - Atari 8-bit MegaCart and SIC! cartridges (atari8-mega) - @cwedgwood
  • #279 - Atari 5200 "Super Cart" target (also supports single 32KiB bank) (atari5200-super) - @cwedgwood

New features

Optimizations

  • llvm-mos/llvm-mos@3d56785 - Internalize libcalls and run dead code elimination
    • This detects ultimately unused functions that were brought into the link in case late code generation needed them. This allows them to be stripped out before they consume valuable static stack or zero page space.
    • As a result, abort and the floating point libcalls were moved into LTO with the others, allowing them to use the zero page and static stack.

Bug fixes

  • llvm-mos/llvm-mos#385 - Added error messages for overlapping inline asm clobbers and input registers
  • d0e7823 - Fixed SDK constraint issues uncovered by above
  • #277 - Allowed NES GTROM to correctly emit PRG-ROMs smaller than the maximum - @cwedgwood
  • cd715b3 - Added missing return value to strcat
  • b071f2e - Preserve NUL characters to repair video character set user-defined C++ literals
  • #287 - Remove duplicate entries from VIC20 charset switches - @cwedgwood

Miscellaneous

SDK v9.0.1

19 Dec 18:58
Compare
Choose a tag to compare

Bug fixes

  • #269 - Fixed an off-by-one error in the MMC3 8k banking linker script
    • This produced invalid ROMs if PRG-ROM was set to less than the maximum size.

Optimizations

  • llvm-mos/llvm-mos#426 - Made compiler default to -ffunction-sections and -fdata-sections when LTO is disabled so that linker garbage collection can work while the libcalls are out of LTO.

Miscellaneous

SDK v9.0.0

11 Dec 19:38
Compare
Choose a tag to compare

Breaking changes

Optimizations

  • #259 - Move atexit to cxa-atexit.cc
    • This prevents references to stdlib.cc functions (e.g., calloc) from bringing in the atexit runtime support unnecessarily.

Bug fixes

  • Prevent NES GTROM mapper from using CHR-ROM
    • The original implementation of this mapper always had 16KiB of CHR-RAM, and its mapper, 111, is shared with another Chinese fan translation project. Newer Mesen detect the fan translation by the presence of CHR-ROM, so it's not the case that CHR-ROM GTROM will work across widely-used emulators.

Miscellaneous

SDK v8.1.0

04 Dec 19:04
Compare
Choose a tag to compare

New targets

  • #250 - Atari 8-bit XEGS (bank-switched) cartridge support - @cwedgwood

New features

  • llvm-mos/llvm-mos#10 - Floating Point Support
    • llvm-mos now supports the float and double data types, with binary32 and binary64 IEEE 754 implementations, respectively. The soft float library comes from LLVM's compiler-rt, and it isn't very well optimized for the 6502. Printf support may be manually included by passing -lprintf_flt. Unfortunatly, at present, printf must operate over doubles, and the simulator is the only target large enough to support a full printf implementation. Work is underway to make this smaller.
    • All relevant llvm-test-suite end-to-end floating-point tests pass.

Optimizations

  • llvm-mos/llvm-mos#419 - Strict inlining costs
    • The inliner no longer forces inlining to occur when an indirect call can be elided. This happened with printf, which could cause up to a complete printf implementations to be duplicated up to four times.

Bug fixes

  • Ignore empty records in ABI: Empty unions could cause the compiler to crash.

Known issues

  • The floating point libcalls are huge; this suggests they should be kept out of LTO, since ultimately unused libcalls present in LTO can still end up permanently bringing things in. Unfortunately, libcalls must be either fully included in LTO or fully excluded, since they are implicitly treated as __attribute__((leaf)). I opted for the latter, which means that this release regresses performance of large libcalls, since they can no longer use the zero page or static stacks. Work is underway to provide better stripping for unused libcalls, which will allow us to summarily pull in all libcalls to LTO in a future release.

Misc

SDK v8.0.1

28 Nov 00:59
cd3055e
Compare
Choose a tag to compare

Bug fixes

  • llvm-mos/llvm-mos#413 - Fixed compiler crash due to new shift chaining optimization.
  • Fixed latent issue in register scavenger; it would attempt to scavenge X, but this isn't implemented. Instead, disable ZP, Y addressing to avoid the case.
  • Fixed recursive codegen issue uncovered in the register scavenger; since it can run more than once, we need to check if the reserved imaginary save registers are in use before marking a register for scavenging.
  • #247 - Fix pce_joypad_read() only returning low nibble - @asiekierka

Optimizations

  • #248 - Base printf routines on one another. Helps decrease code size when multiple printf variants are used.

Miscellaneous

SDK v8.0.0

18 Nov 20:57
7d4df2b
Compare
Choose a tag to compare

Breaking changes

  • #242 - Rename cx16 kernal call SAVEHL to BSAVE -- @XarkLabs
    • This call was not documented previously, and internal vector was called savehl (save headerless). Now it is documented as BSAVE so this PR renames kernel vector and function to match documentation.

New features

  • #244 - Add missing cbm_k_chkout KERNAL routine.

Optimizations

  • llvm-mos/llvm-mos#408 - Optimize multiplies and chain shifts
    • Multiplies by constants are now relaxed into a add or subtract of two shifts, wherever possible.
    • Shifts of the same base by different constant amounts in the same direction are now chained off of each other, with lesser amounts occuring "on the way" to greater amount. Code is moved globally within a function to form the chains.
    • This also fixes llvm-mos/llvm-mos#268, where a manual add of shifts would be normalized into a multiply, but lacking this backend transform, the multiply would stay all the way to final output.

Bug fixes

  • llvm-mos/llvm-mos#381 - Support relative and absolute paths in -fpost-link-tool.
  • llvm-mos/llvm-mos#403 - Don't report function sizes for Mesen label files
    • Providing function symbol sizes corrupts the disassembly in Mesen's debugger
  • #239 - Various Atari 2600 fixes -- @sehugg
    • Fixed zp section overlapping registers.
    • Fixed bank selection macros to accept macro parameters.
    • Better Stella signature.
  • Make cbm.h header work when included from C++.

SDK v7.1.0

12 Nov 21:40
d9b3373
Compare
Choose a tag to compare

New targets

  • #237 - Atari 2600 support (4K and 3E mappers) with VCSLib port - @sehugg

Bug fixes

  • llvm-mos/llvm-mos#354 - Added error messages for out-of-range relocations
    • For compatibility with existing practice, the high two bytes of the 32-bit virtual addresses are ignored for 8-bit and 16-bit addresses.