 // RUN: %empty-directory(%t)
 
-// XFAIL: freebsd, linux
-
-// RUN: %swiftc_driver -driver-print-actions %s 2>&1 | %FileCheck %s -check-prefix=BASIC
+// RUN: %swiftc_driver -driver-print-actions %s 2>&1 | %FileCheck %s -check-prefix=BASIC -check-prefix BASIC-%target-object-format
 // BASIC: 0: input, "{{.*}}actions.swift", swift
 // BASIC: 1: compile, {0}, object
-// BASIC: 2: link, {1}, image
+// BASIC-COFF: 2: link, {1}, image
+// BASIC-ELF: 2: swift-autolink-extract, {1}, autolink
+// BASIC-ELF: 3: link, {1, 2}, image
+// BASIC-MACHO: 2: link, {1}, image
 
 // RUN: %swiftc_driver -driver-print-actions -c %s 2>&1 | %FileCheck %s -check-prefix=BASICC
 // BASICC: 0: input, "{{.*}}actions.swift", swift

// LINK-DEBUG-SWIFTMODULES: 4: input, "{{.*}}/a.swiftmodule", swiftmodule
// LINK-DEBUG-SWIFTMODULES: 5: input, "{{.*}}/b.swiftmodule", swiftmodule
// LINK-DEBUG-SWIFTMODULES: 6: merge-module, {1}, swiftmodule
// LINK-DEBUG-SWIFTMODULES: 7: link, {1, 2, 3, 4, 5, 6}, image

// RUN: touch %t/a.o %t/b.o
// RUN: %swiftc_driver -driver-print-actions %t/a.o %s -o main 2>&1 | %FileCheck %s -check-prefix=COMPILE-PLUS-OBJECT
// COMPILE-PLUS-OBJECT: 0: input, "{{.*}}/a.o", object
// COMPILE-PLUS-OBJECT: 1: input, "{{.*}}actions.swift", swift
// COMPILE-PLUS-OBJECT: 2: compile, {1}, object
// COMPILE-PLUS-OBJECT: 3: link, {0, 2}, image


// RUN: %swiftc_driver -driver-print-actions %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions -force-single-frontend-invocation 2>&1 | %FileCheck %s -check-prefix=WHOLE-MODULE
// WHOLE-MODULE: 0: input, "{{.*}}Inputs/main.swift", swift
// WHOLE-MODULE: 1: input, "{{.*}}Inputs/empty.swift", swift
// WHOLE-MODULE: 2: input, "{{.*}}actions.swift", swift
// WHOLE-MODULE: 3: compile, {0, 1, 2}, object
// WHOLE-MODULE: 4: link, {3}, image

// DEBUG-MULTI: 4: input, "{{.*}}actions.swift", swift
// DEBUG-MULTI: 5: compile, {4}, object
// DEBUG-MULTI: 6: merge-module, {1, 3, 5}, swiftmodule
// DEBUG-MULTI-COFF: 7: modulewrap, {6}, object
// DEBUG-MULTI-COFF: 8: link, {1, 3, 5, 7}, image
// DEBUG-MULTI-ELF: 7: modulewrap, {6}, object
// DEBUG-MULTI-ELF: 8: link, {1, 3, 5, 7}, image
// DEBUG-MULTI-MACHO: 7: link, {1, 3, 5, 6}, image


// RUN: touch %t/a.o %t/b.o
// RUN: %swiftc_driver -driver-print-actions %t/a.o %t/b.o -o main 2>&1 | %FileCheck %s -check-prefix=LINK-ONLY -check-prefix LINK-ONLY-%target-object-format
// RUN: %swiftc_driver -driver-print-actions -g %t/a.o %t/b.o -o main 2>&1 | %FileCheck %s -check-prefix=LINK-ONLY -check-prefix LINK-ONLY-%target-object-format
// LINK-ONLY: 0: input, "{{.*}}/a.o", object
// LINK-ONLY: 1: input, "{{.*}}/b.o", object
// LINK-ONLY-COFF: 2: link, {0, 1}, image
// LINK-ONLY-ELF: 2: swift-autolink-extract, {0, 1}, autolink
// LINK-ONLY-ELF: 3: link, {0, 1, 2}, image
// LINK-ONLY-MACHO: 2: link, {0, 1}, image

// RUN: touch %t/a.swiftmodule %t/b.swiftmodule
// RUN: %swiftc_driver -driver-print-actions -g %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=DEBUG-LINK-ONLY -check-prefix DEBUG-LINK-ONLY-%target-object-format
// DEBUG-LINK-ONLY: 0: input, "{{.*}}/a.o", object
// DEBUG-LINK-ONLY: 1: input, "{{.*}}/b.o", object
// DEBUG-LINK-ONLY: 2: input, "{{.*}}/a.swiftmodule", swiftmodule
// DEBUG-LINK-ONLY: 3: input, "{{.*}}/b.swiftmodule", swiftmodule
// DEBUG-LINK-ONLY-COFF: 4: link, {0, 1, 2, 3}, image
// DEBUG-LINK-ONLY-ELF: 4: swift-autolink-extract, {0, 1, 2, 3}, autolink
// DEBUG-LINK-ONLY-ELF: 4: link, {0, 1, 2, 3, 4}, image
// DEBUG-LINK-ONLY-MACHO: 4: link, {0, 1, 2, 3}, image

// RUN: touch %t/c.swift
// RUN: %swiftc_driver -driver-print-actions %t/c.swift %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=LINK-SWIFTMODULES -check-prefix LINK-SWIFTMODULES-%target-object-format
// LINK-SWIFTMODULES: 0: input, "{{.*}}/c.swift", swift
// LINK-SWIFTMODULES: 1: compile, {0}, object
// LINK-SWIFTMODULES: 2: input, "{{.*}}/a.o", object
// LINK-SWIFTMODULES: 3: input, "{{.*}}/b.o", object
// LINK-SWIFTMODULES: 4: input, "{{.*}}/a.swiftmodule", swiftmodule
// LINK-SWIFTMODULES: 5: input, "{{.*}}/b.swiftmodule", swiftmodule
// LINK-SWIFTMODULES-COFF: 6: link, {1, 2, 3, 4, 5}, image
// LINK-SWIFTMODULES-ELF: 6: swift-autolink-extract, {1, 2, 3, 4, 5}, autolink
// LINK-SWIFTMODULES-ELF: 6: link, {1, 2, 3, 4, 5, 6}, image
// LINK-SWIFTMODULES-MACHO: 6: link, {1, 2, 3, 4, 5}, image

// RUN: %swiftc_driver -driver-print-actions -g %t/c.swift %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=LINK-DEBUG-SWIFTMODULES -check-prefix LINK-DEBUG-SWIFTMODULES-%target-object-format
// LINK-DEBUG-SWIFTMODULES: 0: input, "{{.*}}/c.swift", swift
// LINK-DEBUG-SWIFTMODULES: 1: compile, {0}, object
// LINK-DEBUG-SWIFTMODULES: 2: input, "{{.*}}/a.o", object
