aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/driver/cc1as_main.cpp
diff options
context:
space:
mode:
authorAlexis Engelke <engelke@in.tum.de>2024-08-14 09:24:07 +0200
committerGitHub <noreply@github.com>2024-08-14 09:24:07 +0200
commitf1cb64b6f07184a3624ebb77f3f0e0bddafea1a4 (patch)
tree57a24b64f2f58b12fa1295888d8f4a87c0071029 /clang/tools/driver/cc1as_main.cpp
parent829992cf21e9220bbf7985073745ee8f09b0b7f1 (diff)
downloadllvm-f1cb64b6f07184a3624ebb77f3f0e0bddafea1a4.zip
llvm-f1cb64b6f07184a3624ebb77f3f0e0bddafea1a4.tar.gz
llvm-f1cb64b6f07184a3624ebb77f3f0e0bddafea1a4.tar.bz2
[MC] Remove Darwin SDK/Version from ObjFileInfo (#103025)
There's only a single user (MCMachOStreamer), so it makes more sense to move the version emission to the source of the data.
Diffstat (limited to 'clang/tools/driver/cc1as_main.cpp')
-rw-r--r--clang/tools/driver/cc1as_main.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index b661a43..78019d3 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -489,10 +489,6 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
// MCObjectFileInfo needs a MCContext reference in order to initialize itself.
std::unique_ptr<MCObjectFileInfo> MOFI(
TheTarget->createMCObjectFileInfo(Ctx, PIC));
- if (Opts.DarwinTargetVariantTriple)
- MOFI->setDarwinTargetVariantTriple(*Opts.DarwinTargetVariantTriple);
- if (!Opts.DarwinTargetVariantSDKVersion.empty())
- MOFI->setDarwinTargetVariantSDKVersion(Opts.DarwinTargetVariantSDKVersion);
Ctx.setObjectFileInfo(MOFI.get());
if (Opts.GenDwarfForAssembly)
@@ -574,6 +570,13 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
Str.reset(TheTarget->createMCObjectStreamer(
T, Ctx, std::move(MAB), std::move(OW), std::move(CE), *STI));
Str.get()->initSections(Opts.NoExecStack, *STI);
+ if (T.isOSBinFormatMachO() && T.isOSDarwin()) {
+ Triple *TVT = Opts.DarwinTargetVariantTriple
+ ? &*Opts.DarwinTargetVariantTriple
+ : nullptr;
+ Str->emitVersionForTarget(T, VersionTuple(), TVT,
+ Opts.DarwinTargetVariantSDKVersion);
+ }
}
// When -fembed-bitcode is passed to clang_as, a 1-byte marker