Skip to content

Commit 0e2cde7

Browse files
hirochachachaianlancetaylor
authored andcommitted
cmd/link: refactor container()
* rename to emitPcln because I'd like to skip not only container types, but also something like "go.buildid" in the future. * return bool instead of int. Change-Id: I029adb81292f7dd2fe98e69f3877c5c27f32ec30 Reviewed-on: https://go-review.googlesource.com/59415 Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]>
1 parent 0564e30 commit 0e2cde7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,19 +171,19 @@ func onlycsymbol(s *Symbol) bool {
171171
return false
172172
}
173173

174-
func container(s *Symbol) int {
174+
func emitPcln(s *Symbol) bool {
175175
if s == nil {
176-
return 0
176+
return true
177177
}
178178
if Buildmode == BuildmodePlugin && Headtype == objabi.Hdarwin && onlycsymbol(s) {
179-
return 1
179+
return false
180180
}
181181
// We want to generate func table entries only for the "lowest level" symbols,
182182
// not containers of subsymbols.
183183
if s.Type&SCONTAINER != 0 {
184-
return 1
184+
return false
185185
}
186-
return 0
186+
return true
187187
}
188188

189189
// pclntab initializes the pclntab symbol with
@@ -220,7 +220,7 @@ func (ctxt *Link) pclntab() {
220220
}
221221

222222
for _, s := range ctxt.Textp {
223-
if container(s) == 0 {
223+
if emitPcln(s) {
224224
nfunc++
225225
}
226226
}
@@ -247,7 +247,7 @@ func (ctxt *Link) pclntab() {
247247
var last *Symbol
248248
for _, s := range ctxt.Textp {
249249
last = s
250-
if container(s) != 0 {
250+
if !emitPcln(s) {
251251
continue
252252
}
253253
pcln := s.FuncInfo
@@ -464,7 +464,7 @@ func (ctxt *Link) findfunctab() {
464464
}
465465
idx := int32(0)
466466
for i, s := range ctxt.Textp {
467-
if container(s) != 0 {
467+
if !emitPcln(s) {
468468
continue
469469
}
470470
p := s.Value
@@ -473,7 +473,7 @@ func (ctxt *Link) findfunctab() {
473473
if i < len(ctxt.Textp) {
474474
e = ctxt.Textp[i]
475475
}
476-
for container(e) != 0 && i < len(ctxt.Textp) {
476+
for !emitPcln(e) && i < len(ctxt.Textp) {
477477
e = ctxt.Textp[i]
478478
i++
479479
}

0 commit comments

Comments
 (0)