[PATCH] D146652: [BOLT][NFC] Change IsReadOnly -> IsWritable in EFMM::allocateSection
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 22 11:34:10 PDT 2023
Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Propagate IsReadOnly change to the calling context in
EFMM::allocateSection.
Follow-up to D141733 <https://reviews.llvm.org/D141733>.
Note that `EFMM::allocate{Code,Data}Section` has `IsReadOnly` parameter per
`RuntimeDyld::MemoryManager` interface.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146652
Files:
bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
bolt/lib/Rewrite/ExecutableFileMemoryManager.cpp
Index: bolt/lib/Rewrite/ExecutableFileMemoryManager.cpp
===================================================================
--- bolt/lib/Rewrite/ExecutableFileMemoryManager.cpp
+++ bolt/lib/Rewrite/ExecutableFileMemoryManager.cpp
@@ -23,7 +23,7 @@
uint8_t *ExecutableFileMemoryManager::allocateSection(
uintptr_t Size, unsigned Alignment, unsigned SectionID,
- StringRef SectionName, bool IsCode, bool IsReadOnly) {
+ StringRef SectionName, bool IsCode, bool IsWritable) {
uint8_t *Ret = static_cast<uint8_t *>(llvm::allocate_buffer(Size, Alignment));
AllocatedSections.push_back(AllocInfo{Ret, Size, Alignment});
@@ -81,7 +81,7 @@
// sections in the input file.
BinarySection &NewSection = BC.registerOrUpdateSection(
UsePrefix ? NewSecPrefix + SectionName : SectionName, ELF::SHT_PROGBITS,
- BinarySection::getFlags(!IsReadOnly, IsCode, true), Ret, Size,
+ BinarySection::getFlags(IsWritable, IsCode, true), Ret, Size,
Alignment);
if (UsePrefix)
NewSection.setOutputName(SectionName);
@@ -90,7 +90,7 @@
LLVM_DEBUG({
dbgs() << "BOLT: allocating "
- << (IsCode ? "code" : (IsReadOnly ? "read-only data" : "data"))
+ << (IsCode ? "code" : (!IsWritable ? "read-only data" : "data"))
<< " section : " << Section->getOutputName() << " ("
<< Section->getName() << ")"
<< " with size " << Size << ", alignment " << Alignment << " at "
Index: bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
===================================================================
--- bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
+++ bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
@@ -24,7 +24,7 @@
private:
uint8_t *allocateSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName,
- bool IsCode, bool IsReadOnly);
+ bool IsCode, bool IsWritable);
BinaryContext &BC;
bool AllowStubs;
@@ -59,14 +59,14 @@
unsigned SectionID,
StringRef SectionName) override {
return allocateSection(Size, Alignment, SectionID, SectionName,
- /*IsCode=*/true, true);
+ /*IsCode=*/true, false);
}
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName,
bool IsReadOnly) override {
return allocateSection(Size, Alignment, SectionID, SectionName,
- /*IsCode=*/false, IsReadOnly);
+ /*IsCode=*/false, !IsReadOnly);
}
// Ignore TLS sections by treating them as a regular data section
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146652.507446.patch
Type: text/x-patch
Size: 2833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230322/335698b3/attachment.bin>
More information about the llvm-commits
mailing list