]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj/arm64: fix constant pool size calculation error
authoreric fang <eric.fang@arm.com>
Thu, 4 Mar 2021 03:41:52 +0000 (03:41 +0000)
committereric fang <eric.fang@arm.com>
Tue, 23 Mar 2021 01:21:24 +0000 (01:21 +0000)
commitd25476ebb2c645495db7ae22585a8e74171b106e
tree0f4e5925b30c540e54464b376e2fe5ff6d0b0fec
parentc819907754a30229da197546a36eb4a160e5908f
cmd/internal/obj/arm64: fix constant pool size calculation error

The current calculation method of constant pool size is:
  c.pool.size = -c.pool.size & (funcAlign - 1)
  c.pool.size += uint32(sz)
This doesn't make sense. This CL changes it as:
  if q.As == ADWORD {
    c.pool.size = roundUp(c.pool.size, 8)
  }
  c.pool.size += uint32(sz)
which takes into account the padding size generated by aligning DWORD to
8 bytes.

It's unnecessary to set the Pc field in addpool and addpool128 because
the Pc value will be reset in function span7, so remove the related lines.

Change-Id: I5eb8f259be55a6b97fc2c20958b4a602bffa4f88
Reviewed-on: https://go-review.googlesource.com/c/go/+/298609
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: eric fang <eric.fang@arm.com>
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/cmd/internal/obj/arm64/asm7.go