[llvm] 102814b - Continue removing llgo.

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 11:39:50 PST 2020


That's a good question. Do you know of anyone using the go bindings Peter?

On Mon, Feb 10, 2020, 5:15 PM Eli Friedman <efriedma at quicinc.com> wrote:

> Are you sure it's correct to remove llvm-go?  Grep seems to show it's used
> to build the LLVM go bindings.
>
> -Eli
>
> > -----Original Message-----
> > From: llvm-commits <llvm-commits-bounces at lists.llvm.org> On Behalf Of
> Eric
> > Christopher via llvm-commits
> > Sent: Monday, February 10, 2020 10:34 AM
> > To: llvm-commits at lists.llvm.org
> > Subject: [EXT] [llvm] 102814b - Continue removing llgo.
> >
> >
> > Author: Eric Christopher
> > Date: 2020-02-10T10:33:58-08:00
> > New Revision: 102814b4d36ad004a2e37cd2a1e84bd2c3593d29
> >
> > URL: https://github.com/llvm/llvm-
> > project/commit/102814b4d36ad004a2e37cd2a1e84bd2c3593d29
> > DIFF: https://github.com/llvm/llvm-
> > project/commit/102814b4d36ad004a2e37cd2a1e84bd2c3593d29.diff
> >
> > LOG: Continue removing llgo.
> >
> > Added:
> >
> >
> > Modified:
> >     llvm/.gitignore
> >     llvm/CMakeLists.txt
> >     llvm/CODE_OWNERS.TXT
> >     llvm/docs/CMake.rst
> >     llvm/tools/CMakeLists.txt
> >     llvm/utils/docker/scripts/llvm_checksum/project_tree.py
> >     llvm/utils/git-svn/git-llvm
> >
> > Removed:
> >     llvm/tools/llvm-go/CMakeLists.txt
> >     llvm/tools/llvm-go/llvm-go.go
> >
> >
> > #################################################################
> > ###############
> > diff  --git a/llvm/.gitignore b/llvm/.gitignore
> > index 1f4bb5e4f1c1..f2b343ade4f3 100644
> > --- a/llvm/.gitignore
> > +++ b/llvm/.gitignore
> > @@ -50,8 +50,6 @@ tools/clang
> >  tools/lldb
> >  # lld, which is tracked independently.
> >  tools/lld
> > -# llgo, which is tracked independently.
> > -tools/llgo
> >  # Polly, which is tracked independently.
> >  tools/polly
> >  # avrlit, which is tracked independently.
> >
> > diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
> > index 3dfe8621f525..68d2c1673ed3 100644
> > --- a/llvm/CMakeLists.txt
> > +++ b/llvm/CMakeLists.txt
> > @@ -63,7 +63,7 @@ endif()
> >  # LLVM_EXTERNAL_${project}_SOURCE_DIR using LLVM_ALL_PROJECTS
> >  # This allows an easy way of setting up a build directory for llvm and
> another
> >  # one for llvm+clang+... using the same sources.
> > -set(LLVM_ALL_PROJECTS "clang;clang-tools-extra;compiler-rt;debuginfo-
> >
> tests;libc;libclc;libcxx;libcxxabi;libunwind;lld;lldb;llgo;mlir;openmp;parallel-
> > libs;polly;pstl")
> > +set(LLVM_ALL_PROJECTS "clang;clang-tools-extra;compiler-rt;debuginfo-
> >
> tests;libc;libclc;libcxx;libcxxabi;libunwind;lld;lldb;mlir;openmp;parallel-
> > libs;polly;pstl")
> >  set(LLVM_ENABLE_PROJECTS "" CACHE STRING
> >  "Semicolon-separated list of projects to build (${LLVM_ALL_PROJECTS}),
> > or \"all\".")
> >  if( LLVM_ENABLE_PROJECTS STREQUAL "all" )
> >
> > diff  --git a/llvm/CODE_OWNERS.TXT b/llvm/CODE_OWNERS.TXT
> > index 457dabe39f90..192a774e1cee 100644
> > --- a/llvm/CODE_OWNERS.TXT
> > +++ b/llvm/CODE_OWNERS.TXT
> > @@ -62,7 +62,7 @@ D: libc++
> >
> >  N: Peter Collingbourne
> >  E: peter at pcc.me.uk
> > -D: llgo, libLTO (lib/LTO/* tools/lto/*), LLVM Bitcode (lib/Bitcode/*
> > include/llvm/Bitcode/*)
> > +D: libLTO (lib/LTO/* tools/lto/*), LLVM Bitcode (lib/Bitcode/*
> > include/llvm/Bitcode/*)
> >
> >  N: Quentin Colombet
> >  E: quentin.colombet at gmail.com
> >
> > diff  --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
> > index a86ebb3a37bd..70c81adfee3a 100644
> > --- a/llvm/docs/CMake.rst
> > +++ b/llvm/docs/CMake.rst
> > @@ -383,7 +383,7 @@ LLVM-specific variables
> >    This feature allows to have one build for only LLVM and another for
> clang+llvm
> >    using the same source checkout.
> >    The full list is:
> > -  ``clang;clang-tools-extra;compiler-rt;debuginfo-
> >
> tests;libc;libclc;libcxx;libcxxabi;libunwind;lld;lldb;llgo;openmp;parallel-
> > libs;polly;pstl``
> > +  ``clang;clang-tools-extra;compiler-rt;debuginfo-
> >
> tests;libc;libclc;libcxx;libcxxabi;libunwind;lld;lldb;openmp;parallel-libs;polly;pstl``
> >
> >  **LLVM_EXTERNAL_PROJECTS**:STRING
> >    Semicolon-separated list of additional external projects to build as
> part of
> >
> > diff  --git a/llvm/tools/CMakeLists.txt b/llvm/tools/CMakeLists.txt
> > index 2ac35d733cf9..f419867cb081 100644
> > --- a/llvm/tools/CMakeLists.txt
> > +++ b/llvm/tools/CMakeLists.txt
> > @@ -34,7 +34,6 @@ add_llvm_tool_subdirectory(llvm-profdata)
> >  # Projects supported via LLVM_EXTERNAL_*_SOURCE_DIR need to be
> explicitly
> >  # specified.
> >  add_llvm_external_project(clang)
> > -add_llvm_external_project(llgo)
> >  add_llvm_external_project(lld)
> >  add_llvm_external_project(lldb)
> >  add_llvm_external_project(mlir)
> >
> > diff  --git a/llvm/tools/llvm-go/CMakeLists.txt b/llvm/tools/llvm-
> > go/CMakeLists.txt
> > deleted file mode 100644
> > index 20393f728f8f..000000000000
> > --- a/llvm/tools/llvm-go/CMakeLists.txt
> > +++ /dev/null
> > @@ -1,9 +0,0 @@
> > -if(LLVM_BINDINGS MATCHES "go")
> > -  set(binpath ${CMAKE_BINARY_DIR}/bin/llvm-
> > go${CMAKE_EXECUTABLE_SUFFIX})
> > -  add_custom_command(OUTPUT ${binpath}
> > -    COMMAND ${GO_EXECUTABLE} build -o ${binpath} llvm-go.go
> > -    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/llvm-go.go
> > -    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> > -    COMMENT "Building Go executable llvm-go")
> > -  add_custom_target(llvm-go ALL DEPENDS ${binpath})
> > -endif()
> >
> > diff  --git a/llvm/tools/llvm-go/llvm-go.go
> b/llvm/tools/llvm-go/llvm-go.go
> > deleted file mode 100644
> > index a0561dd5fd8d..000000000000
> > --- a/llvm/tools/llvm-go/llvm-go.go
> > +++ /dev/null
> > @@ -1,311 +0,0 @@
> > -//===-- llvm-go.go - go tool wrapper for LLVM
> -----------------------------===//
> > -//
> > -// Part of the LLVM Project, under the Apache License v2.0 with LLVM
> > Exceptions.
> > -// See https://llvm.org/LICENSE.txt for license information.
> > -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
> > -//
> >
> -//===----------------------------------------------------------------------===//
> > -//
> > -// This tool lets us build LLVM components within the tree by setting
> up a
> > -// $GOPATH that resembles a tree fetched in the normal way with "go
> get".
> > -//
> >
> -//===----------------------------------------------------------------------===//
> > -
> > -package main
> > -
> > -import (
> > -"fmt"
> > -"io/ioutil"
> > -"os"
> > -"os/exec"
> > -"path/filepath"
> > -"runtime"
> > -"strings"
> > -)
> > -
> > -const (
> > -linkmodeComponentLibs = "component-libs"
> > -linkmodeDylib         = "dylib"
> > -)
> > -
> > -type pkg struct {
> > -llvmpath, pkgpath string
> > -}
> > -
> > -var packages = []pkg{
> > -{"bindings/go/llvm", "llvm.org/llvm/bindings/go/llvm"},
> > -}
> > -
> > -type compilerFlags struct {
> > -cpp, cxx, ld string
> > -}
> > -
> > -var components = []string{
> > -"all-targets",
> > -"analysis",
> > -"asmparser",
> > -"asmprinter",
> > -"bitreader",
> > -"bitwriter",
> > -"codegen",
> > -"core",
> > -"coroutines",
> > -"debuginfodwarf",
> > -"executionengine",
> > -"instrumentation",
> > -"interpreter",
> > -"ipo",
> > -"irreader",
> > -"linker",
> > -"mc",
> > -"mcjit",
> > -"objcarcopts",
> > -"option",
> > -"profiledata",
> > -"scalaropts",
> > -"support",
> > -"target",
> > -}
> > -
> > -func llvmConfig(args ...string) string {
> > -configpath := os.Getenv("LLVM_CONFIG")
> > -if configpath == "" {
> > -bin, _ := filepath.Split(os.Args[0])
> > -configpath = filepath.Join(bin, "llvm-config")
> > -}
> > -
> > -cmd := exec.Command(configpath, args...)
> > -cmd.Stderr = os.Stderr
> > -out, err := cmd.Output()
> > -if err != nil {
> > -panic(err.Error())
> > -}
> > -
> > -outstr := string(out)
> > -outstr = strings.TrimSuffix(outstr, "\n")
> > -outstr = strings.Replace(outstr, "\n", " ", -1)
> > -return outstr
> > -}
> > -
> > -func llvmFlags() compilerFlags {
> > -args := append([]string{"--ldflags", "--libs", "--system-libs"},
> > components...)
> > -ldflags := llvmConfig(args...)
> > -stdLibOption := ""
> > -if strings.Contains(llvmConfig("--cxxflags"), "-stdlib=libc++") {
> > -// If libc++ is used to build LLVM libraries, -stdlib=libc++ is
> > -// needed to resolve dependent symbols
> > -stdLibOption = "-stdlib=libc++"
> > -}
> > -if runtime.GOOS != "darwin" {
> > -// OS X doesn't like -rpath with cgo. See:
> > -// https://github.com/golang/go/issues/7293
> > -ldflags = "-Wl,-rpath," + llvmConfig("--libdir") + " " + ldflags
> > -}
> > -return compilerFlags{
> > -cpp: llvmConfig("--cppflags"),
> > -cxx: "-std=c++14" + " " + stdLibOption,
> > -ld:  ldflags,
> > -}
> > -}
> > -
> > -func addTag(args []string, tag string) []string {
> > -args = append([]string{}, args...)
> > -addedTag := false
> > -for i, a := range args {
> > -if strings.HasPrefix(a, "-tags=") {
> > -args[i] = a + " " + tag
> > -addedTag = true
> > -} else if a == "-tags" && i+1 < len(args) {
> > -args[i+1] = args[i+1] + " " + tag
> > -addedTag = true
> > -}
> > -}
> > -if !addedTag {
> > -args = append([]string{args[0], "-tags", tag}, args[1:]...)
> > -}
> > -return args
> > -}
> > -
> > -func printComponents() {
> > -fmt.Println(strings.Join(components, " "))
> > -}
> > -
> > -func printConfig() {
> > -flags := llvmFlags()
> > -
> > -fmt.Printf(`// +build !byollvm
> > -
> > -// This file is generated by llvm-go, do not edit.
> > -
> > -package llvm
> > -
> > -/*
> > -#cgo CPPFLAGS: %s
> > -#cgo CXXFLAGS: %s
> > -#cgo LDFLAGS: %s
> > -*/
> > -import "C"
> > -
> > -type (run_build_sh int)
> > -`, flags.cpp, flags.cxx, flags.ld)
> > -}
> > -
> > -func runGoWithLLVMEnv(args []string, cc, cxx, gocmd, llgo, cppflags,
> cxxflags,
> > ldflags string, packages []pkg) {
> > -args = addTag(args, "byollvm")
> > -
> > -srcdir := llvmConfig("--src-root")
> > -
> > -tmpgopath, err := ioutil.TempDir("", "gopath")
> > -if err != nil {
> > -panic(err.Error())
> > -}
> > -
> > -for _, p := range packages {
> > -path := filepath.Join(tmpgopath, "src", p.pkgpath)
> > -err := os.MkdirAll(filepath.Dir(path), os.ModePerm)
> > -if err != nil {
> > -panic(err.Error())
> > -}
> > -
> > -abspath := p.llvmpath
> > -if !filepath.IsAbs(abspath) {
> > -abspath = filepath.Join(srcdir, abspath)
> > -}
> > -
> > -err = os.Symlink(abspath, path)
> > -if err != nil {
> > -panic(err.Error())
> > -}
> > -}
> > -
> > -newpath := os.Getenv("PATH")
> > -
> > -newgopathlist := []string{tmpgopath}
> > -newgopathlist = append(newgopathlist,
> > filepath.SplitList(os.Getenv("GOPATH"))...)
> > -newgopath := strings.Join(newgopathlist, string(filepath.ListSeparator))
> > -
> > -flags := llvmFlags()
> > -
> > -newenv := []string{
> > -"CC=" + cc,
> > -"CXX=" + cxx,
> > -"CGO_CPPFLAGS=" + flags.cpp + " " + cppflags,
> > -"CGO_CXXFLAGS=" + flags.cxx + " " + cxxflags,
> > -"CGO_LDFLAGS=" + flags.ld + " " + ldflags,
> > -"GOPATH=" + newgopath,
> > -"PATH=" + newpath,
> > -}
> > -if llgo != "" {
> > -newenv = append(newenv, "GCCGO="+llgo)
> > -}
> > -
> > -for _, v := range os.Environ() {
> > -if !strings.HasPrefix(v, "CC=") &&
> > -!strings.HasPrefix(v, "CXX=") &&
> > -!strings.HasPrefix(v, "CGO_CPPFLAGS=") &&
> > -!strings.HasPrefix(v, "CGO_CXXFLAGS=") &&
> > -!strings.HasPrefix(v, "CGO_LDFLAGS=") &&
> > -!strings.HasPrefix(v, "GCCGO=") &&
> > -!strings.HasPrefix(v, "GOPATH=") &&
> > -!strings.HasPrefix(v, "PATH=") {
> > -newenv = append(newenv, v)
> > -}
> > -}
> > -
> > -gocmdpath, err := exec.LookPath(gocmd)
> > -if err != nil {
> > -panic(err.Error())
> > -}
> > -
> > -proc, err := os.StartProcess(gocmdpath, append([]string{gocmd},
> > args...),
> > -&os.ProcAttr{
> > -Env:   newenv,
> > -Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
> > -})
> > -if err != nil {
> > -panic(err.Error())
> > -}
> > -ps, err := proc.Wait()
> > -if err != nil {
> > -panic(err.Error())
> > -}
> > -
> > -os.RemoveAll(tmpgopath)
> > -
> > -if !ps.Success() {
> > -os.Exit(1)
> > -}
> > -}
> > -
> > -func usage() {
> > -fmt.Println(`Usage: llvm-go subcommand [flags]
> > -
> > -Available subcommands: build get install run test print-components
> print-
> > config`)
> > -os.Exit(0)
> > -}
> > -
> > -func main() {
> > -cc := os.Getenv("CC")
> > -cxx := os.Getenv("CXX")
> > -cppflags := os.Getenv("CGO_CPPFLAGS")
> > -cxxflags := os.Getenv("CGO_CXXFLAGS")
> > -ldflags := os.Getenv("CGO_LDFLAGS")
> > -gocmd := "go"
> > -llgo := ""
> > -packagesString := ""
> > -
> > -flags := []struct {
> > -name string
> > -dest *string
> > -}{
> > -{"cc", &cc},
> > -{"cxx", &cxx},
> > -{"go", &gocmd},
> > -{"llgo", &llgo},
> > -{"cppflags", &cppflags},
> > -{"ldflags", &ldflags},
> > -{"packages", &packagesString},
> > -}
> > -
> > -args := os.Args[1:]
> > -LOOP:
> > -for {
> > -if len(args) == 0 {
> > -usage()
> > -}
> > -for _, flag := range flags {
> > -if strings.HasPrefix(args[0], flag.name+"=") {
> > -*flag.dest = args[0][len(flag.name)+1:]
> > -args = args[1:]
> > -continue LOOP
> > -}
> > -}
> > -break
> > -}
> > -
> > -packages := packages
> > -if packagesString != "" {
> > -for _, field := range strings.Fields(packagesString) {
> > -pos := strings.IndexRune(field, '=')
> > -if pos == -1 {
> > -fmt.Fprintf(os.Stderr, "invalid packages value
> > %q, expected 'pkgpath=llvmpath [pkgpath=llvmpath ...]'\n",
> packagesString)
> > -os.Exit(1)
> > -}
> > -packages = append(packages, pkg{
> > -pkgpath:  field[:pos],
> > -llvmpath: field[pos+1:],
> > -})
> > -}
> > -}
> > -
> > -switch args[0] {
> > -case "build", "get", "install", "run", "test":
> > -runGoWithLLVMEnv(args, cc, cxx, gocmd, llgo, cppflags,
> > cxxflags, ldflags, packages)
> > -case "print-components":
> > -printComponents()
> > -case "print-config":
> > -printConfig()
> > -default:
> > -usage()
> > -}
> > -}
> >
> > diff  --git a/llvm/utils/docker/scripts/llvm_checksum/project_tree.py
> > b/llvm/utils/docker/scripts/llvm_checksum/project_tree.py
> > index 31d8703ba234..20e225662ce5 100644
> > --- a/llvm/utils/docker/scripts/llvm_checksum/project_tree.py
> > +++ b/llvm/utils/docker/scripts/llvm_checksum/project_tree.py
> > @@ -72,7 +72,7 @@ def CreateLLVMProjects(single_tree_checkout):
> >        "parallel-libs", "test-suite"
> >    ]
> >    # Projects that reside inside 'tools/' in a single source tree
> checkout.
> > -  TOOLS_PROJECTS = ["clang", "lld", "lldb", "llgo"]
> > +  TOOLS_PROJECTS = ["clang", "lld", "lldb"]
> >
> >    if single_tree_checkout:
> >      projects = [LLVMProject("llvm", "")]
> >
> > diff  --git a/llvm/utils/git-svn/git-llvm b/llvm/utils/git-svn/git-llvm
> > index bc60e02aae39..bce285aaeb4b 100755
> > --- a/llvm/utils/git-svn/git-llvm
> > +++ b/llvm/utils/git-svn/git-llvm
> > @@ -72,7 +72,6 @@ LLVM_MONOREPO_SVN_MAPPING = {
> >          'libunwind',
> >          'lld',
> >          'lldb',
> > -        'llgo',
> >          'llvm',
> >          'openmp',
> >          'parallel-libs',
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200211/3b6b88e8/attachment.html>


More information about the llvm-commits mailing list