]> Cypherpunks repositories - gostls13.git/commitdiff
cmd: remove Go115AMD64
authorCherry Zhang <cherryyz@google.com>
Fri, 30 Oct 2020 22:36:41 +0000 (18:36 -0400)
committerCherry Zhang <cherryyz@google.com>
Mon, 2 Nov 2020 03:02:35 +0000 (03:02 +0000)
Always do aligned jumps now.

Change-Id: If68a16fe93c9173c83323a9063465c9bd166eeb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/266857
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/asm/internal/asm/endtoend_test.go
src/cmd/internal/obj/x86/asm6.go
src/cmd/internal/objabi/util.go
src/cmd/link/internal/amd64/l.go
src/cmd/link/internal/amd64/obj.go

index 989b7a5405419895e075aba258975a2ba9b8601c..7472507caf18ef64725e1a1822d8fb63632bed86 100644 (file)
@@ -390,12 +390,7 @@ func TestARM64Errors(t *testing.T) {
 }
 
 func TestAMD64EndToEnd(t *testing.T) {
-       defer func(old string) { objabi.GOAMD64 = old }(objabi.GOAMD64)
-       for _, goamd64 := range []string{"normaljumps", "alignedjumps"} {
-               t.Logf("GOAMD64=%s", goamd64)
-               objabi.GOAMD64 = goamd64
-               testEndToEnd(t, "amd64", "amd64")
-       }
+       testEndToEnd(t, "amd64", "amd64")
 }
 
 func Test386Encoder(t *testing.T) {
index 94aed448712efdb7de6a7a15f340d7c38fcd97b2..a6b85ac4a06bd8cceb65e4fe83f8aab892dd32b7 100644 (file)
@@ -1851,9 +1851,9 @@ func spadjop(ctxt *obj.Link, l, q obj.As) obj.As {
        return q
 }
 
-// If the environment variable GOAMD64=alignedjumps the assembler will ensure that
-// no standalone or macro-fused jump will straddle or end on a 32 byte boundary
-// by inserting NOPs before the jumps
+// isJump returns whether p is a jump instruction.
+// It is used to ensure that no standalone or macro-fused jump will straddle
+// or end on a 32 byte boundary by inserting NOPs before the jumps.
 func isJump(p *obj.Prog) bool {
        return p.To.Target() != nil || p.As == obj.AJMP || p.As == obj.ACALL ||
                p.As == obj.ARET || p.As == obj.ADUFFCOPY || p.As == obj.ADUFFZERO
@@ -1987,11 +1987,6 @@ func makePjcCtx(ctxt *obj.Link) padJumpsCtx {
                return padJumpsCtx(0)
        }
 
-       if objabi.GOAMD64 != "alignedjumps" {
-               return padJumpsCtx(0)
-
-       }
-
        return padJumpsCtx(32)
 }
 
index b81b73a02234947d6080eb652efa84c48ac377f7..9479ab2cd9fc438417ac8e57a68c90e2e703663d 100644 (file)
@@ -25,7 +25,6 @@ var (
        GOARCH   = envOr("GOARCH", defaultGOARCH)
        GOOS     = envOr("GOOS", defaultGOOS)
        GO386    = envOr("GO386", defaultGO386)
-       GOAMD64  = goamd64()
        GOARM    = goarm()
        GOMIPS   = gomips()
        GOMIPS64 = gomips64()
@@ -37,15 +36,9 @@ var (
 
 const (
        ElfRelocOffset   = 256
-       MachoRelocOffset = 2048           // reserve enough space for ELF relocations
-       Go115AMD64       = "alignedjumps" // Should be "alignedjumps" or "normaljumps"; this replaces environment variable introduced in CL 219357.
+       MachoRelocOffset = 2048 // reserve enough space for ELF relocations
 )
 
-// TODO(1.16): assuming no issues in 1.15 release, remove this and related constant.
-func goamd64() string {
-       return Go115AMD64
-}
-
 func goarm() int {
        switch v := envOr("GOARM", defaultGOARM); v {
        case "5":
index a9afb3a39f8a91e28b1f0ea3afa2d68e84dc36e3..c9ea90a9c811b60059698e2ddcce146e78439d0f 100644 (file)
@@ -33,7 +33,7 @@ package amd64
 const (
        maxAlign  = 32 // max data alignment
        minAlign  = 1  // min data alignment
-       funcAlign = 16
+       funcAlign = 32
 )
 
 /* Used by ../internal/ld/dwarf.go */
index 777f99dbe264ab4d21a2727d6fdf0b9b602bad8f..d09c90ea280b5a563cb5511322b51aeab0fd4e33 100644 (file)
@@ -39,13 +39,8 @@ import (
 func Init() (*sys.Arch, ld.Arch) {
        arch := sys.ArchAMD64
 
-       fa := funcAlign
-       if objabi.GOAMD64 == "alignedjumps" {
-               fa = 32
-       }
-
        theArch := ld.Arch{
-               Funcalign:  fa,
+               Funcalign:  funcAlign,
                Maxalign:   maxAlign,
                Minalign:   minAlign,
                Dwarfregsp: dwarfRegSP,