llvm: default to LLVM 18
This commit is contained in:
6
.github/workflows/go.yml
vendored
6
.github/workflows/go.yml
vendored
@@ -15,14 +15,14 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, ubuntu-latest]
|
os: [macos-latest, ubuntu-latest]
|
||||||
llvm: [17]
|
llvm: [18]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Update Homebrew
|
- name: Update Homebrew
|
||||||
# needed as long as LLVM 17 is still fresh
|
# needed as long as LLVM 18 is still fresh
|
||||||
if: matrix.llvm == 17 && startsWith(matrix.os, 'macos')
|
if: matrix.llvm == 18 && startsWith(matrix.os, 'macos')
|
||||||
run: brew update
|
run: brew update
|
||||||
- name: Install LLVM ${{ matrix.llvm }} and bdw-gc
|
- name: Install LLVM ${{ matrix.llvm }} and bdw-gc
|
||||||
if: startsWith(matrix.os, 'macos')
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -251,9 +251,9 @@ Here are the Go packages that can be imported correctly:
|
|||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
- [Go 1.20+](https://go.dev) (build only)
|
- [Go 1.20+](https://go.dev) (build only)
|
||||||
- [LLVM 17](https://llvm.org)
|
- [LLVM 18](https://llvm.org)
|
||||||
- [LLD 17](https://lld.llvm.org)
|
- [LLD 18](https://lld.llvm.org)
|
||||||
- [Clang 17](https://clang.llvm.org)
|
- [Clang 18](https://clang.llvm.org)
|
||||||
- [pkg-config 0.29+](https://www.freedesktop.org/wiki/Software/pkg-config/)
|
- [pkg-config 0.29+](https://www.freedesktop.org/wiki/Software/pkg-config/)
|
||||||
- [bdwgc/libgc 8.0+](https://www.hboehm.info/gc/)
|
- [bdwgc/libgc 8.0+](https://www.hboehm.info/gc/)
|
||||||
- [cJSON 1.7+](https://github.com/DaveGamble/cJSON) (optional, for [github.com/goplus/llgo/c/cjson](https://pkg.go.dev/github.com/goplus/llgo/c/cjson))
|
- [cJSON 1.7+](https://github.com/DaveGamble/cJSON) (optional, for [github.com/goplus/llgo/c/cjson](https://pkg.go.dev/github.com/goplus/llgo/c/cjson))
|
||||||
@@ -268,10 +268,9 @@ Follow these steps to generate the `llgo` command (its usage is the same as the
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
brew update # execute if needed
|
brew update # execute if needed
|
||||||
brew install llvm@17 pkg-config libgc
|
brew install llvm@18 pkg-config libgc
|
||||||
brew install cjson sqlite python@3.12 # optional
|
brew install cjson sqlite python@3.12 # optional
|
||||||
export PATH=$(brew --prefix llvm@17)/bin:$PATH # you may want to add this to your shell RC file, e.g. ~/.zshrc
|
export PATH=$(brew --prefix llvm@18)/bin:$PATH # you may want to add this to your shell RC file, e.g. ~/.zshrc
|
||||||
export CC=clang CXX=clang++ # only for go build; optional if you have other compatible compilers
|
|
||||||
git clone https://github.com/goplus/llgo.git
|
git clone https://github.com/goplus/llgo.git
|
||||||
cd llgo
|
cd llgo
|
||||||
export LLGOROOT="/path/to/llgo" # Replace this with the root directory of the llgo project
|
export LLGOROOT="/path/to/llgo" # Replace this with the root directory of the llgo project
|
||||||
@@ -281,13 +280,12 @@ go install -v ./...
|
|||||||
### on Linux (Debian/Ubuntu)
|
### on Linux (Debian/Ubuntu)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-17 main" | sudo tee /etc/apt/sources.list.d/llvm.list
|
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list
|
||||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
sudo apt-get update # execute if needed
|
sudo apt-get update # execute if needed
|
||||||
sudo apt-get install -y llvm-17-dev clang-17 lld-17 pkg-config libgc-dev
|
sudo apt-get install -y llvm-18-dev clang-18 lld-18 pkg-config libgc-dev
|
||||||
sudo apt-get install -y libcjson-dev libsqlite3-dev python3.12-dev # optional
|
sudo apt-get install -y libcjson-dev libsqlite3-dev python3.12-dev # optional
|
||||||
export PATH=/usr/lib/llvm-17/bin:$PATH # you may want to add this to your shell RC file, e.g. ~/.bashrc
|
export PATH=/usr/lib/llvm-18/bin:$PATH # you may want to add this to your shell RC file, e.g. ~/.bashrc
|
||||||
export CC=clang CXX=clang++ # only for go build; optional if you have other compatible compilers
|
|
||||||
git clone https://github.com/goplus/llgo.git
|
git clone https://github.com/goplus/llgo.git
|
||||||
cd llgo
|
cd llgo
|
||||||
export LLGOROOT="/path/to/llgo" # Replace this with the root directory of the llgo project
|
export LLGOROOT="/path/to/llgo" # Replace this with the root directory of the llgo project
|
||||||
|
|||||||
@@ -86,9 +86,9 @@ _llgo_0:
|
|||||||
%5 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 1
|
%5 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 1
|
||||||
store ptr %1, ptr %5, align 8
|
store ptr %1, ptr %5, align 8
|
||||||
%6 = load { ptr, ptr }, ptr %3, align 8
|
%6 = load { ptr, ptr }, ptr %3, align 8
|
||||||
call void @main.assert(i1 true)
|
call void @main.assert(i1 icmp ne (ptr @main.test, { ptr, ptr } zeroinitializer))
|
||||||
call void @main.assert(i1 true)
|
call void @main.assert(i1 icmp ne (ptr @main.test, { ptr, ptr } zeroinitializer))
|
||||||
call void @main.assert(i1 true)
|
call void @main.assert(i1 icmp ne (ptr @"main.init#1$1", { ptr, ptr } zeroinitializer))
|
||||||
%7 = extractvalue { ptr, ptr } %6, 0
|
%7 = extractvalue { ptr, ptr } %6, 0
|
||||||
%8 = icmp ne ptr %7, null
|
%8 = icmp ne ptr %7, null
|
||||||
call void @main.assert(i1 %8)
|
call void @main.assert(i1 %8)
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -5,7 +5,7 @@ go 1.20
|
|||||||
require (
|
require (
|
||||||
github.com/aykevl/go-wasm v0.0.1
|
github.com/aykevl/go-wasm v0.0.1
|
||||||
github.com/goplus/gogen v1.16.0
|
github.com/goplus/gogen v1.16.0
|
||||||
github.com/goplus/llvm v0.7.6
|
github.com/goplus/llvm v0.8.0
|
||||||
github.com/goplus/mod v0.13.10
|
github.com/goplus/mod v0.13.10
|
||||||
github.com/json-iterator/go v1.1.12
|
github.com/json-iterator/go v1.1.12
|
||||||
github.com/qiniu/x v1.13.10
|
github.com/qiniu/x v1.13.10
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -6,8 +6,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
|||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/goplus/gogen v1.16.0 h1:hAK2ZX8vCjH+Y2QoJl9viSZ8Gw9pzE0vCz5voYBYnv4=
|
github.com/goplus/gogen v1.16.0 h1:hAK2ZX8vCjH+Y2QoJl9viSZ8Gw9pzE0vCz5voYBYnv4=
|
||||||
github.com/goplus/gogen v1.16.0/go.mod h1:92qEzVgv7y8JEFICWG9GvYI5IzfEkxYdsA1DbmnTkqk=
|
github.com/goplus/gogen v1.16.0/go.mod h1:92qEzVgv7y8JEFICWG9GvYI5IzfEkxYdsA1DbmnTkqk=
|
||||||
github.com/goplus/llvm v0.7.6 h1:1yFRS0fLj/Jk9BNMMWGd9tuPP8nRclTaX48pWogVd5c=
|
github.com/goplus/llvm v0.8.0 h1:9eFutGm3d0G7bAd8/e+Tuyva0tu1IPNPm0kVG4AgHwY=
|
||||||
github.com/goplus/llvm v0.7.6/go.mod h1:PeVK8GgzxwAYCiMiUAJb5wJR6xbhj989tu9oulKLLT4=
|
github.com/goplus/llvm v0.8.0/go.mod h1:PeVK8GgzxwAYCiMiUAJb5wJR6xbhj989tu9oulKLLT4=
|
||||||
github.com/goplus/mod v0.13.10 h1:5Om6KOvo31daN7N30kWU1vC5zhsJPM+uPbcEN/FnlzE=
|
github.com/goplus/mod v0.13.10 h1:5Om6KOvo31daN7N30kWU1vC5zhsJPM+uPbcEN/FnlzE=
|
||||||
github.com/goplus/mod v0.13.10/go.mod h1:HDuPZgpWiaTp3PUolFgsiX+Q77cbUWB/mikVHfYND3c=
|
github.com/goplus/mod v0.13.10/go.mod h1:HDuPZgpWiaTp3PUolFgsiX+Q77cbUWB/mikVHfYND3c=
|
||||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build !byollvm && darwin && amd64 && !llvm14 && !llvm15 && !llvm16
|
//go:build !byollvm && darwin && amd64 && llvm17
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||||
|
|||||||
21
xtool/env/llvm/llvm_config_darwin_amd64_llvm18.go
vendored
Normal file
21
xtool/env/llvm/llvm_config_darwin_amd64_llvm18.go
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
//go:build !byollvm && darwin && amd64 && !llvm14 && !llvm15 && !llvm16 && !llvm17
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package llvm
|
||||||
|
|
||||||
|
const ldLLVMConfigBin = "/usr/local/opt/llvm@18/bin/llvm-config"
|
||||||
2
xtool/env/llvm/llvm_config_darwin_llvm17.go
vendored
2
xtool/env/llvm/llvm_config_darwin_llvm17.go
vendored
@@ -1,4 +1,4 @@
|
|||||||
//go:build !byollvm && darwin && !amd64 && !llvm14 && !llvm15 && !llvm16
|
//go:build !byollvm && darwin && !amd64 && llvm17
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||||
|
|||||||
21
xtool/env/llvm/llvm_config_darwin_llvm18.go
vendored
Normal file
21
xtool/env/llvm/llvm_config_darwin_llvm18.go
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
//go:build !byollvm && darwin && !amd64 && !llvm14 && !llvm15 && !llvm16 && !llvm17
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package llvm
|
||||||
|
|
||||||
|
const ldLLVMConfigBin = "/opt/homebrew/opt/llvm@18/bin/llvm-config"
|
||||||
2
xtool/env/llvm/llvm_config_linux_llvm17.go
vendored
2
xtool/env/llvm/llvm_config_linux_llvm17.go
vendored
@@ -1,4 +1,4 @@
|
|||||||
//go:build !byollvm && linux && !llvm14 && !llvm15 && !llvm16
|
//go:build !byollvm && linux && llvm17
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||||
|
|||||||
21
xtool/env/llvm/llvm_config_linux_llvm18.go
vendored
Normal file
21
xtool/env/llvm/llvm_config_linux_llvm18.go
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
//go:build !byollvm && linux && !llvm14 && !llvm15 && !llvm16 && !llvm17
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package llvm
|
||||||
|
|
||||||
|
const ldLLVMConfigBin = "/usr/lib/llvm-18/bin/llvm-config"
|
||||||
Reference in New Issue
Block a user