]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link,runtime: merge minfunc const info internal/abi
authorqiulaidongfeng <2645477756@qq.com>
Sat, 6 Jan 2024 07:12:43 +0000 (07:12 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 22 Jan 2024 16:17:48 +0000 (16:17 +0000)
For #59670

Change-Id: If2b05b1ba30b607b518577b0e11ba5a0b07999c5
GitHub-Last-Rev: a664aa18b5ef674dc2d05c1f7533e1974d265894
GitHub-Pull-Request: golang/go#64906
Reviewed-on: https://go-review.googlesource.com/c/go/+/553276
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/pcln.go
src/cmd/link/internal/wasm/asm.go
src/internal/abi/symtab.go
src/runtime/symtab.go

index f4ea8407c83d057d163bb5d71c6dce2dabec81ee..896d7731246e4107d53bf56e23193b624af97d9b 100644 (file)
@@ -43,6 +43,7 @@ import (
        "debug/elf"
        "encoding/binary"
        "fmt"
+       "internal/abi"
        "log"
        "os"
        "sort"
@@ -2556,8 +2557,8 @@ func assignAddress(ctxt *Link, sect *sym.Section, n int, s loader.Sym, va uint64
                sect.Align = align
        }
 
-       funcsize := uint64(MINFUNC) // spacing required for findfunctab
-       if ldr.SymSize(s) > MINFUNC {
+       funcsize := uint64(abi.MINFUNC) // spacing required for findfunctab
+       if ldr.SymSize(s) > abi.MINFUNC {
                funcsize = uint64(ldr.SymSize(s))
        }
 
@@ -2611,7 +2612,7 @@ func assignAddress(ctxt *Link, sect *sym.Section, n int, s loader.Sym, va uint64
                                // Assign its address directly in order to be the
                                // first symbol of this new section.
                                ntext.SetType(sym.STEXT)
-                               ntext.SetSize(int64(MINFUNC))
+                               ntext.SetSize(int64(abi.MINFUNC))
                                ntext.SetOnList(true)
                                ntext.SetAlign(sectAlign)
                                ctxt.tramps = append(ctxt.tramps, ntext.Sym())
index eab74dc32864ed201b580584bb71a6d42a157c75..0219beeb10a05c62a0fb8f93b94ef19f459594e3 100644 (file)
@@ -273,10 +273,6 @@ var (
        symSize int32
 )
 
-const (
-       MINFUNC = 16 // minimum size for a function
-)
-
 // Symbol version of ABIInternal symbols. It is sym.SymVerABIInternal if ABI wrappers
 // are used, 0 otherwise.
 var abiInternalVer = sym.SymVerABIInternal
index 5734b92507e15b554efe10d8a848912f63bcea3b..170ebe5ebe11e62a49aee6c74d585bc3a22fd3d5 100644 (file)
@@ -827,7 +827,7 @@ func expandGoroot(s string) string {
 }
 
 const (
-       BUCKETSIZE    = 256 * MINFUNC
+       BUCKETSIZE    = 256 * abi.MINFUNC
        SUBBUCKETS    = 16
        SUBBUCKETSIZE = BUCKETSIZE / SUBBUCKETS
        NOIDX         = 0x7fffffff
index 413a809414037ae17d66a43f031448921d2d9cd1..2f511b97c72f3f9b84abe3df171f092e391de14a 100644 (file)
@@ -14,6 +14,7 @@ import (
        "cmd/link/internal/sym"
        "encoding/binary"
        "fmt"
+       "internal/abi"
        "internal/buildcfg"
        "io"
        "regexp"
@@ -154,8 +155,8 @@ func assignAddress(ldr *loader.Loader, sect *sym.Section, n int, s loader.Sym, v
        // However, there is no PC register, only PC_F and PC_B. PC_F denotes the function,
        // PC_B the resume point inside of that function. The entry of the function has PC_B = 0.
        ldr.SetSymSect(s, sect)
-       ldr.SetSymValue(s, int64(funcValueOffset+va/ld.MINFUNC)<<16) // va starts at zero
-       va += uint64(ld.MINFUNC)
+       ldr.SetSymValue(s, int64(funcValueOffset+va/abi.MINFUNC)<<16) // va starts at zero
+       va += uint64(abi.MINFUNC)
        return sect, n, va
 }
 
index ce1b65015519e4b2508073dbf526798add9ffcd2..41026ea2ab8a94374a65884c64e74b00bd317c57 100644 (file)
@@ -105,3 +105,5 @@ const (
        // Like UnsafePointRestart1, but back to function entry if async preempted.
        UnsafePointRestartAtEntry = -5
 )
+
+const MINFUNC = 16 // minimum size for a function
index edf800f5198ec3d8ceafa67f8bc0bd38b114a108..a046ebef39e831fb254dd0f926ade0fd407ba011 100644 (file)
@@ -497,8 +497,7 @@ type textsect struct {
        baseaddr uintptr // relocated section address
 }
 
-const minfunc = 16                 // minimum function size
-const pcbucketsize = 256 * minfunc // size of bucket in the pc->func lookup table
+const pcbucketsize = 256 * abi.MINFUNC // size of bucket in the pc->func lookup table
 
 // findfuncbucket is an array of these structures.
 // Each bucket represents 4096 bytes of the text segment.