Linux PowerPC 32-bit support

I have been working on patches for compiling Swift 5.6 for PPC32 with Buildroot. First I compiled the patched compiler (swift, llvm-project and swift-core-tools-support) and then use Buildroot with patched compiler to cross compile the Swift Stdlib. I have gotten to the point where I can successfully compile libdispatch, the Swift StdLib and runtime's .c, .cpp and .swift files for PPC32, but the demo executable crashes with qemu.

https://bugs.swift.org/browse/SR-15945

1 Like

I have a question about your standard library changes for PowerPC 32-bit, which were merged into the main branch a few weeks ago. There are files such as SmallString.swift and StringObject.swift which haven't been updated to include arch(powerpc). Is this an intentional omission?


The language needs better conditional compilation for pointer size. For example, in Swift 5.6:

// warning: unknown architecture for build configuration 'arch'
#if arch(i386) || arch(arm) || arch(powerpc)
//                                  ^

// note: did you mean 'powerpc64'?
#if arch(i386) || arch(arm) || arch(powerpc)
//                                  ^~~~~~~
//                                  powerpc64

(Also, the _endian(big) and _endian(little) conditions are still private.)

@benrimmington That PR is based on main and is missing some additional changes needed.

I'll open a new PR with those changes, and update for the String internals.

Note: I am not even able to run a Pure C hello world compiled with SwiftPM, so not sure why event that is crashing. I tried calling clang manually to build a main.c file specifying the triple, and that also crashes.

@benrimmington TBH, there is no immediate need to patch SmallString, that change is purely an optimization and there has been no testing done to suggest it improves performance on PPC32, although it's very likely it helps. My goal is to get a working compiler and runtime.

1 Like