mirror of
https://github.com/golang/go
synced 2024-11-18 08:04:40 -07:00
[dev.link] cmd/internal/obj: remove asm parameter of NumberSyms
Now we have ctxt.IsAsm, use that, instead of passing in a parameter. Change-Id: I81dedbe6459424fa9a4c2bfbd9abd83d83f3a107 Reviewed-on: https://go-review.googlesource.com/c/go/+/234492 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
0f92cd75cf
commit
cf3bf9959c
@ -96,7 +96,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
if ok && !*flags.SymABIs {
|
||||
ctxt.NumberSyms(true)
|
||||
ctxt.NumberSyms()
|
||||
obj.WriteObjFile(ctxt, buf, *flags.Importpath)
|
||||
}
|
||||
if !ok || diag {
|
||||
|
@ -789,7 +789,7 @@ func Main(archInit func(*Arch)) {
|
||||
// Write object data to disk.
|
||||
timings.Start("be", "dumpobj")
|
||||
dumpdata()
|
||||
Ctxt.NumberSyms(false)
|
||||
Ctxt.NumberSyms()
|
||||
dumpobj()
|
||||
if asmhdr != "" {
|
||||
dumpasmhdr()
|
||||
|
@ -164,7 +164,7 @@ func (ctxt *Link) Int64Sym(i int64) *LSym {
|
||||
// Assign index to symbols.
|
||||
// asm is set to true if this is called by the assembler (i.e. not the compiler),
|
||||
// in which case all the symbols are non-package (for now).
|
||||
func (ctxt *Link) NumberSyms(asm bool) {
|
||||
func (ctxt *Link) NumberSyms() {
|
||||
if ctxt.Headtype == objabi.Haix {
|
||||
// Data must be sorted to keep a constant order in TOC symbols.
|
||||
// As they are created during Progedit, two symbols can be switched between
|
||||
@ -181,7 +181,7 @@ func (ctxt *Link) NumberSyms(asm bool) {
|
||||
|
||||
var idx, nonpkgidx int32 = 0, 0
|
||||
ctxt.traverseSyms(traverseDefs, func(s *LSym) {
|
||||
if isNonPkgSym(ctxt, asm, s) {
|
||||
if isNonPkgSym(ctxt, s) {
|
||||
s.PkgIdx = goobj2.PkgIdxNone
|
||||
s.SymIdx = nonpkgidx
|
||||
if nonpkgidx != int32(len(ctxt.nonpkgdefs)) {
|
||||
@ -240,7 +240,7 @@ func (ctxt *Link) NumberSyms(asm bool) {
|
||||
})
|
||||
|
||||
// Compute a fingerprint of the indices, for exporting.
|
||||
if !asm {
|
||||
if !ctxt.IsAsm {
|
||||
h := md5.New()
|
||||
for _, s := range ctxt.defs {
|
||||
h.Write([]byte(s.Name))
|
||||
@ -251,8 +251,8 @@ func (ctxt *Link) NumberSyms(asm bool) {
|
||||
|
||||
// Returns whether s is a non-package symbol, which needs to be referenced
|
||||
// by name instead of by index.
|
||||
func isNonPkgSym(ctxt *Link, asm bool, s *LSym) bool {
|
||||
if asm && !s.Static() {
|
||||
func isNonPkgSym(ctxt *Link, s *LSym) bool {
|
||||
if ctxt.IsAsm && !s.Static() {
|
||||
// asm symbols are referenced by name only, except static symbols
|
||||
// which are file-local and can be referenced by index.
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user