Commit 7a695925 authored by Drew's avatar Drew

Strip dead code on OSX

Add "magic" option to disable dead stripping
parent beba1af9
Pipeline #1916 failed with stage
......@@ -212,6 +212,7 @@ final class ATllbuild : Tool {
case Framework = "framework"
case ExecutableName = "executable-name"
case Bitcode = "bitcode"
case Magic = "magic"
static var allOptions : [Options] {
......@@ -235,7 +236,8 @@ final class ATllbuild : Tool {
WholeModuleOptimization,
Framework,
ExecutableName,
Bitcode
Bitcode,
Magic
]
}
}
......@@ -494,6 +496,16 @@ final class ATllbuild : Tool {
///The next task will not be bootstrapped.
defer { Platform.buildPlatform = Platform.hostPlatform }
if task[Options.Magic.rawValue] == nil || task[Options.Magic.rawValue]?.bool == true {
print("build platform is \(Platform.buildPlatform)")
switch(Platform.buildPlatform) {
case .OSX:
linkOptions.append(contentsOf: ["-Xlinker","-dead_strip"])
default:
break
}
}
let sdk: Bool
if task[Options.LinkSDK.rawValue]?.bool == false {
sdk = false
......
......@@ -22,5 +22,5 @@ commands:
tool: shell
inputs: ["<atllbuild-swiftc>", ".atllbuild/objects/main.swift.o"]
outputs: ["<atllbuild>", ".atllbuild/products/platforms"]
args: ["/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swiftc", "-o", ".atllbuild/products/platforms", ".atllbuild/objects/main.swift.o"]
args: ["/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swiftc", "-o", ".atllbuild/products/platforms", ".atllbuild/objects/main.swift.o", "-Xlinker", "-dead_strip"]
description: Linking executable .atllbuild/products/platforms
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment