So I just did a normal 'ninja check' with a CMake build that enables ASan and the go bindings tests are... busted...

Specifically, the test is causing a link to occur for CGO stuff. It has been running 8 minutes now with Gold, and is producing a 400mb .o file afaict:

% du -hs /tmp/go-build703430446/
397M /tmp/go-build703430446/

What am I doing wrong here?

After sending SIGKILL to the linker (it crossed 10 minutes without showing signs of progress) I get this in the error logs for the go test:

FAIL: LLVM :: Bindings/Go/go.test (11793 of 11793)
******************** TEST ‘LLVM :: Bindings/Go/go.test’ FAILED ********************

I've never seen the link take that long. I assume you aren't using LTO?

I understand that the Go toolchain performs a number of intermediate link steps
before the final link step. (I believe the _cgo_.o file comes from one of those
intermediate steps.) If you modify the first line of test/Bindings/Go/go.test
like this:

; RUN: llvm-go test -x

that should show which command is taking a long time.

Where is your -fsanitize=address flag coming from? If you make lines 172-173
of tools/llvm-go/llvm-go.go look like this:

"CGO_CXXFLAGS=-fsanitize=address " + flags.cxx + " " + cxxflags,
"CGO_LDFLAGS=-fsanitize=address " + flags.ld + " " + ldflags,

does that fix anything? (Although, as you mention, I doubt it.)