]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/compile: emit fewer R_USETYPE relocations
authorThan McIntosh <thanm@google.com>
Thu, 21 May 2020 11:16:29 +0000 (07:16 -0400)
committerThan McIntosh <thanm@google.com>
Tue, 26 May 2020 17:34:04 +0000 (17:34 +0000)
commit6265ed745241da6c04ac8b9463c6feaaf332087b
tree418d7ce95e747c97ab1d60991abd76c99b8eb56a
parent8ca2eae206cbe063de68cec046f41a7c7b8c4d4f
[dev.link] cmd/compile: emit fewer R_USETYPE relocations

Background: when compiling a function, it's possible that a local
variable will be optimized away, which could potentially degrade the
debugging experience if the compiler fails to emit DWARF information
for the variable's type. To mitigate this situation, the compiler
emits R_USETYPE relocations for the function's auto/param variables as
a signal to the linker to generate DWARF for the types in question,
even if the type is not specifically attached to a DWARF param or var.

This patch change the logic in the compiler to avoid emitting a
R_USETYPE relocation if the type in question is already referenced by
a concrete DWARF param or auto record. This cuts down on the amount of
work the linker has to do, also makes object files a bit smaller on
average (about 1% for the runtime package).

Change-Id: I4d24da458d0658edf90c5dca0bf21d5ddc3961d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/234837
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/gc/pgen.go