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

Peter Collingbourne peter at pcc.me.uk
Sun Nov 2 02:16:37 PST 2014


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 llvm.org/llvm/bindings/go/llvm

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.)

Peter

On Sun, Nov 02, 2014 at 01:08:22AM -0800, Chandler Carruth wrote:
> 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
> ********************
> Script:
> --
> /usr/local/google/home/chandlerc/src/llvm/build/./bin/llvm-go test
> llvm.org/llvm/bindings/go/llvm
> --
> Exit Code: 1
> 
> Command Output (stdout):
> --
> FAIL    llvm.org/llvm/bindings/go/llvm [build failed]
> 
> --
> Command Output (stderr):
> --
> # llvm.org/llvm/bindings/go/llvm
> ../include/llvm/ExecutionEngine/MCJIT.h:0: error: undefined reference to
> '__asan_before_dynamic_init'
> ../include/llvm/ExecutionEngine/MCJIT.h:0: error: undefined reference to
> '__asan_after_dynamic_init'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:45: error: undefined reference to
> '__asan_option_detect_stack_use_after_return'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:45: error: undefined reference to
> '__asan_stack_malloc_1'
> /home/chandlerc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.x-google/../../../../include/c++/4.9.x-google/bits/unique_ptr.h:0:
> error: undefined reference to '__asan_option_detect_stack_us
> e_after_return'
> /home/chandlerc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.x-google/../../../../include/c++/4.9.x-google/bits/unique_ptr.h:0:
> error: undefined reference to '__asan_stack_malloc_0'
> /home/chandlerc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.x-google/../../../../include/c++/4.9.x-google/bits/unique_ptr.h:206:
> error: undefined reference to '__asan_report_store8'
> /home/chandlerc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.x-google/../../../../include/c++/4.9.x-google/bits/unique_ptr.h:0:
> error: undefined reference to '__asan_option_detect_stack_us
> e_after_return'
> /home/chandlerc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.x-google/../../../../include/c++/4.9.x-google/bits/unique_ptr.h:0:
> error: undefined reference to '__asan_stack_malloc_0'
> /home/chandlerc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.x-google/../../../../include/c++/4.9.x-google/bits/unique_ptr.h:206:
> error: undefined reference to '__asan_report_store8'
> ../include/llvm/ExecutionEngine/SectionMemoryManager.h:42: error: undefined
> reference to '__asan_report_store8'
> /home/chandlerc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.x-google/../../../../include/c++/4.9.x-google/bits/unique_ptr.h:235:
> error: undefined reference to '__asan_report_load8'
> /home/chandlerc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.x-google/../../../../include/c++/4.9.x-google/bits/unique_ptr.h:237:
> error: undefined reference to '__asan_report_store8'
> /home/chandlerc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.x-google/../../../../include/c++/4.9.x-google/bits/unique_ptr.h:235:
> error: undefined reference to '__asan_report_load8'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:0: error: undefined reference to
> '__asan_option_detect_stack_use_after_return'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:0: error: undefined reference to
> '__asan_stack_malloc_1'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:76: error: undefined reference to
> '__asan_report_load8'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:76: error: undefined reference to
> '__asan_report_load8'
> ../include/llvm/ADT/SmallVector.h:138: error: undefined reference to
> '__asan_handle_no_return'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:0: error: undefined reference to
> '__asan_stack_malloc_0'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:0: error: undefined reference to
> '__asan_stack_malloc_1'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:0: error: undefined reference to
> '__asan_stack_malloc_1'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:0: error: undefined reference to
> '__asan_stack_malloc_0'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:104: error: undefined reference to
> '__asan_handle_no_return'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:0: error: undefined reference to
> '__asan_stack_malloc_2'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:0: error: undefined reference to
> '__asan_stack_malloc_2'
> ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:147: error: undefined reference to
> '__asan_handle_no_return'
> <snip>
> ../lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp:541: error:
> undefined reference to '__asan_stack_free_5'
> /home/chandlerc/src/llvm/build/lib/libLLVMRuntimeDyld.a(RuntimeDyldChecker.cpp.o):../lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp:function
> asan.module_ctor: error: undefined ref
> erence to '__asan_init_v4'
> /home/chandlerc/src/llvm/build/lib/libLLVMRuntimeDyld.a(RuntimeDyldChecker.cpp.o):../lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp:function
> asan.module_ctor: error: undefined ref
> erence to '__asan_register_globals'
> /home/chandlerc/src/llvm/build/lib/libLLVMRuntimeDyld.a(RuntimeDyldChecker.cpp.o):../lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp:function
> asan.module_dtor: error: undefined ref
> erence to '__asan_unregister_globals'
> /home/chandlerc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.x-google/../../../../include/c++/4.9.x-google/bits/stl_pair.h:281:
> error: undefined reference to '__asan_report_load2'
> ../include/llvm/Support/Endian.h:53: error: undefined reference to
> '__asan_report_load_n'
> <snip>
> clang-3.5: error: unable to execute command: Terminated
> clang-3.5: error: linker command failed due to signal (use -v to see
> invocation)
> 
> Seems like all of this is caused by the executable not getting linked with
> -fsanitize=address which might be fixable by catching when ASan is enabled
> in CMake and passing those flags down to the variables used in the
> environment when running the go tests.... But I'm worried that might not
> fix the slow link?
> 
> 
> On Sun, Nov 2, 2014 at 1:02 AM, Chandler Carruth <chandlerc at google.com>
> wrote:
> 
> > 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/
> > llvm.org/llvm/bindings/go/llvm/_test/_obj_test/_cgo_.o
> > 397M    /tmp/go-build703430446/
> > llvm.org/llvm/bindings/go/llvm/_test/_obj_test/_cgo_.o
> >
> > What am I doing wrong here?
> >

> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


-- 
Peter



More information about the llvm-dev mailing list