@@ -170,23 +170,22 @@ func flushplist(ctxt *Link, freeProgs bool) {
170
170
171
171
case AGLOBL :
172
172
s := p .From .Sym
173
- tmp6 := s .Seenglobl
174
- s .Seenglobl ++
175
- if tmp6 != 0 {
173
+ if s .Seenglobl {
176
174
fmt .Printf ("duplicate %v\n " , p )
177
175
}
178
- if s .Onlist != 0 {
176
+ s .Seenglobl = true
177
+ if s .Onlist {
179
178
log .Fatalf ("symbol %s listed multiple times" , s .Name )
180
179
}
181
- s .Onlist = 1
180
+ s .Onlist = true
182
181
ctxt .Data = append (ctxt .Data , s )
183
182
s .Size = p .To .Offset
184
183
if s .Type == 0 || s .Type == SXREF {
185
184
s .Type = SBSS
186
185
}
187
186
flag := int (p .From3 .Offset )
188
187
if flag & DUPOK != 0 {
189
- s .Dupok = 1
188
+ s .Dupok = true
190
189
}
191
190
if flag & RODATA != 0 {
192
191
s .Type = SRODATA
@@ -209,17 +208,17 @@ func flushplist(ctxt *Link, freeProgs bool) {
209
208
if s .Text != nil {
210
209
log .Fatalf ("duplicate TEXT for %s" , s .Name )
211
210
}
212
- if s .Onlist != 0 {
211
+ if s .Onlist {
213
212
log .Fatalf ("symbol %s listed multiple times" , s .Name )
214
213
}
215
- s .Onlist = 1
214
+ s .Onlist = true
216
215
text = append (text , s )
217
216
flag := int (p .From3Offset ())
218
217
if flag & DUPOK != 0 {
219
- s .Dupok = 1
218
+ s .Dupok = true
220
219
}
221
220
if flag & NOSPLIT != 0 {
222
- s .Nosplit = 1
221
+ s .Nosplit = true
223
222
}
224
223
if flag & REFLECTMETHOD != 0 {
225
224
s .ReflectMethod = true
@@ -437,19 +436,19 @@ func writesym(ctxt *Link, b *Biobuf, s *LSym) {
437
436
if s .Type != 0 {
438
437
fmt .Fprintf (ctxt .Bso , "t=%d " , s .Type )
439
438
}
440
- if s .Dupok != 0 {
439
+ if s .Dupok {
441
440
fmt .Fprintf (ctxt .Bso , "dupok " )
442
441
}
443
- if s .Cfunc != 0 {
442
+ if s .Cfunc {
444
443
fmt .Fprintf (ctxt .Bso , "cfunc " )
445
444
}
446
- if s .Nosplit != 0 {
445
+ if s .Nosplit {
447
446
fmt .Fprintf (ctxt .Bso , "nosplit " )
448
447
}
449
448
fmt .Fprintf (ctxt .Bso , "size=%d" , s .Size )
450
449
if s .Type == STEXT {
451
450
fmt .Fprintf (ctxt .Bso , " args=%#x locals=%#x" , uint64 (s .Args ), uint64 (s .Locals ))
452
- if s .Leaf != 0 {
451
+ if s .Leaf {
453
452
fmt .Fprintf (ctxt .Bso , " leaf" )
454
453
}
455
454
}
@@ -499,9 +498,12 @@ func writesym(ctxt *Link, b *Biobuf, s *LSym) {
499
498
Bputc (b , 0xfe )
500
499
wrint (b , int64 (s .Type ))
501
500
wrsym (b , s )
502
- flags := int64 (s .Dupok )
501
+ flags := int64 (0 )
502
+ if s .Dupok {
503
+ flags |= 1
504
+ }
503
505
if s .Local {
504
- flags |= 2
506
+ flags |= 1 << 1
505
507
}
506
508
wrint (b , flags )
507
509
wrint (b , s .Size )
@@ -522,8 +524,18 @@ func writesym(ctxt *Link, b *Biobuf, s *LSym) {
522
524
if s .Type == STEXT {
523
525
wrint (b , int64 (s .Args ))
524
526
wrint (b , int64 (s .Locals ))
525
- wrint (b , int64 (s .Nosplit ))
526
- flags := int64 (s .Leaf ) | int64 (s .Cfunc )<< 1
527
+ if s .Nosplit {
528
+ wrint (b , 1 )
529
+ } else {
530
+ wrint (b , 0 )
531
+ }
532
+ flags := int64 (0 )
533
+ if s .Leaf {
534
+ flags |= 1
535
+ }
536
+ if s .Cfunc {
537
+ flags |= 1 << 1
538
+ }
527
539
if s .ReflectMethod {
528
540
flags |= 1 << 2
529
541
}
0 commit comments