[llgo] Increment "Debug Info Version"

Patch by Michal Cierniak!

This patch increments the "Debug Info Version" from 2 to 3.
This is a nop if you just want to generate binaries. I verified
that with and without this patch, when I run llgo -g on a Go
source file, I get exactly the same binary. The purpose of the
patch is to make it possible to run the llvm-dis tool. Without
the patch, it is impossible to disassemble files generated with
llgo:

  $ llgo -c -g -emit-llvm src/hello.go
  $ llvm-dis hello.o
  llvm-dis: warning: ignoring debug info with an invalid version (2) in hello.o

Differential Revision: http://reviews.llvm.org/D18355

llvm-svn: 264212
This commit is contained in:
Andrew Wilkins 2016-03-23 23:09:00 +00:00
parent dde29407c4
commit 0f432aa05a
1 changed files with 1 additions and 1 deletions

View File

@ -183,7 +183,7 @@ func (d *DIBuilder) Finalize() {
llvm.GlobalContext().MDNode([]llvm.Metadata{
llvm.ConstInt(llvm.Int32Type(), 1, false).ConstantAsMetadata(), // Error on mismatch
llvm.GlobalContext().MDString("Debug Info Version"),
llvm.ConstInt(llvm.Int32Type(), 2, false).ConstantAsMetadata(),
llvm.ConstInt(llvm.Int32Type(), 3, false).ConstantAsMetadata(),
}),
)
d.builder.Finalize()