summaryrefslogtreecommitdiff
path: root/tools/llvm-mc
diff options
context:
space:
mode:
authorOliver Stannard <oliver.stannard@arm.com>2014-05-01 08:46:02 +0000
committerOliver Stannard <oliver.stannard@arm.com>2014-05-01 08:46:02 +0000
commit5604ab9da4dadbfec85c650da27f841932c9cde8 (patch)
tree16df1929140d3df5e62f09808cf45474267929d5 /tools/llvm-mc
parenta1a235f869cd1c7d2716ab20242f06589775442e (diff)
downloadllvm-5604ab9da4dadbfec85c650da27f841932c9cde8.tar.gz
llvm-5604ab9da4dadbfec85c650da27f841932c9cde8.tar.bz2
llvm-5604ab9da4dadbfec85c650da27f841932c9cde8.tar.xz
Record the DWARF version in MCContext
Record the DWARF version in MCContext, and use it when emitting the dwarf version into the debug info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc')
-rw-r--r--tools/llvm-mc/llvm-mc.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index dbe012b4d4..516f6234f2 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -154,6 +154,9 @@ static cl::opt<bool>
GenDwarfForAssembly("g", cl::desc("Generate dwarf debugging info for assembly "
"source files"));
+static cl::opt<int>
+DwarfVersion("dwarf-version", cl::desc("Dwarf version"), cl::init(4));
+
static cl::opt<std::string>
DebugCompilationDir("fdebug-compilation-dir",
cl::desc("Specifies the debug info's compilation dir"));
@@ -406,6 +409,12 @@ int main(int argc, char **argv) {
Ctx.setAllowTemporaryLabels(false);
Ctx.setGenDwarfForAssembly(GenDwarfForAssembly);
+ if (DwarfVersion < 2 || DwarfVersion > 4) {
+ errs() << ProgName << ": Dwarf version " << DwarfVersion
+ << " is not supported." << '\n';
+ return 1;
+ }
+ Ctx.setDwarfVersion(DwarfVersion);
if (!DwarfDebugFlags.empty())
Ctx.setDwarfDebugFlags(StringRef(DwarfDebugFlags));
if (!DwarfDebugProducer.empty())