Skip to content

Commit e1a6f48

Browse files
authored
Revert "Inclusive language: rename master object file to prelinked object file"
This reverts commit ea8d619.
1 parent e97614b commit e1a6f48

File tree

12 files changed

+66
-69
lines changed

12 files changed

+66
-69
lines changed

Sources/SWBCore/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ add_library(SWBCore
155155
SpecImplementations/Tools/LaunchServicesRegisterTool.swift
156156
SpecImplementations/Tools/LinkerTools.swift
157157
SpecImplementations/Tools/Lipo.swift
158+
SpecImplementations/Tools/MasterObjectLink.swift
158159
SpecImplementations/Tools/MergeInfoPlist.swift
159160
SpecImplementations/Tools/MkdirTool.swift
160161
SpecImplementations/Tools/ModulesVerifierTool.swift
161162
SpecImplementations/Tools/PLUtilTool.swift
162-
SpecImplementations/Tools/PrelinkedObjectLink.swift
163163
SpecImplementations/Tools/ProcessSDKImports.swift
164164
SpecImplementations/Tools/ProcessXCFrameworkLibrary.swift
165165
SpecImplementations/Tools/ProductPackaging.swift

Sources/SWBCore/Settings/BuiltinMacros.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ public final class BuiltinMacros {
717717
public static let GENERATE_EMBED_IN_CODE_ACCESSORS = BuiltinMacros.declareBooleanMacro("GENERATE_EMBED_IN_CODE_ACCESSORS")
718718
public static let GENERATE_INFOPLIST_FILE = BuiltinMacros.declareBooleanMacro("GENERATE_INFOPLIST_FILE")
719719
public static let GENERATE_KERNEL_MODULE_INFO_FILE = BuiltinMacros.declareBooleanMacro("GENERATE_KERNEL_MODULE_INFO_FILE")
720-
public static let GENERATE_PRELINK_OBJECT_FILE = BuiltinMacros.declareBooleanMacro("GENERATE_PRELINK_OBJECT_FILE")
720+
public static let GENERATE_MASTER_OBJECT_FILE = BuiltinMacros.declareBooleanMacro("GENERATE_MASTER_OBJECT_FILE")
721721
public static let GENERATE_PKGINFO_FILE = BuiltinMacros.declareBooleanMacro("GENERATE_PKGINFO_FILE")
722722
public static let GENERATE_RESOURCE_ACCESSORS = BuiltinMacros.declareBooleanMacro("GENERATE_RESOURCE_ACCESSORS")
723723
public static let GENERATE_TEST_ENTRY_POINT = BuiltinMacros.declareBooleanMacro("GENERATE_TEST_ENTRY_POINT")
@@ -1753,7 +1753,7 @@ public final class BuiltinMacros {
17531753
GENERATE_EMBED_IN_CODE_ACCESSORS,
17541754
GENERATE_INFOPLIST_FILE,
17551755
GENERATE_KERNEL_MODULE_INFO_FILE,
1756-
GENERATE_PRELINK_OBJECT_FILE,
1756+
GENERATE_MASTER_OBJECT_FILE,
17571757
GENERATE_PKGINFO_FILE,
17581758
GENERATE_RESOURCE_ACCESSORS,
17591759
GENERATE_TEST_ENTRY_POINT,

Sources/SWBCore/SpecImplementations/RegisterSpecs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public struct BuiltinSpecsExtension: SpecificationsExtension {
129129
ValidateDevelopmentAssets.self,
130130
ConstructStubExecutorFileListToolSpec.self,
131131
GateSpec.self,
132-
PrelinkedObjectLinkSpec.self,
132+
MasterObjectLinkSpec.self,
133133
SetAttributesSpec.self,
134134
WriteFileSpec.self,
135135
SignatureCollectionSpec.self,

Sources/SWBCore/SpecImplementations/Tools/PrelinkedObjectLink.swift renamed to Sources/SWBCore/SpecImplementations/Tools/MasterObjectLink.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
import SWBUtil
1414
import SWBMacro
1515

16-
/// Spec to use the linker to run `ld -r` to create a prelinked object file.
17-
public final class PrelinkedObjectLinkSpec: CommandLineToolSpec, SpecImplementationType, @unchecked Sendable {
18-
public static let identifier = "com.apple.build-tools.prelinked-object-link"
16+
/// Spec to use the linker to run `ld -r` to create a prelinked object file (a.k.a. "master object file").
17+
final class MasterObjectLinkSpec: CommandLineToolSpec, SpecImplementationType, @unchecked Sendable {
18+
static let identifier = "com.apple.build-tools.master-object-link"
1919

20-
public class func construct(registry: SpecRegistry, proxy: SpecProxy) -> Spec {
21-
return PrelinkedObjectLinkSpec(registry, proxy, ruleInfoTemplate: [], commandLineTemplate: [])
20+
class func construct(registry: SpecRegistry, proxy: SpecProxy) -> Spec {
21+
return MasterObjectLinkSpec(registry, proxy, ruleInfoTemplate: [], commandLineTemplate: [])
2222
}
2323

24-
public override func constructTasks(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) async {
24+
override func constructTasks(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) async {
2525
guard let toolSpecInfo = await cbc.producer.ldLinkerSpec.discoveredCommandLineToolSpecInfo(cbc.producer, cbc.scope, delegate) as? DiscoveredLdLinkerToolSpecInfo else {
2626
delegate.error("Could not find path to ld binary")
2727
return
@@ -62,14 +62,14 @@ public final class PrelinkedObjectLinkSpec: CommandLineToolSpec, SpecImplementat
6262
commandLine += cbc.scope.evaluate(BuiltinMacros.PRELINK_FLAGS)
6363
let warningLdFlags = cbc.scope.evaluate(BuiltinMacros.WARNING_LDFLAGS)
6464
if !warningLdFlags.isEmpty {
65-
// WARNING_LDFLAGS for some reason is only used for creating the prelinked object file.
65+
// WARNING_LDFLAGS for some reason is only used for creating the master object file.
6666
delegate.warning("WARNING_LDFLAGS is deprecated; use OTHER_LDFLAGS instead.", location: .buildSetting(BuiltinMacros.WARNING_LDFLAGS))
6767
commandLine += warningLdFlags
6868
}
6969
commandLine += cbc.inputs.map({ $0.absolutePath.str })
7070
commandLine += cbc.scope.evaluate(BuiltinMacros.PRELINK_LIBS)
7171
commandLine += ["-o", outputPath.str]
7272

73-
delegate.createTask(type: self, ruleInfo: ["PrelinkedObjectLink", outputPath.str], commandLine: commandLine, environment: EnvironmentBindings(), workingDirectory: cbc.producer.defaultWorkingDirectory, inputs: cbc.inputs.map({ $0.absolutePath }), outputs: [outputPath], action: nil, execDescription: "Link \(outputPath.basename)", enableSandboxing: enableSandboxing)
73+
delegate.createTask(type: self, ruleInfo: ["MasterObjectLink", outputPath.str], commandLine: commandLine, environment: EnvironmentBindings(), workingDirectory: cbc.producer.defaultWorkingDirectory, inputs: cbc.inputs.map({ $0.absolutePath }), outputs: [outputPath], action: nil, execDescription: "Link \(outputPath.basename)", enableSandboxing: enableSandboxing)
7474
}
7575
}

Sources/SWBCore/Specs/CoreBuildSystem.xcspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@
442442
};
443443
},
444444
{
445-
Name = "GENERATE_PRELINK_OBJECT_FILE";
445+
Name = "GENERATE_MASTER_OBJECT_FILE";
446446
Type = bool;
447-
DefaultValue = "$(GENERATE_MASTER_OBJECT_FILE:default=NO)"; // ignore-unacceptable-language; kept for compatibility
447+
DefaultValue = NO;
448448
},
449449
{
450450
Name = "PRELINK_LIBS";
@@ -1598,10 +1598,10 @@ When `GENERATE_INFOPLIST_FILE` is enabled, sets the value of the [CFBundleIdenti
15981598
);
15991599
},
16001600
{
1601-
Name = "GENERATE_PRELINK_OBJECT_FILE";
1601+
Name = "GENERATE_MASTER_OBJECT_FILE";
16021602
Type = Boolean;
16031603
Category = "Linking - General";
1604-
DefaultValue = "$(GENERATE_MASTER_OBJECT_FILE:default=NO)"; // ignore-unacceptable-language; kept for compatibility
1604+
DefaultValue = NO;
16051605
ConditionFlavors = (
16061606
arch,
16071607
sdk,

Sources/SWBCore/Specs/en.lproj/CoreBuildSystem.strings

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ Generally you should not specify an order file in Debug or Development configura
409409
"[LINKER_DISPLAYS_MANGLED_NAMES]-name" = "Display Mangled Names";
410410
"[LINKER_DISPLAYS_MANGLED_NAMES]-description" = "Activating this setting causes the linker to display mangled names for C++ symbols. Normally, this is not recommended, but turning it on can help to diagnose and solve C++ link errors.";
411411

412-
"[GENERATE_PRELINK_OBJECT_FILE]-name" = "Perform Single-Object Prelink";
413-
"[GENERATE_PRELINK_OBJECT_FILE]-description" = "Activating this setting will cause the object files built by a target to be prelinked using `ld -r` into a single object file, and that object file will then be linked into the final product. This is useful to force the linker to resolve symbols and link the object files into a single module before building a static library. Also, a separate set of link flags can be applied to the prelink allowing additional control over, for instance, exported symbols.";
412+
"[GENERATE_MASTER_OBJECT_FILE]-name" = "Perform Single-Object Prelink";
413+
"[GENERATE_MASTER_OBJECT_FILE]-description" = "Activating this setting will cause the object files built by a target to be prelinked using `ld -r` into a single object file, and that object file will then be linked into the final product. This is useful to force the linker to resolve symbols and link the object files into a single module before building a static library. Also, a separate set of link flags can be applied to the prelink allowing additional control over, for instance, exported symbols.";
414414

415415
"[PRELINK_LIBS]-name" = "Prelink libraries";
416416
"[PRELINK_LIBS]-description" = "Additional libraries to pass when performing a single-object prelink.";

Sources/SWBProjectModel/PIFGenerationModel.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ public enum PIF {
963963
public var GCC_OPTIMIZATION_LEVEL: String?
964964
public var GCC_PREPROCESSOR_DEFINITIONS: [String]?
965965
public var GENERATE_EMBED_IN_CODE_ACCESSORS: String?
966-
public var GENERATE_PRELINK_OBJECT_FILE: String?
966+
public var GENERATE_MASTER_OBJECT_FILE: String?
967967
public var GENERATE_RESOURCE_ACCESSORS: String?
968968
public var HEADER_SEARCH_PATHS: [String]?
969969
public var INFOPLIST_FILE: String?
@@ -1045,9 +1045,6 @@ public enum PIF {
10451045
public var USE_HEADERMAP: String?
10461046
public var USES_SWIFTPM_UNSAFE_FLAGS: String?
10471047
public var WATCHOS_DEPLOYMENT_TARGET: String?
1048-
1049-
@available(*, deprecated, renamed: "GENERATE_PRELINK_OBJECT_FILE")
1050-
public var GENERATE_MASTER_OBJECT_FILE: String? // ignore-unacceptable-language
10511048
}
10521049
}
10531050

Sources/SWBTaskConstruction/TaskProducers/BuildPhaseTaskProducers/SourcesTaskProducer.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -865,14 +865,14 @@ final class SourcesTaskProducer: FilesBasedBuildPhaseTaskProducerBase, FilesBase
865865
}
866866
}
867867

868-
// Handle linking prelinked objects. Presently we always do this if GENERATE_PRELINK_OBJECT_FILE even if there are no other tasks, since PRELINK_LIBS or PRELINK_FLAGS might be set to values which will cause a prelinked object file to be generated.
869-
// FIXME: The implicitly means that if GENERATE_PRELINK_OBJECT_FILE is enabled then we will always try to link. That's arguably not correct.
870-
if !isForAPI && scope.evaluate(BuiltinMacros.GENERATE_PRELINK_OBJECT_FILE) {
871-
let executableName = scope.evaluate(BuiltinMacros.EXECUTABLE_NAME) + "-" + arch + "-prelink.o"
868+
// Handle linking master objects. Presently we always do this if GENERATE_MASTER_OBJECT_FILE even if there are no other tasks, since PRELINK_LIBS or PRELINK_FLAGS might be set to values which will cause a master object file to be generated.
869+
// FIXME: The implicitly means that if GENERATE_MASTER_OBJECT_FILE is enabled then we will always try to link. That's arguably not correct.
870+
if !isForAPI && scope.evaluate(BuiltinMacros.GENERATE_MASTER_OBJECT_FILE) {
871+
let executableName = scope.evaluate(BuiltinMacros.EXECUTABLE_NAME) + "-" + arch + "-master.o"
872872
// FIXME: It would be more consistent to put this in the per-arch directory.
873873
let output = Path(scope.evaluate(BuiltinMacros.PER_VARIANT_OBJECT_FILE_DIR)).join(executableName)
874874
await appendGeneratedTasks(&perArchTasks, options: [.linking, .linkingRequirement, .unsignedProductRequirement]) { delegate in
875-
await context.prelinkedObjectLinkSpec.constructTasks(CommandBuildContext(producer: context, scope: scope, inputs: linkerInputNodes.map { FileToBuild(context: context, absolutePath: $0.path) }, output: output), delegate)
875+
await context.masterObjectLinkSpec.constructTasks(CommandBuildContext(producer: context, scope: scope, inputs: linkerInputNodes.map { FileToBuild(context: context, absolutePath: $0.path) }, output: output), delegate)
876876
}
877877
linkerInputNodes = [context.createNode(output)]
878878
}
@@ -912,7 +912,7 @@ final class SourcesTaskProducer: FilesBasedBuildPhaseTaskProducerBase, FilesBase
912912
continue
913913
}
914914

915-
// Create the linker task. If we have no input files but decide to create the task anyway, then this task will rely on gate tasks to be properly ordered (which is what happens for the prelinked object file task above if there are no input files).
915+
// Create the linker task. If we have no input files but decide to create the task anyway, then this task will rely on gate tasks to be properly ordered (which is what happens for the master object file task above if there are no input files).
916916
if !linkerInputNodes.isEmpty || (components.contains("build") && scope.evaluate(BuiltinMacros.MERGE_LINKED_LIBRARIES)) {
917917
// Compute the output path.
918918
let output: Path

Sources/SWBTaskConstruction/TaskProducers/TaskProducer.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public class TaskProducerContext: StaleFileRemovalContext, BuildFileResolution
228228
public let ldLinkerSpec: LdLinkerSpec
229229
public let libtoolLinkerSpec: LibtoolLinkerSpec
230230
public let lipoSpec: LipoToolSpec
231-
let prelinkedObjectLinkSpec: CommandLineToolSpec
231+
let masterObjectLinkSpec: CommandLineToolSpec
232232
public let mkdirSpec: MkdirToolSpec
233233
let modulesVerifierSpec: ModulesVerifierToolSpec
234234
let clangModuleVerifierInputGeneratorSpec: ClangModuleVerifierInputGeneratorSpec
@@ -354,7 +354,7 @@ public class TaskProducerContext: StaleFileRemovalContext, BuildFileResolution
354354
self.ldLinkerSpec = try! workspaceContext.core.specRegistry.getSpec(domain: domain) as LdLinkerSpec
355355
self.libtoolLinkerSpec = try! workspaceContext.core.specRegistry.getSpec(domain: domain) as LibtoolLinkerSpec
356356
self.lipoSpec = workspaceContext.core.specRegistry.getSpec("com.apple.xcode.linkers.lipo", domain: domain) as! LipoToolSpec
357-
self.prelinkedObjectLinkSpec = workspaceContext.core.specRegistry.getSpec(PrelinkedObjectLinkSpec.identifier, domain: domain) as! CommandLineToolSpec
357+
self.masterObjectLinkSpec = workspaceContext.core.specRegistry.getSpec("com.apple.build-tools.master-object-link", domain: domain) as! CommandLineToolSpec
358358
self.mkdirSpec = workspaceContext.core.specRegistry.getSpec("com.apple.tools.mkdir", domain: domain) as! MkdirToolSpec
359359
self.modulesVerifierSpec = workspaceContext.core.specRegistry.getSpec("com.apple.build-tools.modules-verifier", domain: domain) as! ModulesVerifierToolSpec
360360
self.clangModuleVerifierInputGeneratorSpec = workspaceContext.core.specRegistry.getSpec("com.apple.build-tools.module-verifier-input-generator", domain: domain) as! ClangModuleVerifierInputGeneratorSpec
@@ -724,9 +724,9 @@ public class TaskProducerContext: StaleFileRemovalContext, BuildFileResolution
724724
return false
725725
}
726726

727-
// If this target is generating a prelinked object file, then we assume it will produce a binary.
728-
// FIXME: This is nasty. See SourcesTaskProducer.generateTasks() for handling of GENERATE_PRELINK_OBJECT_FILE.
729-
guard !scope.evaluate(BuiltinMacros.GENERATE_PRELINK_OBJECT_FILE) else {
727+
// If this target is generating a master object file, then we assume it will produce a binary.
728+
// FIXME: This is nasty. See SourcesTaskProducer.generateTasks() for handling of GENERATE_MASTER_OBJECT_FILE.
729+
guard !scope.evaluate(BuiltinMacros.GENERATE_MASTER_OBJECT_FILE) else {
730730
return true
731731
}
732732

Sources/SwiftBuild/ProjectModel/BuildSettings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extension ProjectModel {
4040
case GENERATE_INFOPLIST_FILE
4141
case GCC_C_LANGUAGE_STANDARD
4242
case GCC_OPTIMIZATION_LEVEL
43-
case GENERATE_PRELINK_OBJECT_FILE
43+
case GENERATE_MASTER_OBJECT_FILE
4444
case INFOPLIST_FILE
4545
case IPHONEOS_DEPLOYMENT_TARGET
4646
case KEEP_PRIVATE_EXTERNS

0 commit comments

Comments
 (0)