gollvm: get rid of spurious DWARF reader errors

Part of the libgo build involves compiling a C source file (which
includes various system headers) and then running the tool
llvm-godumpspec on the resulting object. The llvm-godumpspec tool uses
the LLVM libraries to examine the DWARF, mainly to extract information
about types.

The LLVM reader utility also pulls in macro debug information if
present, however, which exposes a bug: the reader assumes that the
object or binary being read will only have a single .debug_XXX section
for each type. This assumption doesn't hold for .debug_macro sections
(GCC emits multiple sections of this name); this triggers a series of
errors of the form

 error: at most two relocations per offset are supported

These errors are benign in the sense that they don't have any impact
on the output of llvm-godumpspec, but they are confusing for users.

To work around the problem, change the cmake rules that compile
sysinfo.c to use "-g2" and not "-g3", so as to avoid any .debug_macro
sections.

Fixes golang/go#42679.

Change-Id: I3cf51bc0437a71709ec2d715146179276c57c4da
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/271037
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/cmake/modules/AutoGenGo.cmake b/cmake/modules/AutoGenGo.cmake
index 38a74d5..3e3ab83 100644
--- a/cmake/modules/AutoGenGo.cmake
+++ b/cmake/modules/AutoGenGo.cmake
@@ -505,7 +505,7 @@
   # implement this functionality.
   add_custom_command(
     OUTPUT ${objfile}
-    COMMAND ${ccomp} "-g3" "-c" "-fno-eliminate-unused-debug-types"
+    COMMAND ${ccomp} "-g2" "-c" "-fno-eliminate-unused-debug-types"
             ${sysinfoc} -o ${objfile} ${cflags}
     DEPENDS ${sysinfoc} ${ARG_DEPS}
     COMMENT "Building sysinfo.o "