Rework go bindings so that validation works fine

Basically change the layout to please `go build` and remove references to
`llvm-go`.

Update llvm/test/Bindings/Go/ to use the system go compiler

Differential Revision: https://reviews.llvm.org/D74540
This commit is contained in:
serge-sans-paille 2020-02-13 12:03:33 +01:00
parent 87c773082a
commit e8f8873da5
32 changed files with 5 additions and 34 deletions

View File

@ -1,28 +0,0 @@
#!/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,5 +14,3 @@
// +build !byollvm
package llvm
var _ run_build_sh

View File

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

View File

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

View File

@ -160,7 +160,7 @@ tools.extend([
# The following tools are optional
tools.extend([
ToolSubst('llvm-go', unresolved='ignore'),
ToolSubst('go', unresolved='ignore'),
ToolSubst('llvm-mt', unresolved='ignore'),
ToolSubst('Kaleidoscope-Ch3', 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':
command += ' -verify-machineinstrs'
elif self.name == 'llvm-go':
elif self.name == 'go':
exe = getattr(config.config, 'go_executable', None)
if exe:
command += ' go=' + exe