Skip to content

Commit b14220e

Browse files
authored
[lldb][X86] Fix setting target features in ClangExpressionParser (llvm#82364)
Currently, for x86 and x86_64 triples, "+sse" and "+sse2" are appended to `Features` vector of `TargetOptions` unconditionally. This vector is later reset in `TargetInfo::CreateTargetInfo` and filled using info from `FeaturesAsWritten` vector, so previous modifications of the `Features` vector have no effect. For x86_64 triple, we append "sse2" unconditionally in `X86TargetInfo::initFeatureMap`, so despite the `Features` vector reset, we still have the desired sse features enabled. The corresponding code in `X86TargetInfo::initFeatureMap` is marked as FIXME, so we should not probably rely on it and should set desired features properly in `ClangExpressionParser`. This patch changes the vector the features are appended to from `Features` to `FeaturesAsWritten`. It's not reset later and is used to compute resulting `Features` vector.
1 parent 597f976 commit b14220e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ ClangExpressionParser::ClangExpressionParser(
445445
// Supported subsets of x86
446446
if (target_machine == llvm::Triple::x86 ||
447447
target_machine == llvm::Triple::x86_64) {
448-
m_compiler->getTargetOpts().Features.push_back("+sse");
449-
m_compiler->getTargetOpts().Features.push_back("+sse2");
448+
m_compiler->getTargetOpts().FeaturesAsWritten.push_back("+sse");
449+
m_compiler->getTargetOpts().FeaturesAsWritten.push_back("+sse2");
450450
}
451451

452452
// Set the target CPU to generate code for. This will be empty for any CPU

0 commit comments

Comments
 (0)