[BOLT][DWARF][NFC] Move Arch assignment out of createBinaryContext (#102054)
Moves the assignment of Arch out of createBinaryContext to prevent data races when parallelized.
This commit is contained in:
@@ -142,7 +142,6 @@ BinaryContext::BinaryContext(std::unique_ptr<MCContext> Ctx,
|
||||
InstPrinter(std::move(InstPrinter)), MIA(std::move(MIA)),
|
||||
MIB(std::move(MIB)), MRI(std::move(MRI)), DisAsm(std::move(DisAsm)),
|
||||
Logger(Logger), InitialDynoStats(isAArch64()) {
|
||||
Relocation::Arch = this->TheTriple->getArch();
|
||||
RegularPageSize = isAArch64() ? RegularPageSizeAArch64 : RegularPageSizeX86;
|
||||
PageAlign = opts::NoHugePages ? RegularPageSize : HugePageSize;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ MachORewriteInstance::MachORewriteInstance(object::MachOObjectFile *InputFile,
|
||||
StringRef ToolPath, Error &Err)
|
||||
: InputFile(InputFile), ToolPath(ToolPath) {
|
||||
ErrorAsOutParameter EAO(&Err);
|
||||
Relocation::Arch = InputFile->makeTriple().getArch();
|
||||
auto BCOrErr = BinaryContext::createBinaryContext(
|
||||
InputFile->makeTriple(), InputFile->getFileName(), nullptr,
|
||||
/* IsPIC */ true, DWARFContext::create(*InputFile),
|
||||
|
||||
@@ -354,6 +354,7 @@ RewriteInstance::RewriteInstance(ELFObjectFileBase *File, const int Argc,
|
||||
}
|
||||
}
|
||||
|
||||
Relocation::Arch = TheTriple.getArch();
|
||||
auto BCOrErr = BinaryContext::createBinaryContext(
|
||||
TheTriple, File->getFileName(), Features.get(), IsPIC,
|
||||
DWARFContext::create(*File, DWARFContext::ProcessDebugRelocations::Ignore,
|
||||
|
||||
@@ -46,6 +46,7 @@ protected:
|
||||
}
|
||||
|
||||
void initializeBOLT() {
|
||||
Relocation::Arch = ObjFile->makeTriple().getArch();
|
||||
BC = cantFail(BinaryContext::createBinaryContext(
|
||||
ObjFile->makeTriple(), ObjFile->getFileName(), nullptr, true,
|
||||
DWARFContext::create(*ObjFile.get()), {llvm::outs(), llvm::errs()}));
|
||||
|
||||
@@ -56,6 +56,7 @@ protected:
|
||||
}
|
||||
|
||||
void initializeBolt() {
|
||||
Relocation::Arch = ObjFile->makeTriple().getArch();
|
||||
BC = cantFail(BinaryContext::createBinaryContext(
|
||||
ObjFile->makeTriple(), ObjFile->getFileName(), nullptr, true,
|
||||
DWARFContext::create(*ObjFile.get()), {llvm::outs(), llvm::errs()}));
|
||||
|
||||
Reference in New Issue
Block a user