Index: include/llvm/MC/MCTargetOptions.h =================================================================== --- include/llvm/MC/MCTargetOptions.h +++ include/llvm/MC/MCTargetOptions.h @@ -62,6 +62,9 @@ std::string ABIName; std::string SplitDwarfFile; + /// Enable base address specification in dwarf ranges + bool UseDwarfRangesBaseAddressSpecifier; + /// Additional paths to search for `.include` directives when using the /// integrated assembler. std::vector IASSearchPaths; Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -85,10 +85,6 @@ DisableDebugInfoPrinting("disable-debug-info-print", cl::Hidden, cl::desc("Disable debug info printing")); -static cl::opt UseDwarfRangesBaseAddressSpecifier( - "use-dwarf-ranges-base-address-specifier", cl::Hidden, - cl::desc("Use base address specifiers in debug_ranges"), cl::init(false)); - static cl::opt GenerateARangeSection("generate-arange-section", cl::Hidden, cl::desc("Generate dwarf aranges"), @@ -1909,7 +1905,7 @@ // contrubutions. auto *Base = CUBase; if (!Base && P.second.size() > 1 && - UseDwarfRangesBaseAddressSpecifier) { + Asm->TM.Options.MCOptions.UseDwarfRangesBaseAddressSpecifier) { BaseIsSet = true; // FIXME/use care: This may not be a useful base address if it's not // the lowest address/range in this object. Index: test/DebugInfo/X86/range_reloc.ll =================================================================== --- test/DebugInfo/X86/range_reloc.ll +++ test/DebugInfo/X86/range_reloc.ll @@ -1,4 +1,4 @@ -; RUN: llc -filetype=asm -mtriple=x86_64-pc-linux-gnu %s -o - -use-dwarf-ranges-base-address-specifier | FileCheck --check-prefix=COMMON --check-prefix=BASE %s +; RUN: llc -filetype=asm -mtriple=x86_64-pc-linux-gnu -use-dwarf-ranges-base-address-specifier %s -o - | FileCheck --check-prefix=COMMON --check-prefix=BASE %s ; RUN: llc -filetype=asm -mtriple=x86_64-pc-linux-gnu %s -o - | FileCheck --check-prefix=COMMON --check-prefix=NOBASE %s ; Group ranges in a range list that apply to the same section and use a base Index: tools/llc/llc.cpp =================================================================== --- tools/llc/llc.cpp +++ tools/llc/llc.cpp @@ -166,6 +166,10 @@ static int compileModule(char **, LLVMContext &); +static cl::opt UseDwarfRangesBaseAddressSpecifier( + "use-dwarf-ranges-base-address-specifier", cl::Hidden, + cl::desc("Use base address specifiers in debug_ranges"), cl::init(false)); + static std::unique_ptr GetOutputStream(const char *TargetName, Triple::OSType OS, const char *ProgName) { @@ -451,6 +455,7 @@ Options.MCOptions.PreserveAsmComments = PreserveComments; Options.MCOptions.IASSearchPaths = IncludeDirs; Options.MCOptions.SplitDwarfFile = SplitDwarfFile; + Options.MCOptions.UseDwarfRangesBaseAddressSpecifier = UseDwarfRangesBaseAddressSpecifier; std::unique_ptr Target(TheTarget->createTargetMachine( TheTriple.getTriple(), CPUStr, FeaturesStr, Options, getRelocModel(),