1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift open source project
//
// Copyright (c) 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
(
{
Domain = generic-unix;
Identifier = "com.apple.pbx.linkers.ld";
Type = Linker;
BasedOn = "default:com.apple.pbx.linkers.ld";
Name = Ld;
Description = "Link executable using alternate linker";
IsAbstract = Yes;
SupportsInputFileList = No;
EnvironmentVariables = {
// /usr/bin is needed for clang to find ld
"PATH" = "$(PLATFORM_DEVELOPER_BIN_DIR):$(PATH):/usr/bin";
};
Options = (
{
Name = "CLANG_MACH_O_TYPE";
Type = Enumeration;
Values = (
{
Value = "mh_execute";
CommandLineFlag = "";
},
{
Value = "mh_dylib";
CommandLineFlag = "-shared";
},
{
Value = "mh_bundle";
CommandLineFlag = "-bundle";
},
{
Value = "mh_object";
CommandLineFlag = "-r";
},
);
Condition = "$(LINKER_DRIVER) == clang";
DefaultValue = "$(MACH_O_TYPE)";
},
// We can inherit SWIFTC_MACHO_TYPE from the universal platform Ld.xcspec
{
Name = CLANG_SDKROOT_LINKER_INPUT;
Type = Path;
DefaultValue = "$(SDKROOT)";
Condition = "$(LINKER_DRIVER) == clang";
CommandLineFlag = "--sysroot";
IsInputDependency = Yes;
},
{
Name = SWIFTC_SDKROOT_LINKER_INPUT;
Type = Path;
DefaultValue = "$(SDKROOT)";
Condition = "$(LINKER_DRIVER) == swiftc";
CommandLineFlag = "-sysroot";
IsInputDependency = Yes;
},
{
Name = "LD_DYLIB_INSTALL_NAME";
Type = String;
DefaultValue = "";
CommandLineArgs = (
"-Xlinker",
"-soname",
"-Xlinker",
"$(value)",
);
Condition = "$(MACH_O_TYPE) == mh_dylib";
},
// Override the differentiated settings to no-ops, both linker drivers use the same flags.
{
Name = "CLANG_LD_DYLIB_INSTALL_NAME";
Type = String;
Condition = "NO";
},
{
Name = "SWIFTC_LD_DYLIB_INSTALL_NAME";
Type = String;
Condition = "NO";
},
{
Name = GOLD_BUILDID;
Type = Boolean;
DefaultValue = YES;
CommandLineArgs = {
YES = (
"-Xlinker",
"--build-id",
);
NO = ();
};
Condition = "$(ALTERNATE_LINKER) == gold";
},
{
// Frameworks are Mac specific
Name = "SYSTEM_FRAMEWORK_SEARCH_PATHS";
Type = PathList;
Condition = "NO";
},
{
// Frameworks are Mac specific
Name = "FRAMEWORK_SEARCH_PATHS";
Type = PathList;
Condition = "NO";
},
{
// Frameworks are Mac specific
Name = "PRODUCT_TYPE_FRAMEWORK_SEARCH_PATHS";
Type = PathList;
Condition = "NO";
},
{
// Frameworks are Mac specific
Name = "TEST_FRAMEWORK_SEARCH_PATHS";
Type = PathList;
Condition = "NO";
},
{
// The LTO object file is Mach-O specific
Name = "LD_LTO_OBJECT_FILE";
Type = Path;
Condition = "NO";
},
{
// Mach-O specific
Name = "LD_FINAL_OUTPUT_FILE";
Type = Path;
Condition = "NO";
},
{
// Unsupported
Name = "LD_WARN_DUPLICATE_LIBRARIES";
Type = Boolean;
Condition = "NO";
},
{
// Don't deduplicate is broken in gold
Name = "LD_DONT_RUN_DEDUPLICATION";
Type = Boolean;
DefaultValue = YES;
Condition = "NO";
},
{
Name = "__INPUT_FILE_LIST_PATH__";
Type = Path;
DefaultValue = "$(LINK_FILE_LIST_$(variant)_$(arch))";
CommandLineArgs = (
"@$(value)",
);
IsInputDependency = Yes;
},
// Override the differentiated settings to no-ops, both linker drivers use the same flags.
{
Name = "CLANG__INPUT_FILE_LIST_PATH__";
Type = Path;
Condition = "NO";
},
{
Name = "SWIFTC__INPUT_FILE_LIST_PATH__";
Type = Path;
Condition = "NO";
}
);
},
)
|