@@ -96,10 +96,6 @@ struct AssemblerInvocation {
9696 LLVM_PREFERRED_TYPE (bool )
9797 unsigned GenDwarfForAssembly : 1 ;
9898 LLVM_PREFERRED_TYPE (bool )
99- unsigned RelaxELFRelocations : 1 ;
100- LLVM_PREFERRED_TYPE (bool )
101- unsigned SSE2AVX : 1 ;
102- LLVM_PREFERRED_TYPE (bool )
10399 unsigned Dwarf64 : 1 ;
104100 unsigned DwarfVersion;
105101 std::string DwarfDebugFlags;
@@ -168,6 +164,13 @@ struct AssemblerInvocation {
168164
169165 LLVM_PREFERRED_TYPE (bool )
170166 unsigned Crel : 1 ;
167+ LLVM_PREFERRED_TYPE (bool )
168+ unsigned ImplicitMapsyms : 1 ;
169+
170+ LLVM_PREFERRED_TYPE (bool )
171+ unsigned X86RelaxRelocations : 1 ;
172+ LLVM_PREFERRED_TYPE (bool )
173+ unsigned X86Sse2Avx : 1 ;
171174
172175 // / The name of the relocation model to use.
173176 std::string RelocationModel;
@@ -199,7 +202,6 @@ struct AssemblerInvocation {
199202 ShowInst = 0 ;
200203 ShowEncoding = 0 ;
201204 RelaxAll = 0 ;
202- SSE2AVX = 0 ;
203205 NoExecStack = 0 ;
204206 FatalWarnings = 0 ;
205207 NoWarn = 0 ;
@@ -211,6 +213,9 @@ struct AssemblerInvocation {
211213 EmitDwarfUnwind = EmitDwarfUnwindType::Default;
212214 EmitCompactUnwindNonCanonical = false ;
213215 Crel = false ;
216+ ImplicitMapsyms = 0 ;
217+ X86RelaxRelocations = 0 ;
218+ X86Sse2Avx = 0 ;
214219 }
215220
216221 static bool CreateFromArgs (AssemblerInvocation &Res,
@@ -290,8 +295,6 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
290295 .Default (llvm::DebugCompressionType::None);
291296 }
292297
293- Opts.RelaxELFRelocations = !Args.hasArg (OPT_mrelax_relocations_no);
294- Opts.SSE2AVX = Args.hasArg (OPT_msse2avx);
295298 if (auto *DwarfFormatArg = Args.getLastArg (OPT_gdwarf64, OPT_gdwarf32))
296299 Opts.Dwarf64 = DwarfFormatArg->getOption ().matches (OPT_gdwarf64);
297300 Opts.DwarfVersion = getLastArgIntValue (Args, OPT_dwarf_version_EQ, 2 , Diags);
@@ -382,6 +385,9 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
382385 Opts.EmitCompactUnwindNonCanonical =
383386 Args.hasArg (OPT_femit_compact_unwind_non_canonical);
384387 Opts.Crel = Args.hasArg (OPT_crel);
388+ Opts.ImplicitMapsyms = Args.hasArg (OPT_mmapsyms_implicit);
389+ Opts.X86RelaxRelocations = !Args.hasArg (OPT_mrelax_relocations_no);
390+ Opts.X86Sse2Avx = Args.hasArg (OPT_msse2avx);
385391
386392 Opts.AsSecureLogFile = Args.getLastArgValue (OPT_as_secure_log_file);
387393
@@ -440,8 +446,9 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
440446 MCOptions.EmitCompactUnwindNonCanonical = Opts.EmitCompactUnwindNonCanonical ;
441447 MCOptions.MCSaveTempLabels = Opts.SaveTemporaryLabels ;
442448 MCOptions.Crel = Opts.Crel ;
443- MCOptions.X86RelaxRelocations = Opts.RelaxELFRelocations ;
444- MCOptions.X86Sse2Avx = Opts.SSE2AVX ;
449+ MCOptions.ImplicitMapSyms = Opts.ImplicitMapsyms ;
450+ MCOptions.X86RelaxRelocations = Opts.X86RelaxRelocations ;
451+ MCOptions.X86Sse2Avx = Opts.X86Sse2Avx ;
445452 MCOptions.CompressDebugSections = Opts.CompressDebugSections ;
446453 MCOptions.AsSecureLogFile = Opts.AsSecureLogFile ;
447454
@@ -489,10 +496,6 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
489496 // MCObjectFileInfo needs a MCContext reference in order to initialize itself.
490497 std::unique_ptr<MCObjectFileInfo> MOFI (
491498 TheTarget->createMCObjectFileInfo (Ctx, PIC));
492- if (Opts.DarwinTargetVariantTriple )
493- MOFI->setDarwinTargetVariantTriple (*Opts.DarwinTargetVariantTriple );
494- if (!Opts.DarwinTargetVariantSDKVersion .empty ())
495- MOFI->setDarwinTargetVariantSDKVersion (Opts.DarwinTargetVariantSDKVersion );
496499 Ctx.setObjectFileInfo (MOFI.get ());
497500
498501 if (Opts.GenDwarfForAssembly )
@@ -574,6 +577,13 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
574577 Str.reset (TheTarget->createMCObjectStreamer (
575578 T, Ctx, std::move (MAB), std::move (OW), std::move (CE), *STI));
576579 Str.get ()->initSections (Opts.NoExecStack , *STI);
580+ if (T.isOSBinFormatMachO () && T.isOSDarwin ()) {
581+ Triple *TVT = Opts.DarwinTargetVariantTriple
582+ ? &*Opts.DarwinTargetVariantTriple
583+ : nullptr ;
584+ Str->emitVersionForTarget (T, VersionTuple (), TVT,
585+ Opts.DarwinTargetVariantSDKVersion );
586+ }
577587 }
578588
579589 // When -fembed-bitcode is passed to clang_as, a 1-byte marker
0 commit comments