@@ -101,6 +101,9 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
101101
102102 // Target Options
103103 Opts.Triple = llvm::Triple::normalize (Args.getLastArgValue (OPT_triple));
104+ if (Arg *A = Args.getLastArg (options::OPT_darwin_target_variant_triple))
105+ Opts.DarwinTargetVariantTriple = llvm::Triple (A->getValue ());
106+
104107 Opts.CPU = std::string (Args.getLastArgValue (OPT_target_cpu));
105108 Opts.Features = Args.getAllArgValues (OPT_target_feature);
106109
@@ -203,6 +206,14 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
203206 .Default (0 );
204207 }
205208
209+ if (auto *A = Args.getLastArg (OPT_femit_dwarf_unwind_EQ)) {
210+ Opts.EmitDwarfUnwind =
211+ llvm::StringSwitch<EmitDwarfUnwindType>(A->getValue ())
212+ .Case (" always" , EmitDwarfUnwindType::Always)
213+ .Case (" no-compact-unwind" , EmitDwarfUnwindType::NoCompactUnwind)
214+ .Case (" default" , EmitDwarfUnwindType::Default);
215+ }
216+
206217 return Success;
207218}
208219
@@ -253,6 +264,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
253264 assert (MRI && " Unable to create target register info!" );
254265
255266 MCTargetOptions MCOptions;
267+ MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind ;
268+
256269 std::unique_ptr<MCAsmInfo> MAI (
257270 TheTarget->createMCAsmInfo (*MRI, Opts.Triple , MCOptions));
258271 assert (MAI && " Unable to create target asm info!" );
@@ -299,6 +312,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
299312 // MCObjectFileInfo needs a MCContext reference in order to initialize itself.
300313 std::unique_ptr<MCObjectFileInfo> MOFI (
301314 TheTarget->createMCObjectFileInfo (Ctx, PIC));
315+ if (Opts.DarwinTargetVariantTriple )
316+ MOFI->setDarwinTargetVariantTriple (*Opts.DarwinTargetVariantTriple );
302317 Ctx.setObjectFileInfo (MOFI.get ());
303318
304319 if (Opts.SaveTemporaryLabels )
@@ -347,7 +362,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
347362
348363 std::unique_ptr<MCCodeEmitter> CE;
349364 if (Opts.ShowEncoding )
350- CE.reset (TheTarget->createMCCodeEmitter (*MCII, *MRI, Ctx));
365+ CE.reset (TheTarget->createMCCodeEmitter (*MCII, Ctx));
351366 std::unique_ptr<MCAsmBackend> MAB (
352367 TheTarget->createMCAsmBackend (*STI, *MRI, MCOptions));
353368
@@ -367,7 +382,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
367382 }
368383
369384 std::unique_ptr<MCCodeEmitter> CE (
370- TheTarget->createMCCodeEmitter (*MCII, *MRI, Ctx));
385+ TheTarget->createMCCodeEmitter (*MCII, Ctx));
371386 std::unique_ptr<MCAsmBackend> MAB (
372387 TheTarget->createMCAsmBackend (*STI, *MRI, MCOptions));
373388 assert (MAB && " Unable to create asm backend!" );
@@ -389,7 +404,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
389404 if (Opts.EmbedBitcode && Ctx.getObjectFileType () == MCContext::IsMachO) {
390405 MCSection *AsmLabel = Ctx.getMachOSection (
391406 " __LLVM" , " __asm" , MachO::S_REGULAR, 4 , SectionKind::getReadOnly ());
392- Str.get ()->SwitchSection (AsmLabel);
407+ Str.get ()->switchSection (AsmLabel);
393408 Str.get ()->emitZeros (1 );
394409 }
395410
0 commit comments