├── .github └── workflows │ ├── busterarmv6.yml.disable │ └── ubuntu1804armv7.yml.disable ├── .gitignore ├── .gitlab-ci.yml ├── Crashers ├── Package.swift ├── README.md └── Tests │ ├── LinuxMain.swift │ ├── buildSwiftOnARMTests │ ├── DispatchTests.swift │ ├── FoundationTests.swift │ └── ThirdPartyTests.swift │ ├── inputs │ └── testfile │ └── outputs │ └── .blank ├── README.md ├── build-ci.sh ├── build.sh ├── buildTest.sh ├── checkoutRelease.sh ├── clean.sh ├── clone.sh ├── distro-scripts ├── 16.04.sh └── stretch.sh ├── icu.diffs └── aarch32 │ └── libicudataswift.diff ├── llbuild.diffs └── aarch32 │ └── handle_id.diff ├── llvm-project.diffs └── aarch32 │ ├── a922364e5bb45a8db448121e4e57d00524bc98a3.diff │ └── disable_alignment_assert.diff ├── logo.svg ├── swift-corelibs-libdispatch.diffs ├── aarch32 │ └── benchmark.diff └── raspbian │ └── arm_clrex.diff ├── swift-tools-support-core.diffs └── raspbian │ ├── fd_set.diff │ └── tools_support_armv6.diff ├── swift.diffs ├── aarch32 │ ├── AddSwift.cmake.diff │ ├── AddSwiftStdlib.cmake.diff │ ├── AddSwiftUnittests.cmake.diff │ ├── CMakeLists.txt.diff │ ├── IRGenModule.cpp.diff │ ├── RefCount.h.diff │ └── build-presets.diff └── raspbian │ └── forcearmv6.diff ├── swiftpm.diffs └── aarch32 │ └── BuildPlan.swift.diff └── utils.sh /.github/workflows/busterarmv6.yml.disable: -------------------------------------------------------------------------------- 1 | on: [push] 2 | 3 | jobs: 4 | test_job: 5 | runs-on: ubuntu-18.04 6 | name: Run Crashers Test 7 | steps: 8 | - uses: actions/checkout@v1 9 | - name: Test on armv7 10 | uses: uraimo/run-on-arch-action@v1.0.5 11 | with: 12 | architecture: armv6 13 | distribution: buster 14 | run: | 15 | apt update 16 | apt install -y libatomic1 libbsd0 clang libicu-dev libcurl4-nss-dev 17 | apt install -y curl git 18 | curl -OkL https://github.com/uraimo/buildSwiftOnARM/releases/download/5.1.1/swift-5.1.1-armv6-RPi01234-RaspbianBuster.tgz 19 | tar xzf swift-5.1.1-armv6-RPi01234-RaspbianBuster.tgz 20 | cd Crashers 21 | ../usr/bin/swift test 22 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu1804armv7.yml.disable: -------------------------------------------------------------------------------- 1 | on: [push] 2 | 3 | jobs: 4 | test_job: 5 | runs-on: ubuntu-18.04 6 | name: Run Crashers Test 7 | steps: 8 | - uses: actions/checkout@v1 9 | - name: Test on armv7 10 | uses: uraimo/run-on-arch-action@v1.0.5 11 | with: 12 | architecture: armv7 13 | distribution: ubuntu18.04 14 | run: | 15 | apt update 16 | apt install -y libatomic1 libbsd0 clang libicu-dev libcurl4-nss-dev 17 | apt install -y curl git 18 | curl -OkL https://github.com/uraimo/buildSwiftOnARM/releases/download/5.1.1/swift-5.1.1-armv7-Ubuntu1804.tgz 19 | tar xzf swift-5.1.1-armv7-Ubuntu1804.tgz 20 | cd Crashers 21 | ../usr/bin/swift test 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### OSX ### 2 | *.DS_Store 3 | .AppleDouble 4 | 5 | # Swift Package Manager 6 | # 7 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 8 | # Packages/ 9 | .build/ 10 | Package.resolved 11 | 12 | # Crashers temprary files 13 | Tests/outputs/ 14 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - build 3 | 4 | build-debian: 5 | stage: build 6 | script: 7 | - ./clone.sh 8 | - ./checkoutRelease.sh 9 | - ./build-ci.sh 10 | tags: 11 | - armv7 12 | - debian9 13 | artifacts: 14 | paths: 15 | - swift-*.tgz 16 | 17 | build-ubuntu: 18 | stage: build 19 | script: 20 | - ./clone.sh 21 | - ./checkoutRelease.sh 22 | - ./build-ci.sh 23 | tags: 24 | - armv7 25 | - ubuntu1604 26 | artifacts: 27 | paths: 28 | - swift-*.tgz 29 | -------------------------------------------------------------------------------- /Crashers/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:4.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "BuildSwiftOnARM", 7 | dependencies: [ 8 | .package(url: "https://github.com/IBM-Swift/SwiftyJSON.git", from: "17.0.2") 9 | ], 10 | targets: [ 11 | .testTarget( 12 | name: "buildSwiftOnARMTests", 13 | dependencies: ["SwiftyJSON"] 14 | ) 15 | ] 16 | ) 17 | -------------------------------------------------------------------------------- /Crashers/README.md: -------------------------------------------------------------------------------- 1 | # buildSwiftOnARM Simple Test Suite 2 | 3 | To run the test suite: 4 | 5 | ``` 6 | swift test 7 | ``` 8 | 9 | -------------------------------------------------------------------------------- /Crashers/Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import buildSwiftOnARMTests 3 | 4 | XCTMain([ 5 | testCase(FoundationTests.allTests), 6 | testCase(DispatchTests.allTests), 7 | testCase(SwiftyJsonTests.allTests) 8 | ]) 9 | 10 | 11 | -------------------------------------------------------------------------------- /Crashers/Tests/buildSwiftOnARMTests/DispatchTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import Foundation 3 | import FoundationNetworking 4 | import Dispatch 5 | 6 | class DispatchTests: XCTestCase { 7 | 8 | func testDataTaskSemaphore(){ 9 | var urlRequest = URLRequest(url: URL(string:"https://httpbin.org/get")!) 10 | urlRequest.httpMethod = "GET" 11 | let config = URLSessionConfiguration.default 12 | let session = URLSession(configuration: config) 13 | 14 | let semaphore = DispatchSemaphore(value: 0) 15 | let task = session.dataTask(with: urlRequest, completionHandler: { (data, response, error) in 16 | let _ = String(data:data ?? "".data(using: String.Encoding.utf8)!, encoding:.utf8) 17 | semaphore.signal() 18 | }) 19 | task.resume() 20 | 21 | _ = semaphore.wait(timeout: .distantFuture) 22 | XCTAssertTrue(true) 23 | } 24 | 25 | func testDispatchTimeInterval(){ 26 | let now = DispatchTime.now() 27 | let nowplustwo = now + .nanoseconds(2) 28 | let nowut = now.uptimeNanoseconds 29 | 30 | XCTAssertEqual(nowplustwo.uptimeNanoseconds, nowut+2) 31 | XCTAssertNotEqual("DispatchTime(unknown: ())","\(nowplustwo)") 32 | 33 | XCTAssertEqual("nanoseconds(1)","\(DispatchTimeInterval.nanoseconds(1))") 34 | } 35 | 36 | static var allTests = [ 37 | ("testDataTaskSemaphore", testDataTaskSemaphore), 38 | ("testDispatchTimeInterval", testDispatchTimeInterval), 39 | ] 40 | 41 | } 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Crashers/Tests/buildSwiftOnARMTests/FoundationTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import Foundation 3 | 4 | class FoundationTests: XCTestCase { 5 | 6 | func testSuccess() { 7 | XCTAssertTrue(true) 8 | } 9 | 10 | func testContentsOfFile() { 11 | if let str = try? String(contentsOfFile: "Tests/inputs/testfile") { 12 | XCTAssertEqual(str.trimmingCharacters(in: .whitespacesAndNewlines), "content") 13 | } else { 14 | XCTFail("Unable to read string from input file") 15 | } 16 | } 17 | 18 | func testWriteToFile() { 19 | do { 20 | try "Some content".write(toFile:"Tests/outputs/testfile", atomically: false, encoding: .utf8) 21 | } catch { 22 | XCTFail("Unable to write string to file") 23 | } 24 | if let str = try? String(contentsOfFile: "Tests/outputs/testfile") { 25 | XCTAssertEqual(str.trimmingCharacters(in: .whitespacesAndNewlines), "Some content") 26 | } else { 27 | XCTFail("Unable to read string from output file") 28 | } 29 | } 30 | 31 | func testURL() { 32 | class MakeAURL { 33 | func makeURL() { 34 | _ = URL(string: "http://www.google.com") 35 | } 36 | } 37 | 38 | _ = URL(string: "http://www.google.com") 39 | 40 | let makeAURL = MakeAURL() 41 | makeAURL.makeURL() 42 | XCTAssertTrue(true) 43 | } 44 | 45 | func testContentsOfURL() { 46 | do { 47 | _ = try String(contentsOf: URL(string: "https://httpbin.org/get")!, encoding: .utf8) 48 | XCTAssertTrue(true) 49 | } catch { 50 | XCTAssertTrue(true) 51 | } 52 | } 53 | 54 | func testProcess() { 55 | let p = Process() 56 | p.launchPath = "/usr/bin/tail" 57 | p.arguments = ["-f", "/var/log/system.log"] 58 | p.launch() 59 | 60 | var elapsedSeconds = 10 61 | while p.isRunning && elapsedSeconds > 0 { 62 | print("Running") 63 | sleep(1) 64 | elapsedSeconds -= 1 65 | } 66 | 67 | XCTAssertTrue(true) 68 | } 69 | 70 | func testIfLinux() { 71 | #if os(Linux) 72 | XCTAssertTrue(true) 73 | #else 74 | XCTFail() 75 | #endif 76 | } 77 | 78 | static var allTests = [ 79 | ("testSuccess", testSuccess), 80 | ("testContentsOfFile", testContentsOfFile), 81 | ("testWriteToFile", testWriteToFile), 82 | ("testURL", testURL), 83 | ("testContentsOfURL", testContentsOfURL), 84 | ("testProcess", testProcess), 85 | ("testIfLinux", testIfLinux) 86 | ] 87 | } 88 | -------------------------------------------------------------------------------- /Crashers/Tests/buildSwiftOnARMTests/ThirdPartyTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import SwiftyJSON 3 | 4 | typealias JsonDict = [String: JSON] 5 | 6 | final class SwiftyJsonTests: XCTestCase { 7 | func testParsingDouble() { 8 | // This started having problems on Swift 4.2 9 | let jsonData: JsonDict = [ 10 | "works": 2.4, 11 | "shouldWork": 0.3 12 | ] 13 | 14 | let json = JSON(jsonData) 15 | XCTAssertEqual(json["works"].number?.doubleValue, 2.4) 16 | XCTAssertEqual(json["shouldWork"].number?.doubleValue, 0.3) 17 | } 18 | 19 | static var allTests = [ 20 | ("testParsingDouble", testParsingDouble), 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /Crashers/Tests/inputs/testfile: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /Crashers/Tests/outputs/.blank: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uraimo/buildSwiftOnARM/0413c80f7e5b2f26015d3dbf8109543c991fb683/Crashers/Tests/outputs/.blank -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | Scripts to clone, configure, patch and build Swift 5.4 on Linux ARM devices. 4 |

