Skip to content

Commit c41d403

Browse files
committed
---
yaml --- r: 349366 b: refs/heads/master-next c: 558bb50 h: refs/heads/master
1 parent c7813eb commit c41d403

File tree

6 files changed

+34
-11
lines changed

6 files changed

+34
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: 0d74b5c71c410ac59b5a77c31620a5fe7e4ab628
3+
refs/heads/master-next: 558bb50560329352fce421203afdc8d7408070dc
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/lib/Driver/Driver.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,18 @@ static void validateSearchPathArgs(DiagnosticEngine &diags,
206206
}
207207

208208
static void validateAutolinkingArgs(DiagnosticEngine &diags,
209-
const ArgList &args) {
209+
const ArgList &args,
210+
const llvm::Triple &T) {
210211
auto *forceLoadArg = args.getLastArg(options::OPT_autolink_force_load);
211212
if (!forceLoadArg)
212213
return;
213214
auto *incrementalArg = args.getLastArg(options::OPT_incremental);
214215
if (!incrementalArg)
215216
return;
216217

218+
if (T.supportsCOMDAT())
219+
return;
220+
217221
// Note: -incremental can itself be overridden by other arguments later
218222
// on, but since -autolink-force-load is a rare and not-really-recommended
219223
// option it's not worth modeling that complexity here (or moving the
@@ -223,14 +227,15 @@ static void validateAutolinkingArgs(DiagnosticEngine &diags,
223227
}
224228

225229
/// Perform miscellaneous early validation of arguments.
226-
static void validateArgs(DiagnosticEngine &diags, const ArgList &args) {
230+
static void validateArgs(DiagnosticEngine &diags, const ArgList &args,
231+
const llvm::Triple &T) {
227232
validateBridgingHeaderArgs(diags, args);
228233
validateWarningControlArgs(diags, args);
229234
validateProfilingArgs(diags, args);
230235
validateDebugInfoArgs(diags, args);
231236
validateCompilationConditionArgs(diags, args);
232237
validateSearchPathArgs(diags, args);
233-
validateAutolinkingArgs(diags, args);
238+
validateAutolinkingArgs(diags, args, T);
234239
}
235240

236241
std::unique_ptr<ToolChain>
@@ -783,7 +788,7 @@ Driver::buildCompilation(const ToolChain &TC,
783788
std::unique_ptr<DerivedArgList> TranslatedArgList(
784789
translateInputAndPathArgs(*ArgList, workingDirectory));
785790

786-
validateArgs(Diags, *TranslatedArgList);
791+
validateArgs(Diags, *TranslatedArgList, TC.getTriple());
787792

788793
// Perform toolchain specific args validation.
789794
TC.validateArguments(Diags, *TranslatedArgList);

branches/master-next/lib/IRGen/IRGenModule.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,14 +1186,17 @@ void IRGenModule::emitAutolinkInfo() {
11861186
}
11871187

11881188
if (!IRGen.Opts.ForceLoadSymbolName.empty() &&
1189-
isFirstObjectFileInModule(*this)) {
1189+
(Triple.supportsCOMDAT() || isFirstObjectFileInModule(*this))) {
11901190
llvm::SmallString<64> buf;
11911191
encodeForceLoadSymbolName(buf, IRGen.Opts.ForceLoadSymbolName);
11921192
auto ForceImportThunk =
11931193
llvm::Function::Create(llvm::FunctionType::get(VoidTy, false),
11941194
llvm::GlobalValue::ExternalLinkage, buf,
11951195
&Module);
11961196
ApplyIRLinkage(IRLinkage::ExternalExport).to(ForceImportThunk);
1197+
if (Triple.supportsCOMDAT())
1198+
if (auto *GO = cast<llvm::GlobalObject>(ForceImportThunk))
1199+
GO->setComdat(Module.getOrInsertComdat(ForceImportThunk->getName()));
11971200

11981201
auto BB = llvm::BasicBlock::Create(getLLVMContext(), "", ForceImportThunk);
11991202
llvm::IRBuilder<> IRB(BB);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %swiftc_driver -incremental -autolink-force-load %s 2>&1 | %FileCheck -check-prefix=AUTOLINK_FORCE_LOAD %s
2+
// RUN: %swiftc_driver -autolink-force-load -incremental %s 2>&1 | %FileCheck -check-prefix=AUTOLINK_FORCE_LOAD %s
3+
4+
// MACHO targets do not support COMDAT
5+
// UNSUPPORTED: OS=macosx
6+
// UNSUPPORTED: OS=tvos
7+
// UNSUPPORTED: OS=watchos
8+
// UNSUPPORTED: OS=ios
9+
10+
// AUTOLINK_FORCE_LOAD-NOT: error: '-autolink-force-load' is not supported with '-incremental'
11+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: not %swiftc_driver -incremental -autolink-force-load %s 2>&1 | %FileCheck -check-prefix=AUTOLINK_FORCE_LOAD %s
2+
// RUN: not %swiftc_driver -autolink-force-load -incremental %s 2>&1 | %FileCheck -check-prefix=AUTOLINK_FORCE_LOAD %s
3+
4+
// MACHO targets do not support COMDAT
5+
// REQUIRES-ANY: OS=macosx, OS=tvos, OS=watchos, OS=ios
6+
7+
// AUTOLINK_FORCE_LOAD: error: '-autolink-force-load' is not supported with '-incremental'
8+

branches/master-next/test/Driver/options.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@
101101
// ASSUME_SINGLE_THREADED: swift
102102
// ASSUME_SINGLE_THREADED: -frontend {{.*}} -assume-single-threaded
103103

104-
// RUN: not %swiftc_driver -incremental -autolink-force-load %s 2>&1 | %FileCheck -check-prefix=AUTOLINK_FORCE_LOAD %s
105-
// RUN: not %swiftc_driver -autolink-force-load -incremental %s 2>&1 | %FileCheck -check-prefix=AUTOLINK_FORCE_LOAD %s
106-
// AUTOLINK_FORCE_LOAD: error: '-autolink-force-load' is not supported with '-incremental'
107-
108104
// RUN: %swift_driver -### -g -debug-info-format=codeview %s | %FileCheck -check-prefix DEBUG_INFO_FORMAT_CODEVIEW %s
109105
// RUN: %swift_driver -### -g -debug-info-format=dwarf %s | %FileCheck -check-prefix DEBUG_INFO_FORMAT_DWARF %s
110106
// RUN: %swiftc_driver -### -g -debug-info-format=codeview %s | %FileCheck -check-prefix DEBUG_INFO_FORMAT_CODEVIEW %s
@@ -132,4 +128,4 @@
132128
// RUN: %swiftc_driver -F %t/test.framework/ %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
133129
// RUN: %swift_driver -Fsystem %t/test.framework/ %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
134130
// RUN: %swiftc_driver -Fsystem %t/test.framework/ %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
135-
// SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION: warning: framework search path ends in ".framework"
131+
// SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION: warning: framework search path ends in ".framework"

0 commit comments

Comments
 (0)