Skip to content

Commit e434634

Browse files
committed
[llvm] Fix the MCSubtargetInfo used for module-level assembly.
Provide both the default target CPU and default target features from the module's context, rather than empty strings. Fixes llvm#61991.
1 parent c67653f commit e434634

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/lib/Object/ModuleSymbolTable.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "llvm/IR/GlobalValue.h"
2323
#include "llvm/IR/GlobalVariable.h"
2424
#include "llvm/IR/InlineAsm.h"
25+
#include "llvm/IR/LLVMContext.h"
2526
#include "llvm/IR/Module.h"
2627
#include "llvm/MC/MCAsmInfo.h"
2728
#include "llvm/MC/MCContext.h"
@@ -92,8 +93,11 @@ initializeRecordStreamer(const Module &M,
9293
if (!MAI)
9394
return;
9495

96+
LLVMContext &Context = M.getContext();
97+
9598
std::unique_ptr<MCSubtargetInfo> STI(
96-
T->createMCSubtargetInfo(TT.str(), "", ""));
99+
T->createMCSubtargetInfo(TT.str(), Context.getDefaultTargetCPU(),
100+
Context.getDefaultTargetFeatures()));
97101
if (!STI)
98102
return;
99103

0 commit comments

Comments
 (0)