aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/ppc64
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2018-03-07 16:21:47 -0500
committerDavid Chase <drchase@google.com>2018-03-09 23:17:18 +0000
commit0eacf8cbdfaec174f29fd8c734ac2f02442af79a (patch)
tree9d1eda633654e0f7328e1676d18273fbe1f3f55f /src/cmd/internal/obj/ppc64
parent99c30211b1e0b3ac4e5d32f3ae5eaf759c23195f (diff)
downloadgo-0eacf8cbdfaec174f29fd8c734ac2f02442af79a.tar.xz
cmd/compile: add DWARF reg defs & fix 32-bit location list bug
Before DWARF location lists can be turned on, 3 bugs need fixing. This CL addresses two -- lack of register definitions for various architectures, and bugs on 32-bit platforms. The third bug comes later. Passes GO_GCFLAGS=-dwarflocationlists ./run.bash -no-rebuild (-no-rebuild because the map dependence causes trouble) Change-Id: I4223b48ade84763e4b048e4aeb81149f082c7bc7 Reviewed-on: https://go-review.googlesource.com/99255 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/internal/obj/ppc64')
-rw-r--r--src/cmd/internal/obj/ppc64/a.out.go23
-rw-r--r--src/cmd/internal/obj/ppc64/obj9.go22
2 files changed, 35 insertions, 10 deletions
diff --git a/src/cmd/internal/obj/ppc64/a.out.go b/src/cmd/internal/obj/ppc64/a.out.go
index 87577159d5..16a959d62a 100644
--- a/src/cmd/internal/obj/ppc64/a.out.go
+++ b/src/cmd/internal/obj/ppc64/a.out.go
@@ -255,6 +255,29 @@ const (
FREGEXT = REG_F26 /* first external register */
)
+// OpenPOWER ABI for Linux Supplement Power Architecture 64-Bit ELF V2 ABI
+// https://openpowerfoundation.org/?resource_lib=64-bit-elf-v2-abi-specification-power-architecture
+var PPC64DWARFRegisters = map[int16]int16{}
+
+func init() {
+ // f assigns dwarfregister[from:to] = (base):(to-from+base)
+ f := func(from, to, base int16) {
+ for r := int16(from); r <= to; r++ {
+ PPC64DWARFRegisters[r] = r - from + base
+ }
+ }
+ f(REG_R0, REG_R31, 0)
+ f(REG_F0, REG_F31, 32)
+ f(REG_V0, REG_V31, 77)
+ f(REG_CR0, REG_CR7, 68)
+
+ f(REG_VS0, REG_VS31, 32) // overlaps F0-F31
+ f(REG_VS32, REG_VS63, 77) // overlaps V0-V31
+ PPC64DWARFRegisters[REG_LR] = 65
+ PPC64DWARFRegisters[REG_CTR] = 66
+ PPC64DWARFRegisters[REG_XER] = 76
+}
+
/*
* GENERAL:
*
diff --git a/src/cmd/internal/obj/ppc64/obj9.go b/src/cmd/internal/obj/ppc64/obj9.go
index c468ee93a4..4982a85fdb 100644
--- a/src/cmd/internal/obj/ppc64/obj9.go
+++ b/src/cmd/internal/obj/ppc64/obj9.go
@@ -1056,17 +1056,19 @@ func (c *ctxt9) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
}
var Linkppc64 = obj.LinkArch{
- Arch: sys.ArchPPC64,
- Init: buildop,
- Preprocess: preprocess,
- Assemble: span9,
- Progedit: progedit,
+ Arch: sys.ArchPPC64,
+ Init: buildop,
+ Preprocess: preprocess,
+ Assemble: span9,
+ Progedit: progedit,
+ DWARFRegisters: PPC64DWARFRegisters,
}
var Linkppc64le = obj.LinkArch{
- Arch: sys.ArchPPC64LE,
- Init: buildop,
- Preprocess: preprocess,
- Assemble: span9,
- Progedit: progedit,
+ Arch: sys.ArchPPC64LE,
+ Init: buildop,
+ Preprocess: preprocess,
+ Assemble: span9,
+ Progedit: progedit,
+ DWARFRegisters: PPC64DWARFRegisters,
}