PSA: godbolt/compiler-explorer updates

not sure in which category this belongs, but following precedent i'll put it here:

just an FYI if you're a 'godbolt' (aka, 'compiler-explorer') user regarding a couple recent changes:

  1. a release version of the 6.0 compiler is now available[1]
  2. a new 'dev snapshot' compiler has been added, which currently provides builds off the 6.1 development branch[2]

the 'dev snapshot' compiler should hopefully be updated shortly after new release branch builds become available on download.swift.org, though i've yet to verify that behavior works as anticipated. the config setting for such builds will presumably need to be manually updated to reference new release versions when new release branches are cut in the future. also, if anyone has naming suggestions for the pre-release compilers that may be more intuitive or appropriate, that seems like a potential area for improvement.


after reading this digression in a recent thread, it occurred to me that i did not really have any idea how compilers are added to godbolt, but if it's purely a community-driven effort, then i could give it a shot.

for posterity, the process currently involves two steps – updating the 'infra' repo, typically with the new version you want to expose in the site's UI, and then updating the main site's repository with the corresponding changes to consume the new compiler. both of these steps are pretty straightforward, as they essentially just involve editing some config files.

in case it is helpful to future motivated parties, here are reference PRs for each of those steps:


  1. version 6.0.3 specifically ↩︎

  2. this change was recently deployed, so you might have to reload open tabs to see it ↩︎

28 Likes

Thanks, we should use the Musl SDK to allow that site to support displaying Swift's AArch64 codegen too.

4 Likes

Thanks for doing this! I had added the compilers to
godbolt the past few times but didn’t get around to it for 6.0, so I’m delighted that somebody other than me a) did it, and b) learned how!

4 Likes

as the compiler-explorer site appears to have updated today, the changes[1] to add a new swift compiler configuration to display aarch64 assembly are now live. you can test it out by selecting a compiler from the 'swift (aarch64)' group in the dropdown menu (e.g. like this).

this new configuration works by invoking the corresponding x86 compiler with the additional arguments for cross compiling via the Musl SDK implicitly added to the swiftc invocation. currently, only the 6.0 release compiler supports this cross compilation mode, but once we figure this out, i think we should be able to get something analogous working for the development branches too.

as an aside – thanks to those of you who contributed ideas over the years in the associated feature request thread for how this might be implemented. in particular @Finagolfin, who, as far as i can tell, has helped many people better understand how cross compilation in Swift can be made to work. and of course, thanks to those involved in implementing the static linux SDK feature, without which this task would presumably have been much more involved.


  1. associated PRs here & here ↩︎

10 Likes