[DEBUGINFO] Add flag for DWARF2 to use sections as references.
Summary:
Some targets does not support labels inside debug sections, but support
references in form `section+offset`. Patch adds initial support
for this.
Reviewers: echristo, probinson, jlebar
Subscribers: llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D43943
llvm-svn: 328314
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 4459a50..52b9206 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -264,6 +264,10 @@
/// Allow emission of .debug_ranges section.
bool UseRangesSection = true;
+ /// True if the sections itself must be used as references and don't create
+ /// temp symbols inside DWARF sections.
+ bool UseSectionsAsReferences = false;
+
/// DWARF5 Experimental Options
/// @{
bool HasDwarfAccelTables;
@@ -448,6 +452,9 @@
void collectVariableInfoFromMFTable(DwarfCompileUnit &TheCU,
DenseSet<InlinedVariable> &P);
+ /// Emit the reference to the section.
+ void emitSectionReference(const DwarfCompileUnit &CU);
+
protected:
/// Gather pre-function debug information.
void beginFunctionImpl(const MachineFunction *MF) override;
@@ -513,6 +520,11 @@
/// Returns whether ranges section should be emitted.
bool useRangesSection() const { return UseRangesSection; }
+ /// Returns whether to use sections as labels rather than temp symbols.
+ bool useSectionsAsReferences() const {
+ return UseSectionsAsReferences;
+ }
+
// Experimental DWARF5 features.
/// Returns whether or not to emit tables that dwarf consumers can