@@ -219,7 +219,7 @@ void LinkerDriver::addBuffer(std::unique_ptr<MemoryBuffer> mb,
219
219
make<std::unique_ptr<Archive>>(std::move (file)); // take ownership
220
220
221
221
int memberIndex = 0 ;
222
- for (MemoryBufferRef m : getArchiveMembers (archive))
222
+ for (MemoryBufferRef m : getArchiveMembers (ctx, archive))
223
223
addArchiveBuffer (m, " <whole-archive>" , filename, memberIndex++);
224
224
return ;
225
225
}
@@ -1033,8 +1033,8 @@ void LinkerDriver::createImportLibrary(bool asLib) {
1033
1033
SmallString<128 > tmpName;
1034
1034
if (std::error_code ec =
1035
1035
sys::fs::createUniqueFile (path + " .tmp-%%%%%%%%.lib" , tmpName))
1036
- fatal ( " cannot create temporary file for import library " + path + " : " +
1037
- ec.message () );
1036
+ Fatal (ctx) << " cannot create temporary file for import library " << path
1037
+ << " : " << ec.message ();
1038
1038
1039
1039
if (Error e = writeImportLibrary (libName, tmpName, exports,
1040
1040
ctx.config .machine , ctx.config .mingw )) {
@@ -1233,11 +1233,11 @@ static void readCallGraphsFromObjectFiles(COFFLinkerContext &ctx) {
1233
1233
uint32_t fromIndex, toIndex;
1234
1234
uint64_t count;
1235
1235
if (Error err = reader.readInteger (fromIndex))
1236
- fatal ( toString (obj) + " : Expected 32-bit integer" ) ;
1236
+ Fatal (ctx) << toString (obj) << " : Expected 32-bit integer" ;
1237
1237
if (Error err = reader.readInteger (toIndex))
1238
- fatal ( toString (obj) + " : Expected 32-bit integer" ) ;
1238
+ Fatal (ctx) << toString (obj) << " : Expected 32-bit integer" ;
1239
1239
if (Error err = reader.readInteger (count))
1240
- fatal ( toString (obj) + " : Expected 64-bit integer" ) ;
1240
+ Fatal (ctx) << toString (obj) << " : Expected 64-bit integer" ;
1241
1241
auto *fromSym = dyn_cast_or_null<Defined>(obj->getSymbol (fromIndex));
1242
1242
auto *toSym = dyn_cast_or_null<Defined>(obj->getSymbol (toIndex));
1243
1243
if (!fromSym || !toSym)
@@ -1279,9 +1279,11 @@ static void findKeepUniqueSections(COFFLinkerContext &ctx) {
1279
1279
const char *err = nullptr ;
1280
1280
uint64_t symIndex = decodeULEB128 (cur, &size, contents.end (), &err);
1281
1281
if (err)
1282
- fatal (toString (obj) + " : could not decode addrsig section: " + err);
1282
+ Fatal (ctx) << toString (obj)
1283
+ << " : could not decode addrsig section: " << err;
1283
1284
if (symIndex >= syms.size ())
1284
- fatal (toString (obj) + " : invalid symbol index in addrsig section" );
1285
+ Fatal (ctx) << toString (obj)
1286
+ << " : invalid symbol index in addrsig section" ;
1285
1287
markAddrsig (syms[symIndex]);
1286
1288
cur += size;
1287
1289
}
@@ -1574,7 +1576,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
1574
1576
(StringRef (argsArr[1 ]).equals_insensitive (" /lib" ) ||
1575
1577
StringRef (argsArr[1 ]).equals_insensitive (" -lib" ))) {
1576
1578
if (llvm::libDriverMain (argsArr.slice (1 )) != 0 )
1577
- fatal ( " lib failed" ) ;
1579
+ Fatal (ctx) << " lib failed" ;
1578
1580
return ;
1579
1581
}
1580
1582
@@ -1676,7 +1678,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
1676
1678
if (args.hasArg (OPT_deffile))
1677
1679
config->noEntry = true ;
1678
1680
else
1679
- fatal ( " no input files" ) ;
1681
+ Fatal (ctx) << " no input files" ;
1680
1682
}
1681
1683
1682
1684
// Construct search path list.
@@ -1887,7 +1889,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
1887
1889
if (auto *arg = args.getLastArg (OPT_machine)) {
1888
1890
config->machine = getMachineType (arg->getValue ());
1889
1891
if (config->machine == IMAGE_FILE_MACHINE_UNKNOWN)
1890
- fatal ( Twine ( " unknown /machine argument: " ) + arg->getValue () );
1892
+ Fatal (ctx) << " unknown /machine argument: " << arg->getValue ();
1891
1893
addWinSysRootLibSearchPaths ();
1892
1894
}
1893
1895
}
@@ -1955,17 +1957,17 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
1955
1957
config->repro = false ;
1956
1958
StringRef value (arg->getValue ());
1957
1959
if (value.getAsInteger (0 , config->timestamp ))
1958
- fatal ( Twine ( " invalid timestamp: " ) + value +
1959
- " . Expected 32-bit integer" ) ;
1960
+ Fatal (ctx) << " invalid timestamp: " << value
1961
+ << " . Expected 32-bit integer" ;
1960
1962
}
1961
1963
} else {
1962
1964
config->repro = false ;
1963
1965
if (std::optional<std::string> epoch =
1964
1966
Process::GetEnv (" SOURCE_DATE_EPOCH" )) {
1965
1967
StringRef value (*epoch);
1966
1968
if (value.getAsInteger (0 , config->timestamp ))
1967
- fatal ( Twine ( " invalid SOURCE_DATE_EPOCH timestamp: " ) + value +
1968
- " . Expected 32-bit integer" ) ;
1969
+ Fatal (ctx) << " invalid SOURCE_DATE_EPOCH timestamp: " << value
1970
+ << " . Expected 32-bit integer" ;
1969
1971
} else {
1970
1972
config->timestamp = time (nullptr );
1971
1973
}
@@ -2155,7 +2157,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
2155
2157
2156
2158
if (!config->manifestInput .empty () &&
2157
2159
config->manifest != Configuration::Embed) {
2158
- fatal ( " /manifestinput: requires /manifest:embed" ) ;
2160
+ Fatal (ctx) << " /manifestinput: requires /manifest:embed" ;
2159
2161
}
2160
2162
2161
2163
// Handle /dwodir
@@ -2400,15 +2402,15 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
2400
2402
llvm::TimeTraceScope timeScope (" Infer subsystem" );
2401
2403
config->subsystem = inferSubsystem ();
2402
2404
if (config->subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
2403
- fatal ( " subsystem must be defined" ) ;
2405
+ Fatal (ctx) << " subsystem must be defined" ;
2404
2406
}
2405
2407
2406
2408
// Handle /entry and /dll
2407
2409
{
2408
2410
llvm::TimeTraceScope timeScope (" Entry point" );
2409
2411
if (auto *arg = args.getLastArg (OPT_entry)) {
2410
2412
if (!arg->getValue ()[0 ])
2411
- fatal ( " missing entry point symbol name" ) ;
2413
+ Fatal (ctx) << " missing entry point symbol name" ;
2412
2414
config->entry = addUndefined (mangle (arg->getValue ()), true );
2413
2415
} else if (!config->entry && !config->noEntry ) {
2414
2416
if (args.hasArg (OPT_dll)) {
@@ -2423,7 +2425,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
2423
2425
// infer that from user-defined entry name.
2424
2426
StringRef s = findDefaultEntry ();
2425
2427
if (s.empty ())
2426
- fatal ( " entry point must be defined" ) ;
2428
+ Fatal (ctx) << " entry point must be defined" ;
2427
2429
config->entry = addUndefined (s, true );
2428
2430
Log (ctx) << " Entry name inferred: " << s;
2429
2431
}
0 commit comments