Revert "Rework go bindings so that validation works fine"

And add llvm-go back to the test dependencies.

No longer necessary now that llvm-go has been brought back.

This reverts commit e8f8873da5.
This commit is contained in:
Peter Collingbourne 2020-02-24 09:11:15 -08:00
parent 453d54865a
commit 0414c56940
33 changed files with 38 additions and 5 deletions

28
llvm/bindings/go/build.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh -xe
gollvmdir=$(dirname "$0")/llvm
workdir=$gollvmdir/workdir
llvmdir=$gollvmdir/../../..
llvm_builddir=$workdir/llvm_build
mkdir -p $llvm_builddir
cmake_flags="../../../../.. $@"
llvm_config="$llvm_builddir/bin/llvm-config"
llvm_go="$llvm_builddir/bin/llvm-go"
if test -n "`which ninja`" ; then
# If Ninja is available, we can speed up the build by building only the
# required subset of LLVM.
(cd $llvm_builddir && cmake -G Ninja $cmake_flags)
ninja -C $llvm_builddir llvm-config llvm-go
llvm_components="$($llvm_go print-components)"
llvm_buildtargets="$($llvm_config --libs $llvm_components | sed -e 's/-l//g')"
ninja -C $llvm_builddir $llvm_buildtargets FileCheck
else
(cd $llvm_builddir && cmake $cmake_flags)
make -C $llvm_builddir -j4
fi
$llvm_go print-config > $gollvmdir/llvm_config.go

View File

@ -14,3 +14,5 @@
// +build !byollvm // +build !byollvm
package llvm package llvm
var _ run_build_sh

View File

@ -1,4 +1,4 @@
; RUN: CGO_CPPFLAGS="`llvm-config --cppflags`" CGO_CXXFLAGS=-std=c++14 CGO_LDFLAGS="`llvm-config --ldflags --libs --system-libs all`" go test llvm ; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm
; REQUIRES: shell ; REQUIRES: shell
; UNSUPPORTED: asan, ubsan, msan ; UNSUPPORTED: asan, ubsan, msan

View File

@ -57,5 +57,4 @@ def fixup_compiler_path(compiler):
config.environment['CC'] = fixup_compiler_path(config.host_cc) config.environment['CC'] = fixup_compiler_path(config.host_cc)
config.environment['CXX'] = fixup_compiler_path(config.host_cxx) config.environment['CXX'] = fixup_compiler_path(config.host_cxx)
config.environment['LD_LIBRARY_PATH'] = config.llvm_shlib_dir config.environment['CGO_LDFLAGS'] = config.host_ldflags
config.environment['GOPATH'] = os.path.join(config.llvm_src_root, 'bindings', 'go')

View File

@ -122,6 +122,10 @@ if(TARGET LLVMgold)
set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LLVMgold) set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LLVMgold)
endif() endif()
if(TARGET llvm-go)
set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-go)
endif()
if(TARGET LTO) if(TARGET LTO)
set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO) set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
endif() endif()

View File

@ -160,7 +160,7 @@ tools.extend([
# The following tools are optional # The following tools are optional
tools.extend([ tools.extend([
ToolSubst('go', unresolved='ignore'), ToolSubst('llvm-go', unresolved='ignore'),
ToolSubst('llvm-mt', unresolved='ignore'), ToolSubst('llvm-mt', unresolved='ignore'),
ToolSubst('Kaleidoscope-Ch3', unresolved='ignore'), ToolSubst('Kaleidoscope-Ch3', unresolved='ignore'),
ToolSubst('Kaleidoscope-Ch4', unresolved='ignore'), ToolSubst('Kaleidoscope-Ch4', unresolved='ignore'),

View File

@ -23,7 +23,7 @@ class FindTool(object):
if self.name == 'llc' and os.environ.get('LLVM_ENABLE_MACHINE_VERIFIER') == '1': if self.name == 'llc' and os.environ.get('LLVM_ENABLE_MACHINE_VERIFIER') == '1':
command += ' -verify-machineinstrs' command += ' -verify-machineinstrs'
elif self.name == 'go': elif self.name == 'llvm-go':
exe = getattr(config.config, 'go_executable', None) exe = getattr(config.config, 'go_executable', None)
if exe: if exe:
command += ' go=' + exe command += ' go=' + exe