]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: set attributes atomically
authorCherry Zhang <cherryyz@google.com>
Fri, 27 Mar 2020 20:32:22 +0000 (16:32 -0400)
committerCherry Zhang <cherryyz@google.com>
Tue, 31 Mar 2020 16:39:23 +0000 (16:39 +0000)
commit721716ca1cfac23787aa3c722a8eecd9a0d5b296
tree8fc12e36113cc9104315b1ef89604ecb47693ea9
parent6506cf1981435ab8c6f5102cfb7700a4ac68f5a1
[dev.link] cmd/link: set attributes atomically

Now concurrent relocsym may access symbols attributes
concurrently, causing data race when using the race detector. I
think it is still safe as we read/write on different bits, and
not write the same symbol's attributes from multiple goroutines,
so it will always reads the right value regardless whether the
write happens before or after, as long as the memory model is not
so insane.

Use atomic accesses to appease the race detector. It doesn't seem
to cost much, at least on x86.

Change-Id: I2bfc3755ee59c87ed237d508f29d6172fa976392
Reviewed-on: https://go-review.googlesource.com/c/go/+/226368
Reviewed-by: Austin Clements <austin@google.com>
src/cmd/link/internal/sym/attribute.go