cmd/racebuild: don't depend on atomics from libgcc on arm64

gcc by default uses atomic helpers from a runtime library.
Later versions of gcc want _sync versions, like __aarch64_ldadd4_sync.
Earlier versions only want _acq_rel versions, like __aarch64_ldadd4_acq_rel.
So building with a later gcc, but running on a machine with an earlier gcc,
causes the race detector to fail with missing _sync symbols.

"late" = gcc 12
"early" = gcc 7

Not sure where exactly the dividing line is.

To fix, ask gcc to include the atomic helpers in the race library
itself instead of leaving them undefined to be provided by a runtime
library.

Update golang/go#78573
(The actual fix will be rebuilding the .syso with this change)

Change-Id: I43abca3ec212ddfda7e071541a8c136fa920b2c5
Reviewed-on: https://go-review.googlesource.com/c/build/+/783460
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/cmd/racebuild/racebuild.go b/cmd/racebuild/racebuild.go
index 75c0554..de78757 100644
--- a/cmd/racebuild/racebuild.go
+++ b/cmd/racebuild/racebuild.go
@@ -311,7 +311,7 @@
 if [ "$LLVM_PATCH" != "" ]; then
   (cd llvm-project-${REV}/ && patch -p1 < ../patch.patch)
 fi
-(cd llvm-project-${REV}/compiler-rt/lib/tsan/go && ./buildgo.sh)
+(cd llvm-project-${REV}/compiler-rt/lib/tsan/go && EXTRA_CFLAGS=-mno-outline-atomics ./buildgo.sh)
 cp llvm-project-${REV}/compiler-rt/lib/tsan/go/race_linux_arm64.syso go/src/runtime/race
 # work around gomote gettar issue #64195
 mkdir outdir