forked from OSchip/llvm-project
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:
parent
87c773082a
commit
e8f8873da5
|
@ -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
|
|
|
@ -14,5 +14,3 @@
|
||||||
// +build !byollvm
|
// +build !byollvm
|
||||||
|
|
||||||
package llvm
|
package llvm
|
||||||
|
|
||||||
var _ run_build_sh
|
|
|
@ -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
|
; REQUIRES: shell
|
||||||
; UNSUPPORTED: asan, ubsan, msan
|
; UNSUPPORTED: asan, ubsan, msan
|
||||||
|
|
|
@ -57,4 +57,5 @@ 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['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')
|
||||||
|
|
|
@ -160,7 +160,7 @@ tools.extend([
|
||||||
|
|
||||||
# The following tools are optional
|
# The following tools are optional
|
||||||
tools.extend([
|
tools.extend([
|
||||||
ToolSubst('llvm-go', unresolved='ignore'),
|
ToolSubst('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'),
|
||||||
|
|
|
@ -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 == 'llvm-go':
|
elif self.name == '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
|
||||||
|
|
Loading…
Reference in New Issue