Skip to content

Commit 40fab29

Browse files
qiulaidongfenggopherbot
authored andcommitted
cmd/link,runtime: merge minfunc const info internal/abi
For #59670 Change-Id: If2b05b1ba30b607b518577b0e11ba5a0b07999c5 GitHub-Last-Rev: a664aa1 GitHub-Pull-Request: #64906 Reviewed-on: https://go-review.googlesource.com/c/go/+/553276 Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]> Auto-Submit: Keith Randall <[email protected]> Reviewed-by: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent a557f9d commit 40fab29

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

src/cmd/link/internal/ld/data.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import (
4343
"debug/elf"
4444
"encoding/binary"
4545
"fmt"
46+
"internal/abi"
4647
"log"
4748
"os"
4849
"sort"
@@ -2556,8 +2557,8 @@ func assignAddress(ctxt *Link, sect *sym.Section, n int, s loader.Sym, va uint64
25562557
sect.Align = align
25572558
}
25582559

2559-
funcsize := uint64(MINFUNC) // spacing required for findfunctab
2560-
if ldr.SymSize(s) > MINFUNC {
2560+
funcsize := uint64(abi.MINFUNC) // spacing required for findfunctab
2561+
if ldr.SymSize(s) > abi.MINFUNC {
25612562
funcsize = uint64(ldr.SymSize(s))
25622563
}
25632564

@@ -2611,7 +2612,7 @@ func assignAddress(ctxt *Link, sect *sym.Section, n int, s loader.Sym, va uint64
26112612
// Assign its address directly in order to be the
26122613
// first symbol of this new section.
26132614
ntext.SetType(sym.STEXT)
2614-
ntext.SetSize(int64(MINFUNC))
2615+
ntext.SetSize(int64(abi.MINFUNC))
26152616
ntext.SetOnList(true)
26162617
ntext.SetAlign(sectAlign)
26172618
ctxt.tramps = append(ctxt.tramps, ntext.Sym())

src/cmd/link/internal/ld/lib.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,6 @@ var (
273273
symSize int32
274274
)
275275

276-
const (
277-
MINFUNC = 16 // minimum size for a function
278-
)
279-
280276
// Symbol version of ABIInternal symbols. It is sym.SymVerABIInternal if ABI wrappers
281277
// are used, 0 otherwise.
282278
var abiInternalVer = sym.SymVerABIInternal

src/cmd/link/internal/ld/pcln.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ func expandGoroot(s string) string {
827827
}
828828

829829
const (
830-
BUCKETSIZE = 256 * MINFUNC
830+
BUCKETSIZE = 256 * abi.MINFUNC
831831
SUBBUCKETS = 16
832832
SUBBUCKETSIZE = BUCKETSIZE / SUBBUCKETS
833833
NOIDX = 0x7fffffff

src/cmd/link/internal/wasm/asm.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"cmd/link/internal/sym"
1515
"encoding/binary"
1616
"fmt"
17+
"internal/abi"
1718
"internal/buildcfg"
1819
"io"
1920
"regexp"
@@ -154,8 +155,8 @@ func assignAddress(ldr *loader.Loader, sect *sym.Section, n int, s loader.Sym, v
154155
// However, there is no PC register, only PC_F and PC_B. PC_F denotes the function,
155156
// PC_B the resume point inside of that function. The entry of the function has PC_B = 0.
156157
ldr.SetSymSect(s, sect)
157-
ldr.SetSymValue(s, int64(funcValueOffset+va/ld.MINFUNC)<<16) // va starts at zero
158-
va += uint64(ld.MINFUNC)
158+
ldr.SetSymValue(s, int64(funcValueOffset+va/abi.MINFUNC)<<16) // va starts at zero
159+
va += uint64(abi.MINFUNC)
159160
return sect, n, va
160161
}
161162

src/internal/abi/symtab.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,5 @@ const (
105105
// Like UnsafePointRestart1, but back to function entry if async preempted.
106106
UnsafePointRestartAtEntry = -5
107107
)
108+
109+
const MINFUNC = 16 // minimum size for a function

src/runtime/symtab.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,7 @@ type textsect struct {
497497
baseaddr uintptr // relocated section address
498498
}
499499

500-
const minfunc = 16 // minimum function size
501-
const pcbucketsize = 256 * minfunc // size of bucket in the pc->func lookup table
500+
const pcbucketsize = 256 * abi.MINFUNC // size of bucket in the pc->func lookup table
502501

503502
// findfuncbucket is an array of these structures.
504503
// Each bucket represents 4096 bytes of the text segment.

0 commit comments

Comments
 (0)