@@ -62,14 +62,6 @@ class ELFLinkGraphBuilder : public ELFLinkGraphBuilderBase {
62
62
StringRef FileName,
63
63
LinkGraph::GetEdgeKindNameFunction GetEdgeKindName);
64
64
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
-
73
65
// / Attempt to construct and return the LinkGraph.
74
66
Expected<std::unique_ptr<LinkGraph>> buildGraph ();
75
67
@@ -123,7 +115,8 @@ class ELFLinkGraphBuilder : public ELFLinkGraphBuilderBase {
123
115
// /
124
116
template <typename RelocHandlerMethod>
125
117
Error forEachRelaRelocation (const typename ELFT::Shdr &RelSect,
126
- RelocHandlerMethod &&Func);
118
+ RelocHandlerMethod &&Func,
119
+ bool ProcessDebugSections = false );
127
120
128
121
// / Traverse all matching ELFT::Rel relocation records in the given section.
129
122
// / The handler function Func should be callable with this signature:
@@ -132,40 +125,44 @@ class ELFLinkGraphBuilder : public ELFLinkGraphBuilderBase {
132
125
// /
133
126
template <typename RelocHandlerMethod>
134
127
Error forEachRelRelocation (const typename ELFT::Shdr &RelSect,
135
- RelocHandlerMethod &&Func);
128
+ RelocHandlerMethod &&Func,
129
+ bool ProcessDebugSections = false );
136
130
137
131
// / Traverse all matching rela relocation records in the given section.
138
132
// / Convenience wrapper to allow passing a member function for the handler.
139
133
// /
140
134
template <typename ClassT, typename RelocHandlerMethod>
141
135
Error forEachRelaRelocation (const typename ELFT::Shdr &RelSect,
142
- ClassT *Instance, RelocHandlerMethod &&Method) {
136
+ ClassT *Instance, RelocHandlerMethod &&Method,
137
+ bool ProcessDebugSections = false ) {
143
138
return forEachRelaRelocation (
144
139
RelSect,
145
140
[Instance, Method](const auto &Rel, const auto &Target, auto &GS) {
146
141
return (Instance->*Method)(Rel, Target, GS);
147
- });
142
+ },
143
+ ProcessDebugSections);
148
144
}
149
145
150
146
// / Traverse all matching rel relocation records in the given section.
151
147
// / Convenience wrapper to allow passing a member function for the handler.
152
148
// /
153
149
template <typename ClassT, typename RelocHandlerMethod>
154
150
Error forEachRelRelocation (const typename ELFT::Shdr &RelSect,
155
- ClassT *Instance, RelocHandlerMethod &&Method) {
151
+ ClassT *Instance, RelocHandlerMethod &&Method,
152
+ bool ProcessDebugSections = false ) {
156
153
return forEachRelRelocation (
157
154
RelSect,
158
155
[Instance, Method](const auto &Rel, const auto &Target, auto &GS) {
159
156
return (Instance->*Method)(Rel, Target, GS);
160
- });
157
+ },
158
+ ProcessDebugSections);
161
159
}
162
160
163
161
const ELFFile &Obj;
164
162
165
163
typename ELFFile::Elf_Shdr_Range Sections;
166
164
const typename ELFFile::Elf_Shdr *SymTabSec = nullptr ;
167
165
StringRef SectionStringTab;
168
- bool ProcessDebugSections = true ;
169
166
170
167
// Maps ELF section indexes to LinkGraph Blocks.
171
168
// Only SHF_ALLOC sections will have graph blocks.
@@ -321,7 +318,7 @@ template <typename ELFT> Error ELFLinkGraphBuilder<ELFT>::graphifySections() {
321
318
322
319
// If the name indicates that it's a debug section then skip it: We don't
323
320
// support those yet.
324
- if (!ProcessDebugSections && isDwarfSection (*Name)) {
321
+ if (isDwarfSection (*Name)) {
325
322
LLVM_DEBUG ({
326
323
dbgs () << " " << SecIndex << " : \" " << *Name
327
324
<< " \" is a debug section: "
@@ -525,7 +522,8 @@ template <typename ELFT> Error ELFLinkGraphBuilder<ELFT>::graphifySymbols() {
525
522
template <typename ELFT>
526
523
template <typename RelocHandlerFunction>
527
524
Error ELFLinkGraphBuilder<ELFT>::forEachRelaRelocation(
528
- const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func) {
525
+ const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func,
526
+ bool ProcessDebugSections) {
529
527
// Only look into sections that store relocation entries.
530
528
if (RelSect.sh_type != ELF::SHT_RELA)
531
529
return Error::success ();
@@ -571,7 +569,8 @@ Error ELFLinkGraphBuilder<ELFT>::forEachRelaRelocation(
571
569
template <typename ELFT>
572
570
template <typename RelocHandlerFunction>
573
571
Error ELFLinkGraphBuilder<ELFT>::forEachRelRelocation(
574
- const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func) {
572
+ const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func,
573
+ bool ProcessDebugSections) {
575
574
// Only look into sections that store relocation entries.
576
575
if (RelSect.sh_type != ELF::SHT_REL)
577
576
return Error::success ();
0 commit comments