Skip to content

Commit 229d576

Browse files
Rename EHFrameSplitter to DWARFRecordSectionSplitter
EHFrameSplitter does the exact same work to split up the eh_frame as it would need for any section that follows the DWARF record, therefore this patch just changes the name of it to DWARFRecordSectionSplitter to be more general. Differential Revision: https://reviews.llvm.org/D121486
1 parent 0c0f6cf commit 229d576

File tree

6 files changed

+28
-26
lines changed

6 files changed

+28
-26
lines changed

llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,41 @@
1818
namespace llvm {
1919
namespace jitlink {
2020

21-
EHFrameSplitter::EHFrameSplitter(StringRef EHFrameSectionName)
22-
: EHFrameSectionName(EHFrameSectionName) {}
21+
DWARFRecordSectionSplitter::DWARFRecordSectionSplitter(StringRef SectionName)
22+
: SectionName(SectionName) {}
2323

24-
Error EHFrameSplitter::operator()(LinkGraph &G) {
25-
auto *EHFrame = G.findSectionByName(EHFrameSectionName);
24+
Error DWARFRecordSectionSplitter::operator()(LinkGraph &G) {
25+
auto *Section = G.findSectionByName(SectionName);
2626

27-
if (!EHFrame) {
27+
if (!Section) {
2828
LLVM_DEBUG({
29-
dbgs() << "EHFrameSplitter: No " << EHFrameSectionName
29+
dbgs() << "DWARFRecordSectionSplitter: No " << SectionName
3030
<< " section. Nothing to do\n";
3131
});
3232
return Error::success();
3333
}
3434

3535
LLVM_DEBUG({
36-
dbgs() << "EHFrameSplitter: Processing " << EHFrameSectionName << "...\n";
36+
dbgs() << "DWARFRecordSectionSplitter: Processing " << SectionName
37+
<< "...\n";
3738
});
3839

3940
DenseMap<Block *, LinkGraph::SplitBlockCache> Caches;
4041

4142
{
4243
// Pre-build the split caches.
43-
for (auto *B : EHFrame->blocks())
44+
for (auto *B : Section->blocks())
4445
Caches[B] = LinkGraph::SplitBlockCache::value_type();
45-
for (auto *Sym : EHFrame->symbols())
46+
for (auto *Sym : Section->symbols())
4647
Caches[&Sym->getBlock()]->push_back(Sym);
47-
for (auto *B : EHFrame->blocks())
48+
for (auto *B : Section->blocks())
4849
llvm::sort(*Caches[B], [](const Symbol *LHS, const Symbol *RHS) {
4950
return LHS->getOffset() > RHS->getOffset();
5051
});
5152
}
5253

5354
// Iterate over blocks (we do this by iterating over Caches entries rather
54-
// than EHFrame->blocks() as we will be inserting new blocks along the way,
55+
// than Section->blocks() as we will be inserting new blocks along the way,
5556
// which would invalidate iterators in the latter sequence.
5657
for (auto &KV : Caches) {
5758
auto &B = *KV.first;
@@ -63,14 +64,14 @@ Error EHFrameSplitter::operator()(LinkGraph &G) {
6364
return Error::success();
6465
}
6566

66-
Error EHFrameSplitter::processBlock(LinkGraph &G, Block &B,
67-
LinkGraph::SplitBlockCache &Cache) {
67+
Error DWARFRecordSectionSplitter::processBlock(
68+
LinkGraph &G, Block &B, LinkGraph::SplitBlockCache &Cache) {
6869
LLVM_DEBUG(dbgs() << " Processing block at " << B.getAddress() << "\n");
6970

70-
// eh-frame should not contain zero-fill blocks.
71+
// Section should not contain zero-fill blocks.
7172
if (B.isZeroFill())
7273
return make_error<JITLinkError>("Unexpected zero-fill block in " +
73-
EHFrameSectionName + " section");
74+
SectionName + " section");
7475

7576
if (B.getSize() == 0) {
7677
LLVM_DEBUG(dbgs() << " Block is empty. Skipping.\n");

llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@
2121
namespace llvm {
2222
namespace jitlink {
2323

24-
/// A LinkGraph pass that splits blocks in an eh-frame section into sub-blocks
25-
/// representing individual eh-frames.
26-
/// EHFrameSplitter should not be run without EHFrameEdgeFixer, which is
27-
/// responsible for adding FDE-to-CIE edges.
28-
class EHFrameSplitter {
24+
/// A LinkGraph pass that splits blocks in a section that follows the DWARF
25+
/// Record format into sub-blocks where each header gets its own block.
26+
/// When splitting EHFrames, DWARFRecordSectionSplitter should not be run
27+
/// without EHFrameEdgeFixer, which is responsible for adding FDE-to-CIE edges.
28+
class DWARFRecordSectionSplitter {
2929
public:
30-
EHFrameSplitter(StringRef EHFrameSectionName);
30+
DWARFRecordSectionSplitter(StringRef SectionName);
3131
Error operator()(LinkGraph &G);
3232

3333
private:
3434
Error processBlock(LinkGraph &G, Block &B, LinkGraph::SplitBlockCache &Cache);
3535

36-
StringRef EHFrameSectionName;
36+
StringRef SectionName;
3737
};
3838

3939
/// A LinkGraph pass that adds missing FDE-to-CIE, FDE-to-PC and FDE-to-LSDA

llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ void link_ELF_x86_64(std::unique_ptr<LinkGraph> G,
379379

380380
if (Ctx->shouldAddDefaultTargetPasses(G->getTargetTriple())) {
381381

382-
Config.PrePrunePasses.push_back(EHFrameSplitter(".eh_frame"));
382+
Config.PrePrunePasses.push_back(DWARFRecordSectionSplitter(".eh_frame"));
383383
Config.PrePrunePasses.push_back(
384384
EHFrameEdgeFixer(".eh_frame", x86_64::PointerSize, x86_64::Delta64,
385385
x86_64::Delta32, x86_64::NegDelta32));

llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,8 @@ void link_MachO_arm64(std::unique_ptr<LinkGraph> G,
712712
// Add eh-frame passses.
713713
// FIXME: Prune eh-frames for which compact-unwind is available once
714714
// we support compact-unwind registration with libunwind.
715-
Config.PrePrunePasses.push_back(EHFrameSplitter("__TEXT,__eh_frame"));
715+
Config.PrePrunePasses.push_back(
716+
DWARFRecordSectionSplitter("__TEXT,__eh_frame"));
716717
Config.PrePrunePasses.push_back(
717718
EHFrameEdgeFixer("__TEXT,__eh_frame", 8, Delta64, Delta32, NegDelta32));
718719

llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ void link_MachO_x86_64(std::unique_ptr<LinkGraph> G,
504504
}
505505

506506
LinkGraphPassFunction createEHFrameSplitterPass_MachO_x86_64() {
507-
return EHFrameSplitter("__TEXT,__eh_frame");
507+
return DWARFRecordSectionSplitter("__TEXT,__eh_frame");
508508
}
509509

510510
LinkGraphPassFunction createEHFrameEdgeFixerPass_MachO_x86_64() {

llvm/test/ExecutionEngine/JITLink/AArch64/MachO_arm64_ehframe.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# Check that splitting of eh-frame sections works.
77
#
8-
# CHECK: EHFrameSplitter: Processing __TEXT,__eh_frame...
8+
# CHECK: DWARFRecordSectionSplitter: Processing __TEXT,__eh_frame...
99
# CHECK: Processing block at
1010
# CHECK: Processing CFI record at
1111
# CHECK: Extracted {{.*}} section = __TEXT,__eh_frame

0 commit comments

Comments
 (0)