5 | 6 | 7 | 8 | For precompiled Swift 5.4 binaries see the *[Prebuilt binaries](#prebuilt-binaries)* section, if you want to build Swift on your own instead, check out the *[Building on ARM](#building-on-arm)* section and the step-by-step instructions. 9 | 10 | ### Summary 11 | 12 | - [Supported Architectures](#supported-architectures) 13 | - [Prebuilt binaries](#prebuilt-binaries) 14 | - [Usage](#usage) 15 | - [Dependencies](#dependencies) 16 | - [Building on ARM](#building-on-arm) 17 | - [Step by step instructions](#step-by-step-instructions) 18 | - [Setup your own build infrastructure](#setup-your-own-build-infrastructure) 19 | - [GitHub CI on ARM](#github-ci-on-arm) 20 | - [REPL Issues](#repl-issues) 21 | - [Acknowledgments](#acknowledgments) 22 | - [Previous Releases](#previous-releases) 23 | 24 | 25 | ## Supported Architectures 26 | 27 | * ✅ ARMv6 32bit: _Original RaspberryPi, Pi Zero, etc..._ 28 | * ✅ ARMv7/8 32bit: _All versions of RaspberryPi 2/3, OrangePi, ODroid, CHIP, etc..._ 29 | * ✅ aarch64: _RaspberryPis or other ARMv8 boards with a 64 bit OS, Pine64, etc..._ 30 | 31 | 32 | ## Prebuilt binaries 33 | 34 | | OS | Architecture | Boards | Download | 35 | | -- | ------------ | ------ | -------- | 36 | | Raspbian Buster | ARMv6 | All RaspberryPis: Classic, Zero, 2, 3, 4 | [5.4](https://github.com/uraimo/buildSwiftOnARM/releases/download/5.4/swift-5.4-armv6-RPi01234-RaspbianBuster.tgz) | 37 | | Raspbian Bullseye | ARMv6 | All RaspberryPis: Classic, Zero, 2, 3, 4 | [5.4]() | 38 | | Debian Buster | ARMv7 | Every ARMv7 board, RaspberryPis 2/3/4 included | [5.4]() | 39 | | Debian Bullseye | ARMv7 | Every ARMv7 board, RaspberryPis 2/3/4 included | [5.4]() | 40 | | Ubuntu 18.04 | ARMv7 | All versions of RaspberryPi 2/3/4, other ARMv7 boards | [5.4]() | 41 | | Ubuntu 20.04 | ARMv7 | All versions of RaspberryPi 2/3/4, other ARMv7 boards | [5.4]() | 42 | | Ubuntu 16.04/18.04 | aarch64 | All versions of RaspberryPi 3/4, other ARMv7 boards | 5.4.1: [swift-arm64](https://github.com/futurejones/swift-arm64/releases/tag/v5.4.1-RELEASE) | 43 | 44 | For binaries of older releases, check out the [releases page](https://github.com/uraimo/buildSwiftOnARM/releases). 45 | 46 | For alternative ways to install these Swift binaries on your ARM board, check out [Swift on Balena](https://github.com/wlisac/swift-on-balena/) by Will Lisac, Helge Heß's [dockSwiftOnARM](https://github.com/helje5/dockSwiftOnARM), both based on Docker, and the [Swift Deb Repository](https://swift-arm.com/install-swift/) maintained by Neil Jones. 47 | 48 | To quickly cross-compile your Swift applications for ARM on a Mac (a time saver) check out the [Swift Cross Compilation Toolchains](https://github.com/CSCIX65G/SwiftCrossCompilers) project built by Van Simmons. 49 | 50 | ## Usage 51 | 52 | When using the Swift Package Manager on one of these boards, that usually have limited memory/cpu, you'll need to use the new `-j` option to reduce the number of threads spawned by the tool and be able to compile. 53 | For example, when building an SPM project most of the times we'll limit the number of jobs to one: 54 | 55 | ``` 56 | pi@raspberrypi:> swift build -j 1 57 | ``` 58 | 59 | ### Dependencies 60 | 61 | In order to use the provided prebuilt binaries you'll need to install the following dependencies: 62 | 63 | **Raspbian Buster, Ubuntu 18.04 and newer** 64 | 65 | sudo apt install clang libicu-dev libcurl4-nss-dev curl 66 | 67 | Decompress the archive on the RaspberryPi, you'll find the Swift binaries in `usr/bin/` relative to where you decompressed the archive. 68 | 69 | tar -xzf 70 | 71 | Ensure that the path you decompressed to is in your `PATH` environment variable: `echo $PATH`. If it's not then add it to your path for your shell. 72 | 73 | PATH="$HOME/usr/bin:$PATH" 74 | 75 | To permanently add this to your `PATH` variable, you can add the following block of code to the end of your `~/.profile` file: 76 | 77 | if [ -d "$HOME/usr/bin" ] ; then 78 | PATH="$HOME/usr/bin:$PATH" 79 | fi 80 | 81 | Verify the swift version is setup: 82 | 83 | $ swift --version 84 | 85 | Swift version 5.4 (swift-5.4-RELEASE) 86 | Target: armv7-unknown-linux-gnueabihf 87 | 88 | 89 | 90 | ## Building on ARM 91 | 92 | For the latest updates on Swift on ARM, check out my blog [here](https://www.uraimo.com/category/raspberry/). 93 | 94 | Check out Helge Heß's project [dockSwiftOnARM](https://github.com/helje5/dockSwiftOnARM) to build Swift in a Docker container or to [build a cross-compiling toolchain](https://github.com/AlwaysRightInstitute/swift-mac2arm-x-compile-toolchain) that will allow you to build arm binaries directly from your Mac using a precompiled swiftc for ARM. 95 | 96 | The scripts that buildSwiftOnARM provides: 97 | 98 | - clone.sh - Install dependencies and clones the main Swift repository and all the related projects 99 | 100 | - checkoutRelease.sh - Resets all repos, updates them, checks out a specific tag (5.4 at the moment) and apply the patches. 101 | 102 | - build.sh - Builds Swift producing a tgz archive with the Swift distributions. 103 | 104 | - clean.sh - Cleans all build artifacts, only needed when you want to start again from scratch. 105 | 106 | 107 | 108 | ### Step by step instructions 109 | 110 | First of all, use a suitably sized sd-card, at least 32Gb in size, but I recommend to use an external USB drive to clone the project and build Swift. 111 | 112 | Configure a swap file of at least 2Gb, on Ubuntu: 113 | 114 | sudo fallocate -l 2G swapfile 115 | sudo chmod 600 swapfile 116 | sudo mkswap swapfile 117 | sudo swapon swapfile 118 | 119 | You'll need to manually enable the swap file with `swapon` *each time you reboot* the RaspberryPi (or the system will just run without swap). 120 | 121 | On Raspbian, since the swapfile is already configured, open `/etc/dphys-swapfile` and edit `CONF_SWAPSIZE` to increase the size: 122 | 123 | CONF_SWAPSIZE=2048 124 | 125 | Save the file and: 126 | 127 | sudo /etc/init.d/dphys-swapfile stop 128 | sudo /etc/init.d/dphys-swapfile start 129 | 130 | Now, call the included scripts as follows: 131 | 132 | 1. Launch `clone.sh` that will install the required dependencies (_git cmake ninja-build clang-3.8 python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev autoconf libtool systemtap-sdt-dev libcurl4-openssl-dev libz-dev_), fix clang links and clone apple/swift with all its dependecies. 133 | 134 | 2. Run `checkoutRelease.sh` that will select the current release (5.4) and apply the needed patches. 135 | 136 | 3. Once done, start the build with `build.sh`. 137 | 138 | 4. Once the build completes a few hours later, you'll have a `swift-5.4-armv7.tgz` archive containing the whole Swift compiler distribution. Once decompressed you'll find the Swift binaries under `usr/bin`. 139 | 140 | I recommend to perform all these operations in a permanent background `tmux` or `screen` session (`CTRL+B d` to detach from the session and `tmux a` to reattach to it when you ssh again into the RaspberryPi). 141 | 142 | Additional steps could be required in some cases [check the latest ARM posts on my blog for additional info](https://www.uraimo.com/category/raspberry/). 143 | 144 | To build a different release than the one currently configured in the script, open `checkoutRelease.sh` and `build.sh` and modify the variables on top, with the branch name for the release and the release name for the tgz respectively. 145 | 146 | ### Setup your own build infrastructure 147 | 148 | If you need to replicate a setup like the one I use to build all the Swift binaries you can find above, using only a single Raspberry Pi 4 or a similar board ARMv7 board as build machine, check out [buildSwiftOnARMInfra](https://github.com/uraimo/buildSwiftOnARMInfra) with its docker containers. 149 | 150 | ## GitHub CI on ARM 151 | 152 | ARM projects can be tested in an environment simulated through QEMU on GitHub using the [Run-On-Architecture](https://github.com/uraimo/run-on-arch-action) action. 153 | While you will not be able to use hardware interfaces available on real ARM boards, this environment should be more than enough to perform some basic testing or even build your projects and deploy them directly to your target ARM board (with considerable time savings). 154 | 155 | ## REPL Issues 156 | 157 | Since the first releases of Swift on ARM32, the REPL has never been available on this platform, but that doesn't impact the compiler itself. Considering this, as you would expect, launching `swift` without parameters will result in an error instead of the REPL prompt. 158 | 159 | ## Acknowledgments 160 | 161 | We wouldn't have Swift on ARM and most of the patches included on buildSwiftOnARM without the work done by these developers: 162 | 163 | * [@KittyMac](https://github.com/KittyMac) 164 | * [@buttaface](https://github.com/buttaface) 165 | * [@Kaiede](https://github.com/Kaiede) 166 | * [@chnmrc](https://github.com/chnmrc) 167 | * [@futurejones](https://github.com/futurejones) 168 | * [@jasonm128](https://github.com/jasonm128) 169 | * [@hpux735](https://twitter.com/hpux735) 170 | * [@iachievedit](https://twitter.com/iachievedit) 171 | 172 | The community can be reached at the [swift-arm](https://launchpass.com/swift-arm) Slack channel. 173 | 174 | ## Previous Releases 175 | 176 | You can compile old releases checking out the specific tag: 177 | 178 | * [Swift 5.1.5](https://github.com/uraimo/buildSwiftOnARM/tree/5.1.5) 179 | * [Swift 5.1.3](https://github.com/uraimo/buildSwiftOnARM/tree/5.1.3) 180 | * [Swift 5.1.2](https://github.com/uraimo/buildSwiftOnARM/tree/5.1.2) 181 | * [Swift 5.1.1](https://github.com/uraimo/buildSwiftOnARM/tree/5.1.1) 182 | * [Swift 5.1](https://github.com/uraimo/buildSwiftOnARM/tree/5.1) 183 | * [Swift 5.0.3](https://github.com/uraimo/buildSwiftOnARM/tree/5.0.3) 184 | * [Swift 5.0.2](https://github.com/uraimo/buildSwiftOnARM/tree/5.0.2) 185 | * [Swift 5.0.1](https://github.com/uraimo/buildSwiftOnARM/tree/5.0.1) 186 | * [Swift 5.0](https://github.com/uraimo/buildSwiftOnARM/tree/5.0) 187 | * [Swift 4.2.3](https://github.com/uraimo/buildSwiftOnARM/tree/4.2.3) 188 | * [Swift 4.2.2](https://github.com/uraimo/buildSwiftOnARM/tree/4.2.2) 189 | * [Swift 4.2.1](https://github.com/uraimo/buildSwiftOnARM/tree/4.2.1) 190 | * [Swift 4.1.3](https://github.com/uraimo/buildSwiftOnARM/tree/4.1.3) 191 | * [Swift 3.1.1](https://github.com/uraimo/buildSwiftOnARM/tree/3.1.1) 192 | * [Swift 3.1](https://github.com/uraimo/buildSwiftOnARM/tree/3.1) 193 | * [Swift 3.0.2](https://github.com/uraimo/buildSwiftOnARM/tree/3.0.2) 194 | 195 | -------------------------------------------------------------------------------- /build-ci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | . "$(dirname $0)/utils.sh" 3 | 4 | REL=5.4 5 | INSTALL_DIR=`pwd`/install 6 | PACKAGE=`pwd`/swift-${REL}_${ARCH}.tgz 7 | 8 | #rm -rf $INSTALL_DIR $PACKAGE 9 | 10 | ./swift/utils/build-script --preset=buildbot_linux,swiftlang-min install_destdir=$INSTALL_DIR installable_package=$PACKAGE 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | . "$(dirname $0)/utils.sh" 3 | 4 | REL=5.4 5 | INSTALL_DIR=`pwd`/install 6 | PACKAGE=`pwd`/swift-${REL}_${ARCH}.tgz 7 | 8 | #rm -rf $INSTALL_DIR $PACKAGE 9 | 10 | ./swift/utils/build-script --preset=buildbot_linux,swiftlang-min install_destdir=$INSTALL_DIR installable_package=$PACKAGE 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /buildTest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | . "$(dirname $0)/utils.sh" 3 | 4 | REL=5.4 5 | INSTALL_DIR=`pwd`/install 6 | PACKAGE=`pwd`/swift-${REL}_${ARCH}.tgz 7 | 8 | #rm -rf $INSTALL_DIR $PACKAGE 9 | 10 | ./swift/utils/build-script --test --preset=buildbot_linux,swiftlang-min install_destdir=$INSTALL_DIR installable_package=$PACKAGE 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /checkoutRelease.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | . "$(dirname $0)/utils.sh" 3 | 4 | SCHEME=release/5.4 5 | 6 | echo "♻️ Resetting the repositories..." 7 | find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "[ -d '{}'/.git ] && echo ■ Cleaning '{}' && cd '{}' && git reset --hard HEAD && git clean -fd" \; 8 | echo "✳️ Switching all the repositories to ${SCHEME}..." 9 | ./swift/utils/update-checkout --clone --scheme "$SCHEME" 10 | echo "✅ Applying the required cross-platform patches..." 11 | find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "[ -d '{}'.diffs ] && echo ■ Applying patches to '{}' && cd '{}' && for f in ../'{}'.diffs/*.diff; do [ -e \"\$f\" ] || continue; echo \"Apply \"\$f ; patch -p1 < \"\$f\"; done;" \; 12 | 13 | 14 | # Patches for a specific arch, arch family, OS, shared version(debian and raspbian can share patches) 15 | # and OS version go in their own subdirectory. 16 | # To sum up, under every project-specific *.diffs directory you'll be able to group you patches this way: 17 | # * $ARCHFAMILY/ : aarch32 for the generic arm32 patches and aarch64 for the 64bit-specific ones 18 | # * $ARCH/ : aarch64,armv6,armv7 specific patches, regardless of the OS 19 | # * $OS/ : Regardless of the architecture, patches for a specific OS 20 | # * $VERSION/ : Patches for a specific OS version, regardless of the actual OS name (Debian and Raspbian can both be "Stretch" and the same version of Ubuntu could be reporting a different name when asked) 21 | # * $OS$VERSION/ : Patches for a very specific version of a distribution 22 | # * $ARCH$OS$VERSION/ : Patches that apply only to an OS/Version on a specific architecture. 23 | # 24 | for VARIANT in $ARCH $ARCHFAMILY $OS $VERSION $OS$VERSION $ARCH$OS$VERSION 25 | do 26 | echo "✳️ Searching for required $VARIANT patches..." 27 | find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "[ -d '{}'.diffs/$VARIANT ] && echo ■ Applying patches to '{}' && cd '{}' && for f in ../'{}'.diffs/$VARIANT/*.diff; do echo \"Apply \"\$f ; patch -p1 < \$f; done;" \; 28 | done 29 | -------------------------------------------------------------------------------- /clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "⚠️ Cleaning build artifacts..." 4 | rm -rf build 5 | -------------------------------------------------------------------------------- /clone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | . "$(dirname $0)/utils.sh" 3 | 4 | # Distributions derived by Stretch need an older clang, use the default for the rest 5 | if [ $VERSION = "stretch" ] || [ $VERSION = "16.04" ]; then 6 | CLANG_VERSION=-3.8 7 | fi 8 | 9 | # Basic dependencies 10 | echo "✅ Installing dependencies..." 11 | sudo apt-get -q install -y git cmake ninja-build clang python python3 uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev systemtap-sdt-dev tzdata rsync python-six python3-dev python3-pip python3-tk python3-lxml python3-six 12 | 13 | # Some OS or specific versions could have additional requirements, if they do 14 | # a script will be present in distro-scripts and we'll run it right after the more generic configuration 15 | for VARIANT in $OS $VERSION $OS$VERSION 16 | do 17 | if [ -f ./distro-scripts/$VARIANT.sh ]; then 18 | echo "✅ Running configuration script for $VARIANT..." 19 | ./distro-scripts/$VARIANT.sh 20 | fi 21 | done 22 | 23 | # Clone Swift and all the related projects 24 | git clone https://github.com/apple/swift 25 | 26 | ./swift/utils/update-checkout --clone 27 | -------------------------------------------------------------------------------- /distro-scripts/16.04.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "🍓 Fixing clang links..." 4 | 5 | sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100 6 | sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100 7 | 8 | -------------------------------------------------------------------------------- /distro-scripts/stretch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "🍓 Fixing clang links..." 4 | 5 | sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100 6 | sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100 7 | 8 | echo "🍓 Installing Stretch dependencies..." 9 | 10 | sudo apt remove -y swig swig3.0 11 | sudo apt install -y libpcre3 libpcre3-dev 12 | wget http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz 13 | 14 | tar xzf swig-3.0.12.tar.gz 15 | pushd swig-3.0.12 16 | 17 | ./configure 18 | make 19 | sudo make install 20 | 21 | popd 22 | rm -rf swig-3.0.12 23 | rm swig-3.0.12.tar.gz 24 | 25 | -------------------------------------------------------------------------------- /icu.diffs/aarch32/libicudataswift.diff: -------------------------------------------------------------------------------- 1 | diff --git a/icu4c/source/config/mh-linux b/icu4c/source/config/mh-linux 2 | index 53d6780d68..c375aeb96c 100644 3 | --- a/icu4c/source/config/mh-linux 4 | +++ b/icu4c/source/config/mh-linux 5 | @@ -23,7 +23,8 @@ LD_RPATH= -Wl,-zorigin,-rpath,'$$'ORIGIN 6 | LD_RPATH_PRE = -Wl,-rpath, 7 | 8 | ## These are the library specific LDFLAGS 9 | -LDFLAGSICUDT=-nodefaultlibs -nostdlib 10 | +#LDFLAGSICUDT=-nodefaultlibs -nostdlib 11 | +LDFLAGSICUDT= 12 | 13 | ## Compiler switch to embed a library name 14 | # The initial tab in the next line is to prevent icu-config from reading it. 15 | -------------------------------------------------------------------------------- /llbuild.diffs/aarch32/handle_id.diff: -------------------------------------------------------------------------------- 1 | diff --git a/include/llbuild/Basic/Subprocess.h b/include/llbuild/Basic/Subprocess.h 2 | index c589691..89bed60 100644 3 | --- a/include/llbuild/Basic/Subprocess.h 4 | +++ b/include/llbuild/Basic/Subprocess.h 5 | @@ -58,7 +58,7 @@ namespace llbuild { 6 | /// Handle used to communicate information about a launched process. 7 | struct ProcessHandle { 8 | /// Opaque ID. 9 | - uint64_t id; 10 | + uintptr_t id; 11 | }; 12 | 13 | struct ProcessInfo { 14 | -------------------------------------------------------------------------------- /llvm-project.diffs/aarch32/a922364e5bb45a8db448121e4e57d00524bc98a3.diff: -------------------------------------------------------------------------------- 1 | diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp 2 | index 2c57eee..c28da00 100644 3 | --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp 4 | +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp 5 | @@ -505,6 +505,9 @@ void RuntimeDyldELF::resolveARMRelocation(const SectionEntry &Section, 6 | (support::ulittle32_t::ref{TargetPtr} & ~0x000F0FFF) | (Value & 0xFFF) | 7 | (((Value >> 12) & 0xF) << 16); 8 | break; 9 | + case ELF::R_ARM_REL32: 10 | + *TargetPtr += Value - FinalAddress; 11 | + break; 12 | // Write 24 bit relative value to the branch instruction. 13 | case ELF::R_ARM_PC24: // Fall through. 14 | case ELF::R_ARM_CALL: // Fall through. 15 | @@ -1219,6 +1222,19 @@ RuntimeDyldELF::processRelocationRef( 16 | RelType, 0); 17 | Section.advanceStubOffset(getMaxStubSize()); 18 | } 19 | + } else if (RelType == ELF::R_ARM_GOT_PREL) { 20 | + uint32_t GOTOffset = allocateGOTEntries(1); 21 | + 22 | + RelocationEntry GOTRE(SectionID, Offset, ELF::R_ARM_REL32, GOTOffset); 23 | + addRelocationForSection(GOTRE, GOTSectionID); 24 | + 25 | + // Fill in the value of the symbol we're targeting into the GOT 26 | + RelocationEntry RE = computeGOTOffsetRE(GOTOffset, 27 | + Value.Offset, ELF::R_ARM_ABS32); 28 | + if (Value.SymbolName) 29 | + addRelocationForSymbol(RE, Value.SymbolName); 30 | + else 31 | + addRelocationForSection(RE, Value.SectionID); 32 | } else { 33 | uint32_t *Placeholder = 34 | reinterpret_cast(computePlaceholderAddress(SectionID, Offset)); 35 | -------------------------------------------------------------------------------- /llvm-project.diffs/aarch32/disable_alignment_assert.diff: -------------------------------------------------------------------------------- 1 | diff --git a/llvm/include/llvm/ADT/PointerIntPair.h b/llvm/include/llvm/ADT/PointerIntPair.h 2 | index cb8b202c48b7..8b845dfab0fb 100644 3 | --- a/llvm/include/llvm/ADT/PointerIntPair.h 4 | +++ b/llvm/include/llvm/ADT/PointerIntPair.h 5 | @@ -175,8 +175,8 @@ struct PointerIntPairInfo { 6 | static intptr_t updatePointer(intptr_t OrigValue, PointerT Ptr) { 7 | intptr_t PtrWord = 8 | reinterpret_cast(PtrTraits::getAsVoidPointer(Ptr)); 9 | - assert((PtrWord & ~PointerBitMask) == 0 && 10 | - "Pointer is not sufficiently aligned"); 11 | + //assert((PtrWord & ~PointerBitMask) == 0 && 12 | + // "Pointer is not sufficiently aligned"); 13 | // Preserve all low bits, just update the pointer. 14 | return PtrWord | (OrigValue & ~PointerBitMask); 15 | } 16 | -------------------------------------------------------------------------------- /logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | buildSwift 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | buildSwiftOn 25 | ARM 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /swift-corelibs-libdispatch.diffs/aarch32/benchmark.diff: -------------------------------------------------------------------------------- 1 | diff --git a/src/benchmark.c b/src/benchmark.c 2 | index 15e9f55..bea000c 100644 3 | --- a/src/benchmark.c 4 | +++ b/src/benchmark.c 5 | @@ -20,6 +20,10 @@ 6 | 7 | #include "internal.h" 8 | 9 | +#pragma GCC diagnostic push 10 | +#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion" 11 | +#pragma GCC diagnostic ignored "-Wimplicit-const-int-float-conversion" 12 | + 13 | struct __dispatch_benchmark_data_s { 14 | #if HAVE_MACH_ABSOLUTE_TIME 15 | mach_timebase_info_data_t tbi; 16 | @@ -126,3 +130,5 @@ dispatch_benchmark_f(size_t count, register void *ctxt, 17 | 18 | return ns - bdata.loop_cost; 19 | } 20 | + 21 | +#pragma GCC diagnostic pop 22 | -------------------------------------------------------------------------------- /swift-corelibs-libdispatch.diffs/raspbian/arm_clrex.diff: -------------------------------------------------------------------------------- 1 | diff --git a/src/shims/yield.c b/src/shims/yield.c 2 | index 43f0017..c0b8111 100644 3 | --- a/src/shims/yield.c 4 | +++ b/src/shims/yield.c 5 | @@ -36,17 +36,6 @@ void * 6 | _dispatch_wait_for_enqueuer(void **ptr) 7 | { 8 | #if !DISPATCH_HW_CONFIG_UP 9 | -#if defined(__arm__) || defined(__arm64__) 10 | - int spins = DISPATCH_WAIT_SPINS_WFE; 11 | - void *value; 12 | - while (unlikely(spins-- > 0)) { 13 | - if (likely(value = __builtin_arm_ldrex(ptr))) { 14 | - __builtin_arm_clrex(); 15 | - return value; 16 | - } 17 | - __builtin_arm_wfe(); 18 | - } 19 | -#else 20 | int spins = DISPATCH_WAIT_SPINS; 21 | void *value; 22 | while (unlikely(spins-- > 0)) { 23 | @@ -55,7 +44,6 @@ _dispatch_wait_for_enqueuer(void **ptr) 24 | } 25 | dispatch_hardware_pause(); 26 | } 27 | -#endif 28 | #endif // DISPATCH_HW_CONFIG_UP 29 | return __DISPATCH_WAIT_FOR_ENQUEUER__(ptr); 30 | } 31 | -------------------------------------------------------------------------------- /swift-tools-support-core.diffs/raspbian/fd_set.diff: -------------------------------------------------------------------------------- 1 | diff --git a/Sources/TSCUtility/FSWatch.swift b/Sources/TSCUtility/FSWatch.swift 2 | index 0658e55b..e6a4b6e7 100644 3 | --- a/Sources/TSCUtility/FSWatch.swift 4 | +++ b/Sources/TSCUtility/FSWatch.swift 5 | @@ -428,7 +428,10 @@ public final class Inotify { 6 | // FIXME: Swift should provide shims for FD_ macros 7 | 8 | private func FD_ZERO(_ set: inout fd_set) { 9 | - #if os(Android) 10 | + #if os(Linux) && arch(arm) 11 | + set.__fds_bits = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 13 | + #elseif os(Android) 14 | set.fds_bits = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 15 | #else 16 | set.__fds_bits = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 17 | @@ -436,8 +439,14 @@ private func FD_ZERO(_ set: inout fd_set) { 18 | } 19 | 20 | private func FD_SET(_ fd: Int32, _ set: inout fd_set) { 21 | - let intOffset = Int(fd / 16) 22 | - let bitOffset = Int(fd % 16) 23 | + #if os(Linux) && arch(arm) 24 | + let sz: Int32 = 32 //Could this be only 32? 25 | + #else 26 | + let sz = 16 27 | + #endif 28 | + let intOffset = Int(fd / sz) 29 | + let bitOffset = Int(fd % sz) 30 | + 31 | #if os(Android) 32 | var fd_bits = set.fds_bits 33 | let mask: UInt = 1 << bitOffset 34 | @@ -462,6 +471,24 @@ private func FD_SET(_ fd: Int32, _ set: inout fd_set) { 35 | case 13: fd_bits.13 = fd_bits.13 | mask 36 | case 14: fd_bits.14 = fd_bits.14 | mask 37 | case 15: fd_bits.15 = fd_bits.15 | mask 38 | + #if os(Linux) && arch(arm) 39 | + case 16: fd_bits.16 = fd_bits.16 | mask 40 | + case 17: fd_bits.17 = fd_bits.17 | mask 41 | + case 18: fd_bits.18 = fd_bits.18 | mask 42 | + case 19: fd_bits.19 = fd_bits.19 | mask 43 | + case 20: fd_bits.20 = fd_bits.20 | mask 44 | + case 21: fd_bits.21 = fd_bits.21 | mask 45 | + case 22: fd_bits.22 = fd_bits.22 | mask 46 | + case 23: fd_bits.23 = fd_bits.23 | mask 47 | + case 24: fd_bits.24 = fd_bits.24 | mask 48 | + case 25: fd_bits.25 = fd_bits.25 | mask 49 | + case 26: fd_bits.26 = fd_bits.26 | mask 50 | + case 27: fd_bits.27 = fd_bits.27 | mask 51 | + case 28: fd_bits.28 = fd_bits.28 | mask 52 | + case 29: fd_bits.29 = fd_bits.29 | mask 53 | + case 30: fd_bits.30 = fd_bits.30 | mask 54 | + case 31: fd_bits.31 = fd_bits.31 | mask 55 | + #endif 56 | default: break 57 | } 58 | #if os(Android) 59 | @@ -498,6 +525,24 @@ private func FD_ISSET(_ fd: Int32, _ set: inout fd_set) -> Bool { 60 | case 13: return fd_bits.13 & mask != 0 61 | case 14: return fd_bits.14 & mask != 0 62 | case 15: return fd_bits.15 & mask != 0 63 | + #if os(Linux) && arch(arm) 64 | + case 16: return fd_bits.16 & mask != 0 65 | + case 17: return fd_bits.17 & mask != 0 66 | + case 18: return fd_bits.18 & mask != 0 67 | + case 19: return fd_bits.19 & mask != 0 68 | + case 20: return fd_bits.20 & mask != 0 69 | + case 21: return fd_bits.21 & mask != 0 70 | + case 22: return fd_bits.22 & mask != 0 71 | + case 23: return fd_bits.23 & mask != 0 72 | + case 24: return fd_bits.24 & mask != 0 73 | + case 25: return fd_bits.25 & mask != 0 74 | + case 26: return fd_bits.26 & mask != 0 75 | + case 27: return fd_bits.27 & mask != 0 76 | + case 28: return fd_bits.28 & mask != 0 77 | + case 29: return fd_bits.29 & mask != 0 78 | + case 30: return fd_bits.30 & mask != 0 79 | + case 31: return fd_bits.31 & mask != 0 80 | + #endif 81 | default: return false 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /swift-tools-support-core.diffs/raspbian/tools_support_armv6.diff: -------------------------------------------------------------------------------- 1 | diff --git a/Sources/TSCUtility/Triple.swift b/Sources/TSCUtility/Triple.swift 2 | index 5d5b45c6413..18c1ac83034 100644 3 | --- a/Sources/TSCUtility/Triple.swift 2021-05-31 14:15:54.605849942 +0000 4 | +++ b/Sources/TSCUtility/Triple.swift 2021-05-31 14:16:04.475652813 +0000 5 | @@ -40,6 +40,7 @@ 6 | case s390x 7 | case aarch64 8 | case armv7 9 | + case armv6 10 | case arm 11 | case arm64 12 | case arm64e 13 | -------------------------------------------------------------------------------- /swift.diffs/aarch32/AddSwift.cmake.diff: -------------------------------------------------------------------------------- 1 | diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake 2 | index fb4ba732dc7..f02c170de36 100644 3 | --- a/cmake/modules/AddSwift.cmake 4 | +++ b/cmake/modules/AddSwift.cmake 5 | @@ -302,6 +302,9 @@ function(_add_host_variant_link_flags target) 6 | target_link_libraries(${target} PRIVATE 7 | pthread 8 | dl) 9 | + if("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "armv6|armv7|i686") 10 | + target_link_libraries(${target} PRIVATE atomic) 11 | + endif() 12 | elseif(SWIFT_HOST_VARIANT_SDK STREQUAL FREEBSD) 13 | target_link_libraries(${target} PRIVATE 14 | pthread) 15 | -------------------------------------------------------------------------------- /swift.diffs/aarch32/AddSwiftStdlib.cmake.diff: -------------------------------------------------------------------------------- 1 | diff --git a/stdlib/cmake/modules/AddSwiftStdlib.cmake b/stdlib/cmake/modules/AddSwiftStdlib.cmake 2 | index 38191b01a64..5bd9ea7cead 100644 3 | --- a/stdlib/cmake/modules/AddSwiftStdlib.cmake 4 | +++ b/stdlib/cmake/modules/AddSwiftStdlib.cmake 5 | @@ -372,6 +372,9 @@ function(_add_target_variant_link_flags) 6 | MACCATALYST_BUILD_FLAVOR "${LFLAGS_MACCATALYST_BUILD_FLAVOR}") 7 | if("${LFLAGS_SDK}" STREQUAL "LINUX") 8 | list(APPEND link_libraries "pthread" "dl") 9 | + if("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "armv6|armv7|i686") 10 | + list(APPEND link_libraries PRIVATE "atomic") 11 | + endif() 12 | elseif("${LFLAGS_SDK}" STREQUAL "FREEBSD") 13 | list(APPEND link_libraries "pthread") 14 | elseif("${LFLAGS_SDK}" STREQUAL "OPENBSD") 15 | -------------------------------------------------------------------------------- /swift.diffs/aarch32/AddSwiftUnittests.cmake.diff: -------------------------------------------------------------------------------- 1 | diff --git a/cmake/modules/AddSwiftUnittests.cmake b/cmake/modules/AddSwiftUnittests.cmake 2 | index f631429a536..9c9047cb3d7 100644 3 | --- a/cmake/modules/AddSwiftUnittests.cmake 4 | +++ b/cmake/modules/AddSwiftUnittests.cmake 5 | @@ -56,6 +56,9 @@ function(add_swift_unittest test_dirname) 6 | if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") 7 | target_compile_options(${test_dirname} PRIVATE 8 | -march=core2) 9 | + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv6|armv7|i686") 10 | + set_property(TARGET "${test_dirname}" APPEND PROPERTY LINK_LIBRARIES 11 | + "atomic") 12 | endif() 13 | elseif("${SWIFT_HOST_VARIANT}" STREQUAL "windows") 14 | target_compile_definitions("${test_dirname}" PRIVATE 15 | -------------------------------------------------------------------------------- /swift.diffs/aarch32/CMakeLists.txt.diff: -------------------------------------------------------------------------------- 1 | diff --git a/unittests/runtime/LongTests/CMakeLists.txt b/unittests/runtime/LongTests/CMakeLists.txt 2 | index 685d29f7547..0ae5d597bf6 100644 3 | --- a/unittests/runtime/LongTests/CMakeLists.txt 4 | +++ b/unittests/runtime/LongTests/CMakeLists.txt 5 | @@ -19,6 +19,12 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND 6 | 7 | # Link the Objective-C runtime. 8 | list(APPEND PLATFORM_TARGET_LINK_LIBRARIES "objc") 9 | + elseif(SWIFT_HOST_VARIANT STREQUAL "linux") 10 | + if(SWIFT_HOST_VARIANT_ARCH MATCHES "armv6|armv7|i686") 11 | + list(APPEND PLATFORM_TARGET_LINK_LIBRARIES 12 | + "atomic" 13 | + ) 14 | + endif() 15 | elseif(SWIFT_HOST_VARIANT STREQUAL "freebsd") 16 | find_library(EXECINFO_LIBRARY execinfo) 17 | list(APPEND PLATFORM_TARGET_LINK_LIBRARIES 18 | -------------------------------------------------------------------------------- /swift.diffs/aarch32/IRGenModule.cpp.diff: -------------------------------------------------------------------------------- 1 | diff --git a/lib/IRGen/IRGenModule.cpp b/lib/IRGen/IRGenModule.cpp 2 | index 406acd40ffd..37c4c998557 100644 3 | --- a/lib/IRGen/IRGenModule.cpp 4 | +++ b/lib/IRGen/IRGenModule.cpp 5 | @@ -1609,7 +1609,8 @@ bool IRGenModule::useDllStorage() { return ::useDllStorage(Triple); } 6 | 7 | bool IRGenModule::shouldPrespecializeGenericMetadata() { 8 | auto canPrespecializeTarget = 9 | - (Triple.isOSDarwin() || Triple.isTvOS() || Triple.isOSLinux()); 10 | + (Triple.isOSDarwin() || Triple.isTvOS() || 11 | + (Triple.isOSLinux() && !(Triple.isARM() && Triple.isArch32Bit()))); 12 | if (canPrespecializeTarget && isStandardLibrary()) { 13 | return true; 14 | } 15 | -------------------------------------------------------------------------------- /swift.diffs/aarch32/RefCount.h.diff: -------------------------------------------------------------------------------- 1 | diff --git a/stdlib/public/SwiftShims/RefCount.h b/stdlib/public/SwiftShims/RefCount.h 2 | index 5c8211f5e9f..fe54839aaae 100644 3 | --- a/stdlib/public/SwiftShims/RefCount.h 4 | +++ b/stdlib/public/SwiftShims/RefCount.h 5 | @@ -1319,7 +1319,12 @@ class HeapObjectSideTableEntry { 6 | 7 | public: 8 | HeapObjectSideTableEntry(HeapObject *newObject) 9 | - : object(newObject), refCounts() 10 | + : object(newObject), 11 | +#if __arm__ // https://bugs.swift.org/browse/SR-5846 12 | + refCounts(SideTableRefCounts::Initialized) 13 | +#else 14 | + refCounts() 15 | +#endif 16 | { } 17 | 18 | #pragma clang diagnostic push 19 | -------------------------------------------------------------------------------- /swift.diffs/aarch32/build-presets.diff: -------------------------------------------------------------------------------- 1 | diff --git a/utils/build-presets.ini b/utils/build-presets.ini 2 | index 5d5b45c6413..18c1ac83034 100644 3 | --- a/utils/build-presets.ini 4 | +++ b/utils/build-presets.ini 5 | @@ -917,6 +917,51 @@ mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build 6 | 7 | android-arch=aarch64 8 | 9 | +#===------------------------------------------------------------------------===# 10 | +# Linux swiftlang-min 11 | +#===------------------------------------------------------------------------===# 12 | +[preset: buildbot_linux,swiftlang-min] 13 | +assertions 14 | +no-swift-stdlib-assertions 15 | +swift-enable-ast-verifier=0 16 | + 17 | +swift-install-components=autolink-driver;compiler;clang-builtin-headers;stdlib;swift-remote-mirror;sdk-overlay;parser-lib;license 18 | +llvm-install-components=llvm-cov;llvm-profdata;clang;clang-resource-headers;compiler-rt;clangd 19 | + 20 | +build-ninja 21 | +release 22 | + 23 | + 24 | + 25 | +install-prefix=/usr 26 | +build-subdir=buildbot_linux 27 | +install-destdir=%(install_destdir)s 28 | +installable-package=%(installable_package)s 29 | + 30 | +build-swift-static-stdlib 31 | +build-swift-static-sdk-overlay 32 | + 33 | +xctest 34 | + 35 | +llbuild 36 | +swiftpm 37 | +foundation 38 | +libdispatch 39 | +libicu 40 | + 41 | +install-xctest 42 | +install-llbuild 43 | +install-swiftpm 44 | +install-swift 45 | +install-foundation 46 | +install-libdispatch 47 | +install-libicu 48 | +reconfigure 49 | +#===------------------------------------------------------------------------===# 50 | +# End 51 | +#===------------------------------------------------------------------------===# 52 | + 53 | + 54 | # Ubuntu 18.04 preset for backwards compat and future customizations. 55 | [preset: buildbot_linux_1804] 56 | mixin-preset=buildbot_linux 57 | -------------------------------------------------------------------------------- /swift.diffs/raspbian/forcearmv6.diff: -------------------------------------------------------------------------------- 1 | diff --git a/utils/swift_build_support/swift_build_support/targets.py b/utils/swift_build_support/swift_build_support/targets. 2 | py 3 | index 2859677fac..b7d65c4f9a 100644 4 | --- a/utils/swift_build_support/swift_build_support/targets.py 5 | +++ b/utils/swift_build_support/swift_build_support/targets.py 6 | @@ -156,7 +156,7 @@ class StdlibDeploymentTarget(object): 7 | the recognized targets. Otherwise, throw a NotImplementedError. 8 | """ 9 | system = platform.system() 10 | - machine = platform.machine() 11 | + machine = "armv6l" #platform.machine() 12 | 13 | if system == 'Linux': 14 | if machine == 'x86_64': 15 | -------------------------------------------------------------------------------- /swiftpm.diffs/aarch32/BuildPlan.swift.diff: -------------------------------------------------------------------------------- 1 | diff --git a/Sources/Build/BuildPlan.swift b/Sources/Build/BuildPlan.swift 2 | index cfbc76ae..03272c4b 100644 3 | --- a/Sources/Build/BuildPlan.swift 4 | +++ b/Sources/Build/BuildPlan.swift 5 | @@ -1125,6 +1125,7 @@ public final class ProductBuildDescription { 6 | // adjacent to the product. 7 | if buildParameters.triple.isLinux() { 8 | args += ["-Xlinker", "-rpath=$ORIGIN"] 9 | + args += ["-Xlinker", "--allow-multiple-definition"] 10 | } else if buildParameters.triple.isDarwin() { 11 | let rpath = product.type == .test ? "@loader_path/../../../" : "@loader_path" 12 | args += ["-Xlinker", "-rpath", "-Xlinker", rpath] 13 | -------------------------------------------------------------------------------- /utils.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Set OS, VERSION and ARCH 4 | OS="unknown" 5 | VERSION="unknown" 6 | ARCH="unknown" 7 | ARCHFAMILY="unknown" 8 | 9 | if [[ $(cat /etc/os-release) = *"Ubuntu"* ]]; then 10 | OS="ubuntu" 11 | VERSION=`cat /etc/os-release | sed -n 's/VERSION_ID=\"\([0-9].*\)\"/\1/p'` 12 | elif [[ $(cat /etc/os-release) = *"Raspbian"* ]]; then 13 | OS="raspbian" 14 | if [[ $(cat /etc/os-release) = *"stretch"* ]]; then 15 | VERSION="stretch" 16 | elif [[ $(cat /etc/os-release) = *"buster"* ]]; then 17 | VERSION="buster" 18 | fi 19 | elif [[ $(cat /etc/os-release) = *"stretch"* ]]; then 20 | OS="debian" 21 | VERSION="stretch" 22 | elif [[ $(cat /etc/os-release) = *"buster"* ]]; then 23 | OS="debian" 24 | VERSION="buster" 25 | fi 26 | 27 | case `uname -m` in 28 | aarch64) 29 | ARCH="aarch64" 30 | ARCHFAMILY="aarch64";; 31 | armv6*) 32 | ARCH="armv6" 33 | ARCHFAMILY="aarch32";; 34 | *) 35 | ARCH="armv7" 36 | ARCHFAMILY="aarch32";; 37 | esac 38 | --------------------------------------------------------------------------------