@@ -271,8 +271,9 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
271
271
bool TrapUnreachable, bool Singlethread, bool VerboseAsm,
272
272
bool EmitStackSizeSection, bool RelaxELFRelocations, bool UseInitArray,
273
273
const char *SplitDwarfFile, const char *OutputObjFile,
274
- const char *DebugInfoCompression, bool UseEmulatedTls,
275
- const char *ArgsCstrBuff, size_t ArgsCstrBuffLen, bool UseWasmEH) {
274
+ const char *DebugInfoCompression, bool UseEmulatedTls, const char *Argv0,
275
+ size_t Argv0Len, const char *CommandLineArgs, size_t CommandLineArgsLen,
276
+ bool UseWasmEH) {
276
277
277
278
auto OptLevel = fromRust (RustOptLevel);
278
279
auto RM = fromRust (RustReloc);
@@ -343,25 +344,10 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
343
344
344
345
Options.EmitStackSizeSection = EmitStackSizeSection;
345
346
346
- if (ArgsCstrBuff != nullptr ) {
347
- size_t buffer_offset = 0 ;
348
- assert (ArgsCstrBuff[ArgsCstrBuffLen - 1 ] == ' \0 ' );
349
- auto Arg0 = std::string (ArgsCstrBuff);
350
- buffer_offset = Arg0.size () + 1 ;
351
-
352
- std::string CommandlineArgs;
353
- raw_string_ostream OS (CommandlineArgs);
354
- ListSeparator LS (" " );
355
- for (StringRef Arg : split (StringRef (ArgsCstrBuff + buffer_offset,
356
- ArgsCstrBuffLen - buffer_offset),
357
- ' \0 ' )) {
358
- OS << LS;
359
- sys::printArg (OS, Arg, /* Quote=*/ true );
360
- }
361
- OS.flush ();
362
- Options.MCOptions .Argv0 = Arg0;
363
- Options.MCOptions .CommandlineArgs = CommandlineArgs;
364
- }
347
+ if (Argv0 != nullptr )
348
+ Options.MCOptions .Argv0 = {Argv0, Argv0Len};
349
+ if (CommandLineArgs != nullptr )
350
+ Options.MCOptions .CommandlineArgs = {CommandLineArgs, CommandLineArgsLen};
365
351
366
352
#if LLVM_VERSION_GE(21, 0)
367
353
TargetMachine *TM = TheTarget->createTargetMachine (Trip, CPU, Feature,
0 commit comments