@@ -1427,15 +1427,12 @@ static bool isSDKTooOld(StringRef sdkPath, const llvm::Triple &target) {
1427
1427
void Driver::buildOutputInfo (const ToolChain &TC, const DerivedArgList &Args,
1428
1428
const bool BatchMode, const InputFileList &Inputs,
1429
1429
OutputInfo &OI) const {
1430
- auto LinkerInputType = Args.hasArg (options::OPT_lto)
1431
- ? file_types::TY_LLVM_BC
1432
- : file_types::TY_Object;
1433
1430
// By default, the driver does not link its output; this will be updated
1434
1431
// appropriately below if linking is required.
1435
1432
1436
1433
OI.CompilerOutputType = driverKind == DriverKind::Interactive
1437
1434
? file_types::TY_Nothing
1438
- : LinkerInputType ;
1435
+ : file_types::TY_Object ;
1439
1436
1440
1437
if (const Arg *A = Args.getLastArg (options::OPT_num_threads)) {
1441
1438
if (BatchMode) {
@@ -1465,14 +1462,14 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
1465
1462
diag::error_static_emit_executable_disallowed);
1466
1463
1467
1464
OI.LinkAction = LinkKind::Executable;
1468
- OI.CompilerOutputType = LinkerInputType ;
1465
+ OI.CompilerOutputType = file_types::TY_Object ;
1469
1466
break ;
1470
1467
1471
1468
case options::OPT_emit_library:
1472
1469
OI.LinkAction = Args.hasArg (options::OPT_static) ?
1473
1470
LinkKind::StaticLibrary :
1474
1471
LinkKind::DynamicLibrary;
1475
- OI.CompilerOutputType = LinkerInputType ;
1472
+ OI.CompilerOutputType = file_types::TY_Object ;
1476
1473
break ;
1477
1474
1478
1475
case options::OPT_static:
@@ -1782,18 +1779,6 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
1782
1779
1783
1780
}
1784
1781
1785
- if (const Arg *A = Args.getLastArg (options::OPT_lto)) {
1786
- auto LTOVariant = llvm::StringSwitch<Optional<OutputInfo::LTOKind>>(A->getValue ())
1787
- .Case (" llvm" , OutputInfo::LTOKind::LLVMThin)
1788
- .Case (" llvm-full" , OutputInfo::LTOKind::LLVMFull)
1789
- .Default (llvm::None);
1790
- if (LTOVariant)
1791
- OI.LTOVariant = LTOVariant.getValue ();
1792
- else
1793
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
1794
- A->getAsString (Args), A->getValue ());
1795
- }
1796
-
1797
1782
if (TC.getTriple ().isOSWindows ()) {
1798
1783
if (const Arg *A = Args.getLastArg (options::OPT_libc)) {
1799
1784
OI.RuntimeVariant =
@@ -2128,17 +2113,15 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
2128
2113
MergeModuleAction = C.createAction <MergeModuleJobAction>(AllModuleInputs);
2129
2114
}
2130
2115
2131
- auto PerformLTO = Args.hasArg (options::OPT_lto);
2132
2116
if (OI.shouldLink () && !AllLinkerInputs.empty ()) {
2133
2117
JobAction *LinkAction = nullptr ;
2134
2118
2135
2119
if (OI.LinkAction == LinkKind::StaticLibrary) {
2136
2120
LinkAction = C.createAction <StaticLinkJobAction>(AllLinkerInputs,
2137
- OI.LinkAction );
2121
+ OI.LinkAction );
2138
2122
} else {
2139
2123
LinkAction = C.createAction <DynamicLinkJobAction>(AllLinkerInputs,
2140
- OI.LinkAction ,
2141
- PerformLTO);
2124
+ OI.LinkAction );
2142
2125
}
2143
2126
2144
2127
// On ELF platforms there's no built in autolinking mechanism, so we
@@ -2147,7 +2130,7 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
2147
2130
const auto &Triple = TC.getTriple ();
2148
2131
SmallVector<const Action *, 2 > AutolinkExtractInputs;
2149
2132
for (const Action *A : AllLinkerInputs)
2150
- if (A->getType () == OI. CompilerOutputType ) {
2133
+ if (A->getType () == file_types::TY_Object ) {
2151
2134
// Shared objects on ELF platforms don't have a swift1_autolink_entries
2152
2135
// section in them because the section in the .o files is marked as
2153
2136
// SHF_EXCLUDE.
@@ -2163,7 +2146,7 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
2163
2146
(Triple.getObjectFormat () == llvm::Triple::ELF && !Triple.isPS4 ()) ||
2164
2147
Triple.getObjectFormat () == llvm::Triple::Wasm ||
2165
2148
Triple.isOSCygMing ();
2166
- if (!AutolinkExtractInputs.empty () && AutolinkExtractRequired && !PerformLTO ) {
2149
+ if (!AutolinkExtractInputs.empty () && AutolinkExtractRequired) {
2167
2150
auto *AutolinkExtractAction =
2168
2151
C.createAction <AutolinkExtractJobAction>(AutolinkExtractInputs);
2169
2152
// Takes the same inputs as the linker...
0 commit comments