Skip to content

Commit f721fcb

Browse files
committed
Revert "[JITLink][ELF] Don't skip debug info sections by default."
This reverts commit 57aeb30. Breaks buildbot https://lab.llvm.org/buildbot/#/builders/197/builds/4272
1 parent 8d6ab7d commit f721fcb

File tree

3 files changed

+258
-213
lines changed

3 files changed

+258
-213
lines changed

llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ class ELFLinkGraphBuilder : public ELFLinkGraphBuilderBase {
6262
StringRef FileName,
6363
LinkGraph::GetEdgeKindNameFunction GetEdgeKindName);
6464

65-
/// Debug sections are included in the graph by default. Use
66-
/// setProcessDebugSections(false) to ignore them if debug info is not
67-
/// needed.
68-
ELFLinkGraphBuilder &setProcessDebugSections(bool ProcessDebugSections) {
69-
this->ProcessDebugSections = ProcessDebugSections;
70-
return *this;
71-
}
72-
7365
/// Attempt to construct and return the LinkGraph.
7466
Expected<std::unique_ptr<LinkGraph>> buildGraph();
7567

@@ -123,7 +115,8 @@ class ELFLinkGraphBuilder : public ELFLinkGraphBuilderBase {
123115
///
124116
template <typename RelocHandlerMethod>
125117
Error forEachRelaRelocation(const typename ELFT::Shdr &RelSect,
126-
RelocHandlerMethod &&Func);
118+
RelocHandlerMethod &&Func,
119+
bool ProcessDebugSections = false);
127120

128121
/// Traverse all matching ELFT::Rel relocation records in the given section.
129122
/// The handler function Func should be callable with this signature:
@@ -132,40 +125,44 @@ class ELFLinkGraphBuilder : public ELFLinkGraphBuilderBase {
132125
///
133126
template <typename RelocHandlerMethod>
134127
Error forEachRelRelocation(const typename ELFT::Shdr &RelSect,
135-
RelocHandlerMethod &&Func);
128+
RelocHandlerMethod &&Func,
129+
bool ProcessDebugSections = false);
136130

137131
/// Traverse all matching rela relocation records in the given section.
138132
/// Convenience wrapper to allow passing a member function for the handler.
139133
///
140134
template <typename ClassT, typename RelocHandlerMethod>
141135
Error forEachRelaRelocation(const typename ELFT::Shdr &RelSect,
142-
ClassT *Instance, RelocHandlerMethod &&Method) {
136+
ClassT *Instance, RelocHandlerMethod &&Method,
137+
bool ProcessDebugSections = false) {
143138
return forEachRelaRelocation(
144139
RelSect,
145140
[Instance, Method](const auto &Rel, const auto &Target, auto &GS) {
146141
return (Instance->*Method)(Rel, Target, GS);
147-
});
142+
},
143+
ProcessDebugSections);
148144
}
149145

150146
/// Traverse all matching rel relocation records in the given section.
151147
/// Convenience wrapper to allow passing a member function for the handler.
152148
///
153149
template <typename ClassT, typename RelocHandlerMethod>
154150
Error forEachRelRelocation(const typename ELFT::Shdr &RelSect,
155-
ClassT *Instance, RelocHandlerMethod &&Method) {
151+
ClassT *Instance, RelocHandlerMethod &&Method,
152+
bool ProcessDebugSections = false) {
156153
return forEachRelRelocation(
157154
RelSect,
158155
[Instance, Method](const auto &Rel, const auto &Target, auto &GS) {
159156
return (Instance->*Method)(Rel, Target, GS);
160-
});
157+
},
158+
ProcessDebugSections);
161159
}
162160

163161
const ELFFile &Obj;
164162

165163
typename ELFFile::Elf_Shdr_Range Sections;
166164
const typename ELFFile::Elf_Shdr *SymTabSec = nullptr;
167165
StringRef SectionStringTab;
168-
bool ProcessDebugSections = true;
169166

170167
// Maps ELF section indexes to LinkGraph Blocks.
171168
// Only SHF_ALLOC sections will have graph blocks.
@@ -321,7 +318,7 @@ template <typename ELFT> Error ELFLinkGraphBuilder<ELFT>::graphifySections() {
321318

322319
// If the name indicates that it's a debug section then skip it: We don't
323320
// support those yet.
324-
if (!ProcessDebugSections && isDwarfSection(*Name)) {
321+
if (isDwarfSection(*Name)) {
325322
LLVM_DEBUG({
326323
dbgs() << " " << SecIndex << ": \"" << *Name
327324
<< "\" is a debug section: "
@@ -525,7 +522,8 @@ template <typename ELFT> Error ELFLinkGraphBuilder<ELFT>::graphifySymbols() {
525522
template <typename ELFT>
526523
template <typename RelocHandlerFunction>
527524
Error ELFLinkGraphBuilder<ELFT>::forEachRelaRelocation(
528-
const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func) {
525+
const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func,
526+
bool ProcessDebugSections) {
529527
// Only look into sections that store relocation entries.
530528
if (RelSect.sh_type != ELF::SHT_RELA)
531529
return Error::success();
@@ -571,7 +569,8 @@ Error ELFLinkGraphBuilder<ELFT>::forEachRelaRelocation(
571569
template <typename ELFT>
572570
template <typename RelocHandlerFunction>
573571
Error ELFLinkGraphBuilder<ELFT>::forEachRelRelocation(
574-
const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func) {
572+
const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func,
573+
bool ProcessDebugSections) {
575574
// Only look into sections that store relocation entries.
576575
if (RelSect.sh_type != ELF::SHT_REL)
577576
return Error::success();

llvm/test/ExecutionEngine/JITLink/X86/ELF_debug_section_lifetime_is_NoAlloc.yaml

Lines changed: 0 additions & 195 deletions
This file was deleted.

0 commit comments

Comments
 (0)