mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 12:33:42 +00:00
Compare commits
109 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e60eeb368 | |||
| e5a8d69300 | |||
| 4f8672c9ab | |||
| a7416e7300 | |||
| d63d8e0899 | |||
| 8e009de8a8 | |||
| d6527ece02 | |||
| 211425c3e9 | |||
| 429aea8e74 | |||
| 7755780a49 | |||
| 3a7c25f987 | |||
| a4cbe3326e | |||
| 5282b4efac | |||
| 6a25fd494e | |||
| d95c1b5982 | |||
| 24eed9e376 | |||
| c2af1d183e | |||
| 64651115c2 | |||
| b6c3d142db | |||
| fafe80704f | |||
| a2be2f3330 | |||
| 05fc49a0cf | |||
| 417aa4312e | |||
| bf88cdea90 | |||
| c8d0b87a67 | |||
| 99a618385b | |||
| 9e143efd73 | |||
| d5c70a1cd3 | |||
| bbb2b0c95b | |||
| 4768c7d431 | |||
| 4f7c64cb24 | |||
| ff2a79de7c | |||
| 04c7057ea6 | |||
| f76e8d2812 | |||
| bcdc5e0097 | |||
| 2bee29959b | |||
| cab3834bc9 | |||
| 7f970a45c2 | |||
| ebf70ab18e | |||
| 226744a538 | |||
| dc876c6ed4 | |||
| 5a09084c73 | |||
| 6c9074772c | |||
| e49663809b | |||
| 7d6d93f7aa | |||
| 8c54e3dd88 | |||
| 47c0debe4b | |||
| 9a1cde40a8 | |||
| 20fc814635 | |||
| 64d8a04308 | |||
| b95effbdd7 | |||
| 92c130c7be | |||
| 31c4bc1151 | |||
| 42f5e55ed5 | |||
| 81da7bb4c1 | |||
| 209754493b | |||
| b0aef96340 | |||
| 056394e24b | |||
| 1545659817 | |||
| 38e3d55e64 | |||
| 66da29e89f | |||
| c180d6fe2f | |||
| cdea833b5c | |||
| c2eaa495df | |||
| 3476100dd0 | |||
| 07c7eff3c3 | |||
| a1be8cd9fe | |||
| 52b9fcd57f | |||
| ea53ace270 | |||
| a6cd072fa1 | |||
| 4372dbdd41 | |||
| 17bb1fec44 | |||
| f4fd79f7be | |||
| 811b13a9d3 | |||
| 6e97079367 | |||
| 9c7bbce029 | |||
| 0ec1cb1e19 | |||
| e7118e5bda | |||
| 150d9d1c6b | |||
| 8fe039156b | |||
| 2d17dec7bf | |||
| c1b267a208 | |||
| f02c56c9e0 | |||
| c5879c682c | |||
| 190c20825f | |||
| d04eea7185 | |||
| f24cd31895 | |||
| 2044f6fbcc | |||
| d55a89f96a | |||
| 080a6648e9 | |||
| ec0a142190 | |||
| b7fcf6ad68 | |||
| 7417c14c2d | |||
| 4f39be9c3b | |||
| 7305a44f0c | |||
| 74effd2fa9 | |||
| 9e9768b51d | |||
| 127557d27e | |||
| fd89e9b83a | |||
| 5a1b885024 | |||
| b15adf23f8 | |||
| 29d2719bad | |||
| 194438cdd6 | |||
| 217f677bbe | |||
| 16b0f4cc9a | |||
| ff15b474fd | |||
| 3efc6340ad | |||
| 0426a5f902 | |||
| b898916d52 |
@@ -10,12 +10,12 @@ commands:
|
|||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- llvm-source-18-v1
|
- llvm-source-19-v1
|
||||||
- run:
|
- run:
|
||||||
name: "Fetch LLVM source"
|
name: "Fetch LLVM source"
|
||||||
command: make llvm-source
|
command: make llvm-source
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: llvm-source-18-v1
|
key: llvm-source-19-v1
|
||||||
paths:
|
paths:
|
||||||
- llvm-project/clang/lib/Headers
|
- llvm-project/clang/lib/Headers
|
||||||
- llvm-project/clang/include
|
- llvm-project/clang/include
|
||||||
@@ -109,12 +109,12 @@ jobs:
|
|||||||
# "make lint" fails before go 1.21 because internal/tools/go.mod specifies packages that require go 1.21
|
# "make lint" fails before go 1.21 because internal/tools/go.mod specifies packages that require go 1.21
|
||||||
fmt-check: false
|
fmt-check: false
|
||||||
resource_class: large
|
resource_class: large
|
||||||
test-llvm18-go123:
|
test-llvm19-go124:
|
||||||
docker:
|
docker:
|
||||||
- image: golang:1.23-bullseye
|
- image: golang:1.24-bullseye
|
||||||
steps:
|
steps:
|
||||||
- test-linux:
|
- test-linux:
|
||||||
llvm: "18"
|
llvm: "19"
|
||||||
resource_class: large
|
resource_class: large
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
@@ -123,5 +123,5 @@ workflows:
|
|||||||
# This tests our lowest supported versions of Go and LLVM, to make sure at
|
# This tests our lowest supported versions of Go and LLVM, to make sure at
|
||||||
# least the smoke tests still pass.
|
# least the smoke tests still pass.
|
||||||
- test-llvm15-go119
|
- test-llvm15-go119
|
||||||
# This tests LLVM 18 support when linking against system libraries.
|
# This tests LLVM 19 support when linking against system libraries.
|
||||||
- test-llvm18-go123
|
- test-llvm19-go124
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ jobs:
|
|||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.24'
|
||||||
cache: true
|
cache: true
|
||||||
- name: Restore LLVM source cache
|
- name: Restore LLVM source cache
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-source
|
id: cache-llvm-source
|
||||||
with:
|
with:
|
||||||
key: llvm-source-18-${{ matrix.os }}-v2
|
key: llvm-source-19-${{ matrix.os }}-v1
|
||||||
path: |
|
path: |
|
||||||
llvm-project/clang/lib/Headers
|
llvm-project/clang/lib/Headers
|
||||||
llvm-project/clang/include
|
llvm-project/clang/include
|
||||||
@@ -70,7 +70,7 @@ jobs:
|
|||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-build
|
id: cache-llvm-build
|
||||||
with:
|
with:
|
||||||
key: llvm-build-18-${{ matrix.os }}-v3
|
key: llvm-build-19-${{ matrix.os }}-v1
|
||||||
path: llvm-build
|
path: llvm-build
|
||||||
- name: Build LLVM
|
- name: Build LLVM
|
||||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||||
@@ -126,7 +126,7 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
version: [16, 17, 18]
|
version: [16, 17, 18, 19]
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Homebrew
|
- name: Set up Homebrew
|
||||||
uses: Homebrew/actions/setup-homebrew@master
|
uses: Homebrew/actions/setup-homebrew@master
|
||||||
@@ -143,15 +143,15 @@ jobs:
|
|||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.24'
|
||||||
cache: true
|
cache: true
|
||||||
- name: Build TinyGo (LLVM ${{ matrix.version }})
|
- name: Build TinyGo (LLVM ${{ matrix.version }})
|
||||||
run: go install -tags=llvm${{ matrix.version }}
|
run: go install -tags=llvm${{ matrix.version }}
|
||||||
- name: Check binary
|
- name: Check binary
|
||||||
run: tinygo version
|
run: tinygo version
|
||||||
- name: Build TinyGo (default LLVM)
|
- name: Build TinyGo (default LLVM)
|
||||||
if: matrix.version == 18
|
if: matrix.version == 19
|
||||||
run: go install
|
run: go install
|
||||||
- name: Check binary
|
- name: Check binary
|
||||||
if: matrix.version == 18
|
if: matrix.version == 19
|
||||||
run: tinygo version
|
run: tinygo version
|
||||||
|
|||||||
+16
-15
@@ -18,7 +18,7 @@ jobs:
|
|||||||
# statically linked binary.
|
# statically linked binary.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: golang:1.23-alpine
|
image: golang:1.24-alpine
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.version.outputs.version }}
|
version: ${{ steps.version.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
@@ -48,7 +48,7 @@ jobs:
|
|||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-source
|
id: cache-llvm-source
|
||||||
with:
|
with:
|
||||||
key: llvm-source-18-linux-alpine-v1
|
key: llvm-source-19-linux-alpine-v1
|
||||||
path: |
|
path: |
|
||||||
llvm-project/clang/lib/Headers
|
llvm-project/clang/lib/Headers
|
||||||
llvm-project/clang/include
|
llvm-project/clang/include
|
||||||
@@ -73,7 +73,7 @@ jobs:
|
|||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-build
|
id: cache-llvm-build
|
||||||
with:
|
with:
|
||||||
key: llvm-build-18-linux-alpine-v2
|
key: llvm-build-19-linux-alpine-v1
|
||||||
path: llvm-build
|
path: llvm-build
|
||||||
- name: Build LLVM
|
- name: Build LLVM
|
||||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||||
@@ -146,12 +146,12 @@ jobs:
|
|||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.24'
|
||||||
cache: true
|
cache: true
|
||||||
- name: Install wasmtime
|
- name: Install wasmtime
|
||||||
uses: bytecodealliance/actions/wasmtime/setup@v1
|
uses: bytecodealliance/actions/wasmtime/setup@v1
|
||||||
with:
|
with:
|
||||||
version: "19.0.1"
|
version: "29.0.1"
|
||||||
- name: Install wasm-tools
|
- name: Install wasm-tools
|
||||||
uses: bytecodealliance/actions/wasm-tools/setup@v1
|
uses: bytecodealliance/actions/wasm-tools/setup@v1
|
||||||
- name: Download release artifact
|
- name: Download release artifact
|
||||||
@@ -165,11 +165,12 @@ jobs:
|
|||||||
ln -s ~/lib/tinygo/bin/tinygo ~/go/bin/tinygo
|
ln -s ~/lib/tinygo/bin/tinygo ~/go/bin/tinygo
|
||||||
- run: make tinygo-test-wasip1-fast
|
- run: make tinygo-test-wasip1-fast
|
||||||
- run: make tinygo-test-wasip2-fast
|
- run: make tinygo-test-wasip2-fast
|
||||||
|
- run: make tinygo-test-wasm
|
||||||
- run: make smoketest
|
- run: make smoketest
|
||||||
assert-test-linux:
|
assert-test-linux:
|
||||||
# Run all tests that can run on Linux, with LLVM assertions enabled to catch
|
# Run all tests that can run on Linux, with LLVM assertions enabled to catch
|
||||||
# potential bugs.
|
# potential bugs.
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -189,7 +190,7 @@ jobs:
|
|||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.24'
|
||||||
cache: true
|
cache: true
|
||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@@ -198,14 +199,14 @@ jobs:
|
|||||||
- name: Install wasmtime
|
- name: Install wasmtime
|
||||||
uses: bytecodealliance/actions/wasmtime/setup@v1
|
uses: bytecodealliance/actions/wasmtime/setup@v1
|
||||||
with:
|
with:
|
||||||
version: "19.0.1"
|
version: "29.0.1"
|
||||||
- name: Setup `wasm-tools`
|
- name: Setup `wasm-tools`
|
||||||
uses: bytecodealliance/actions/wasm-tools/setup@v1
|
uses: bytecodealliance/actions/wasm-tools/setup@v1
|
||||||
- name: Restore LLVM source cache
|
- name: Restore LLVM source cache
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-source
|
id: cache-llvm-source
|
||||||
with:
|
with:
|
||||||
key: llvm-source-18-linux-asserts-v1
|
key: llvm-source-19-linux-asserts-v1
|
||||||
path: |
|
path: |
|
||||||
llvm-project/clang/lib/Headers
|
llvm-project/clang/lib/Headers
|
||||||
llvm-project/clang/include
|
llvm-project/clang/include
|
||||||
@@ -230,7 +231,7 @@ jobs:
|
|||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-build
|
id: cache-llvm-build
|
||||||
with:
|
with:
|
||||||
key: llvm-build-18-linux-asserts-v2
|
key: llvm-build-19-linux-asserts-v1
|
||||||
path: llvm-build
|
path: llvm-build
|
||||||
- name: Build LLVM
|
- name: Build LLVM
|
||||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||||
@@ -277,7 +278,7 @@ jobs:
|
|||||||
run: make tinygo-test
|
run: make tinygo-test
|
||||||
- run: make smoketest
|
- run: make smoketest
|
||||||
- run: make wasmtest
|
- run: make wasmtest
|
||||||
- run: make tinygo-baremetal
|
- run: make tinygo-test-baremetal
|
||||||
build-linux-cross:
|
build-linux-cross:
|
||||||
# Build ARM Linux binaries, ready for release.
|
# Build ARM Linux binaries, ready for release.
|
||||||
# This intentionally uses an older Linux image, so that we compile against
|
# This intentionally uses an older Linux image, so that we compile against
|
||||||
@@ -297,7 +298,7 @@ jobs:
|
|||||||
- goarch: arm
|
- goarch: arm
|
||||||
toolchain: arm-linux-gnueabihf
|
toolchain: arm-linux-gnueabihf
|
||||||
libc: armhf
|
libc: armhf
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-22.04 # note: use the oldest image available! (see above)
|
||||||
needs: build-linux
|
needs: build-linux
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -315,13 +316,13 @@ jobs:
|
|||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.24'
|
||||||
cache: true
|
cache: true
|
||||||
- name: Restore LLVM source cache
|
- name: Restore LLVM source cache
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-source
|
id: cache-llvm-source
|
||||||
with:
|
with:
|
||||||
key: llvm-source-18-linux-v1
|
key: llvm-source-19-linux-v1
|
||||||
path: |
|
path: |
|
||||||
llvm-project/clang/lib/Headers
|
llvm-project/clang/lib/Headers
|
||||||
llvm-project/clang/include
|
llvm-project/clang/include
|
||||||
@@ -346,7 +347,7 @@ jobs:
|
|||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-build
|
id: cache-llvm-build
|
||||||
with:
|
with:
|
||||||
key: llvm-build-18-linux-${{ matrix.goarch }}-v2
|
key: llvm-build-19-linux-${{ matrix.goarch }}-v3
|
||||||
path: llvm-build
|
path: llvm-build
|
||||||
- name: Build LLVM
|
- name: Build LLVM
|
||||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ jobs:
|
|||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
tinygo/llvm-18
|
tinygo/llvm-19
|
||||||
ghcr.io/${{ github.repository_owner }}/llvm-18
|
ghcr.io/${{ github.repository_owner }}/llvm-19
|
||||||
tags: |
|
tags: |
|
||||||
type=sha,format=long
|
type=sha,format=long
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ jobs:
|
|||||||
run: sudo apt-get remove llvm-18
|
run: sudo apt-get remove llvm-18
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Pull musl
|
- name: Pull musl, bdwgc
|
||||||
run: |
|
run: |
|
||||||
git submodule update --init lib/musl
|
git submodule update --init lib/musl lib/bdwgc
|
||||||
- name: Restore LLVM source cache
|
- name: Restore LLVM source cache
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-source
|
id: cache-llvm-source
|
||||||
with:
|
with:
|
||||||
key: llvm-source-18-linux-nix-v1
|
key: llvm-source-19-linux-nix-v1
|
||||||
path: |
|
path: |
|
||||||
llvm-project/compiler-rt
|
llvm-project/compiler-rt
|
||||||
- name: Download LLVM source
|
- name: Download LLVM source
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
# still works after checking out the dev branch (that is, when going from LLVM
|
# still works after checking out the dev branch (that is, when going from LLVM
|
||||||
# 16 to LLVM 17 for example, both Clang 16 and Clang 17 are installed).
|
# 16 to LLVM 17 for example, both Clang 16 and Clang 17 are installed).
|
||||||
|
|
||||||
echo 'deb https://apt.llvm.org/noble/ llvm-toolchain-noble-18 main' | sudo tee /etc/apt/sources.list.d/llvm.list
|
echo 'deb https://apt.llvm.org/noble/ llvm-toolchain-noble-19 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
|
sudo apt-get update
|
||||||
sudo apt-get install --no-install-recommends -y \
|
sudo apt-get install --no-install-recommends -y \
|
||||||
llvm-18-dev \
|
llvm-19-dev \
|
||||||
clang-18 \
|
clang-19 \
|
||||||
libclang-18-dev \
|
libclang-19-dev \
|
||||||
lld-18
|
lld-19
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ jobs:
|
|||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
id: cache-llvm-source
|
id: cache-llvm-source
|
||||||
with:
|
with:
|
||||||
key: llvm-source-18-sizediff-v1
|
key: llvm-source-19-sizediff-v1
|
||||||
path: |
|
path: |
|
||||||
llvm-project/compiler-rt
|
llvm-project/compiler-rt
|
||||||
- name: Download LLVM source
|
- name: Download LLVM source
|
||||||
|
|||||||
@@ -41,13 +41,13 @@ jobs:
|
|||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.24'
|
||||||
cache: true
|
cache: true
|
||||||
- name: Restore cached LLVM source
|
- name: Restore cached LLVM source
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-source
|
id: cache-llvm-source
|
||||||
with:
|
with:
|
||||||
key: llvm-source-18-windows-v1
|
key: llvm-source-19-windows-v1
|
||||||
path: |
|
path: |
|
||||||
llvm-project/clang/lib/Headers
|
llvm-project/clang/lib/Headers
|
||||||
llvm-project/clang/include
|
llvm-project/clang/include
|
||||||
@@ -72,7 +72,7 @@ jobs:
|
|||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: cache-llvm-build
|
id: cache-llvm-build
|
||||||
with:
|
with:
|
||||||
key: llvm-build-18-windows-v2
|
key: llvm-build-19-windows-v1
|
||||||
path: llvm-build
|
path: llvm-build
|
||||||
- name: Build LLVM
|
- name: Build LLVM
|
||||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||||
@@ -109,7 +109,7 @@ jobs:
|
|||||||
C:/Users/runneradmin/go/pkg/mod
|
C:/Users/runneradmin/go/pkg/mod
|
||||||
- name: Install wasmtime
|
- name: Install wasmtime
|
||||||
run: |
|
run: |
|
||||||
scoop install wasmtime@14.0.4
|
scoop install wasmtime@29.0.1
|
||||||
- name: make gen-device
|
- name: make gen-device
|
||||||
run: make -j3 gen-device
|
run: make -j3 gen-device
|
||||||
- name: Test TinyGo
|
- name: Test TinyGo
|
||||||
@@ -156,7 +156,7 @@ jobs:
|
|||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.24'
|
||||||
cache: true
|
cache: true
|
||||||
- name: Download TinyGo build
|
- name: Download TinyGo build
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -186,7 +186,7 @@ jobs:
|
|||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.24'
|
||||||
cache: true
|
cache: true
|
||||||
- name: Download TinyGo build
|
- name: Download TinyGo build
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -216,13 +216,13 @@ jobs:
|
|||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
scoop install binaryen && scoop install wasmtime@14.0.4
|
scoop install binaryen && scoop install wasmtime@29.0.1
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.24'
|
||||||
cache: true
|
cache: true
|
||||||
- name: Download TinyGo build
|
- name: Download TinyGo build
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
|||||||
@@ -39,3 +39,6 @@
|
|||||||
[submodule "lib/wasi-cli"]
|
[submodule "lib/wasi-cli"]
|
||||||
path = lib/wasi-cli
|
path = lib/wasi-cli
|
||||||
url = https://github.com/WebAssembly/wasi-cli
|
url = https://github.com/WebAssembly/wasi-cli
|
||||||
|
[submodule "lib/bdwgc"]
|
||||||
|
path = lib/bdwgc
|
||||||
|
url = https://github.com/ivmai/bdwgc.git
|
||||||
|
|||||||
+119
@@ -1,3 +1,122 @@
|
|||||||
|
0.37.0
|
||||||
|
---
|
||||||
|
* **general**
|
||||||
|
- add the Boehm-Demers-Weiser GC on Linux
|
||||||
|
* **ci**
|
||||||
|
- add more tests for wasm and baremetal
|
||||||
|
* **compiler**
|
||||||
|
- crypto/internal/sysrand is allowed to use unsafe signatures
|
||||||
|
* **examples**
|
||||||
|
- add goroutine benchmark to examples
|
||||||
|
* **fixes**
|
||||||
|
- ensure use of pointers for SPI interface on atsam21/atsam51 and other machines/boards that were missing implementation (#4798)
|
||||||
|
- replace loop counter with hw timer for USB SetAddressReq on rp2040 (#4796)
|
||||||
|
* **internal**
|
||||||
|
- update to go.bytecodealliance.org@v0.6.2 in GNUmakefile and internal/wasm-tools
|
||||||
|
- exclude certain files when copying package in internal/cm
|
||||||
|
- update to go.bytecodealliance.org/cm@v0.2.2 in internal/cm
|
||||||
|
- remove old reflect.go in internal/reflectlite
|
||||||
|
* **loader**
|
||||||
|
- use build tags for package iter and iter methods on reflect.Value in loader, iter, reflect
|
||||||
|
- add shim for go1.22 and earlier in loader, iter
|
||||||
|
* **machine**
|
||||||
|
- bump rp2040 to 200MHz (#4768)
|
||||||
|
- correct register address for Pin.SetInterrupt for rp2350 (#4782)
|
||||||
|
- don't block the rp2xxx UART interrupt handler
|
||||||
|
- fix RP2040 Pico board on the playground
|
||||||
|
- add flash support for rp2350 (#4803)
|
||||||
|
* **os**
|
||||||
|
- add stub Symlink for wasm
|
||||||
|
* **refactor**
|
||||||
|
- use *SPI everywhere to make consistent for implementations. Fixes #4663 "in reverse" by making SPI a pointer everywhere, as discussed in the comments.
|
||||||
|
* **reflect**
|
||||||
|
- add Value.SetIter{Key,Value} and MapIter.Reset in reflect, internal/reflectlite
|
||||||
|
- embed reflectlite types into reflect types in reflect, internal/reflectlite
|
||||||
|
- add Go 1.24 iter.Seq[2] methods
|
||||||
|
- copy reflect iter tests from upstream Go
|
||||||
|
- panic on Type.CanSeq[2] instead of returning false
|
||||||
|
- remove strconv.go
|
||||||
|
- remove unused go:linkname functions
|
||||||
|
* **riscv-qemu**
|
||||||
|
- add VirtIO RNG device
|
||||||
|
- increase stack size
|
||||||
|
* **runtime**
|
||||||
|
- only allocate heap memory when needed
|
||||||
|
- remove unused file func.go
|
||||||
|
- use package reflectlite
|
||||||
|
* **transform**
|
||||||
|
- cherry-pick from #4774
|
||||||
|
|
||||||
|
|
||||||
|
0.36.0
|
||||||
|
---
|
||||||
|
* **general**
|
||||||
|
- add initial Go 1.24 support
|
||||||
|
- add support for LLVM 19
|
||||||
|
- update license for 2025
|
||||||
|
- make small corrections for README regarding wasm
|
||||||
|
- use GOOS and GOARCH for building wasm simulated boards
|
||||||
|
- only infer target for wasm when GOOS and GOARCH are set correctly, not just based on file extension
|
||||||
|
- add test-corpus-wasip2
|
||||||
|
- use older image for cross-compiling builds
|
||||||
|
- update Linux builds to run on ubuntu-latest since 20.04 is being retired
|
||||||
|
- ensure build output directory is created
|
||||||
|
- add NoSandbox flag to chrome headless that is run during WASM tests, since this is now required for Ubuntu 23+ and we are using Ubuntu 24+ when running Github Actions
|
||||||
|
- update wasmtime used for CI to 29.0.1 to fix issue with install during CI tests
|
||||||
|
- update to use `Get-CimInstance` as `wmic` is being deprecated on WIndows
|
||||||
|
- remove unnecessary executable permissions
|
||||||
|
- `goenv`: update to new v0.36.0 development version
|
||||||
|
* **compiler**
|
||||||
|
- `builder`: fix parsing of external ld.lld error messages
|
||||||
|
- `cgo`: mangle identifier names
|
||||||
|
- `interp`: correctly mark functions as modifying memory
|
||||||
|
- add buildmode=wasi-legacy to support existing base of users who expected the older behavior for wasi modules to not return an exit code as if they were reactors
|
||||||
|
* **standard library**
|
||||||
|
- `crypto/tls`: add Dialer.DialContext() to fix websocket client
|
||||||
|
- `crypto/tls`: add VersionTLS constants and VersionName(version uint16) method that turns it into a string, copied from big go
|
||||||
|
- `internal/syscall/unix`: use our own version of this package
|
||||||
|
- `machine`: replace hard-coded cpu frequencies on rp2xxx
|
||||||
|
- `machine`: bump rp2350 CPUFrequency to 150 MHz
|
||||||
|
- `machine`: compute rp2 clock dividers from crystal and target frequency
|
||||||
|
- `machine`: remove bytes package dependency in flash code
|
||||||
|
- `machine/usb/descriptor`: avoid bytes package
|
||||||
|
- `net`: update to latest submodule with httptest subpackage and ResolveIPAddress implementation
|
||||||
|
- `os`: add File.Chdir support
|
||||||
|
- `os`: implement stub Chdir for non-OS systems
|
||||||
|
- `os/file`: add file.Chmod
|
||||||
|
- `reflect`: implement Value.Equal
|
||||||
|
- `runtime`: add FIPS helper functions
|
||||||
|
- `runtime`: manually initialize xorshift state
|
||||||
|
- `sync`: move Mutex to internal/task
|
||||||
|
- `syscall`: add wasip1 RandomGet
|
||||||
|
- `testing`: add Chdir
|
||||||
|
- `wasip2`: add stubs to get internal/syscall/unix to work
|
||||||
|
* **fixes**
|
||||||
|
- correctly handle calls for GetRNG() when being made from nrf devices with SoftDevice enabled
|
||||||
|
- fix stm32f103 ADC
|
||||||
|
- `wasm`: correctly handle id lookup for finalizeRef call
|
||||||
|
- `wasm`: avoid total failure on wasm finalizer call
|
||||||
|
- `wasm`: convert offset as signed int into unsigned int in syscall/js.stringVal in wasm_exec.js
|
||||||
|
* **targets**
|
||||||
|
- rp2350: add pll generalized solution; fix ADC handles; pwm period fix
|
||||||
|
- rp2350: extending support to include the rp2350b
|
||||||
|
- rp2350: cleanup: unexport internal USB and clock package variable, consts and types
|
||||||
|
- nrf: make ADC resolution changeable
|
||||||
|
- turn on GC for TKey1 device, since it does in fact work
|
||||||
|
- match Pico2 stack size to Pico
|
||||||
|
* **boards**
|
||||||
|
- add support for Pimoroni Pico Plus2
|
||||||
|
- add target for pico2-w board
|
||||||
|
- add comboat_fw tag for elecrow W5 boards with Combo-AT Wifi firmware
|
||||||
|
- add support for Elecrow Pico rp2350 W5 boards
|
||||||
|
- add support for Elecrow Pico rp2040 W5 boards
|
||||||
|
- add support for NRF51 HW-651
|
||||||
|
- add support for esp32c3-supermini
|
||||||
|
- add support for waveshare-rp2040-tiny
|
||||||
|
* **examples**
|
||||||
|
- add naive debouncing for pininterrupt example
|
||||||
|
|
||||||
|
|
||||||
0.35.0
|
0.35.0
|
||||||
---
|
---
|
||||||
* **general**
|
* **general**
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
# tinygo-llvm stage obtains the llvm source for TinyGo
|
# tinygo-llvm stage obtains the llvm source for TinyGo
|
||||||
FROM golang:1.23 AS tinygo-llvm
|
FROM golang:1.24 AS tinygo-llvm
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y apt-utils make cmake clang-15 ninja-build && \
|
apt-get install -y apt-utils make cmake clang-15 ninja-build && \
|
||||||
@@ -33,7 +33,7 @@ RUN cd /tinygo/ && \
|
|||||||
|
|
||||||
# tinygo-compiler copies the compiler build over to a base Go container (without
|
# tinygo-compiler copies the compiler build over to a base Go container (without
|
||||||
# all the build tools etc).
|
# all the build tools etc).
|
||||||
FROM golang:1.23 AS tinygo-compiler
|
FROM golang:1.24 AS tinygo-compiler
|
||||||
|
|
||||||
# Copy tinygo build.
|
# Copy tinygo build.
|
||||||
COPY --from=tinygo-compiler-build /tinygo/build/release/tinygo /tinygo
|
COPY --from=tinygo-compiler-build /tinygo/build/release/tinygo /tinygo
|
||||||
|
|||||||
+80
-29
@@ -10,7 +10,7 @@ LLD_SRC ?= $(LLVM_PROJECTDIR)/lld
|
|||||||
|
|
||||||
# Try to autodetect LLVM build tools.
|
# Try to autodetect LLVM build tools.
|
||||||
# Versions are listed here in descending priority order.
|
# Versions are listed here in descending priority order.
|
||||||
LLVM_VERSIONS = 18 17 16 15
|
LLVM_VERSIONS = 19 18 17 16 15
|
||||||
errifempty = $(if $(1),$(1),$(error $(2)))
|
errifempty = $(if $(1),$(1),$(error $(2)))
|
||||||
detect = $(shell which $(call errifempty,$(firstword $(foreach p,$(2),$(shell command -v $(p) 2> /dev/null && echo $(p)))),failed to locate $(1) at any of: $(2)))
|
detect = $(shell which $(call errifempty,$(firstword $(foreach p,$(2),$(shell command -v $(p) 2> /dev/null && echo $(p)))),failed to locate $(1) at any of: $(2)))
|
||||||
toolSearchPathsVersion = $(1)-$(2)
|
toolSearchPathsVersion = $(1)-$(2)
|
||||||
@@ -147,7 +147,7 @@ endif
|
|||||||
MD5SUM ?= md5sum
|
MD5SUM ?= md5sum
|
||||||
|
|
||||||
# Libraries that should be linked in for the statically linked Clang.
|
# Libraries that should be linked in for the statically linked Clang.
|
||||||
CLANG_LIB_NAMES = clangAnalysis clangAPINotes clangAST clangASTMatchers clangBasic clangCodeGen clangCrossTU clangDriver clangDynamicASTMatchers clangEdit clangExtractAPI clangFormat clangFrontend clangFrontendTool clangHandleCXX clangHandleLLVM clangIndex clangLex clangParse clangRewrite clangRewriteFrontend clangSema clangSerialization clangSupport clangTooling clangToolingASTDiff clangToolingCore clangToolingInclusions
|
CLANG_LIB_NAMES = clangAnalysis clangAPINotes clangAST clangASTMatchers clangBasic clangCodeGen clangCrossTU clangDriver clangDynamicASTMatchers clangEdit clangExtractAPI clangFormat clangFrontend clangFrontendTool clangHandleCXX clangHandleLLVM clangIndex clangInstallAPI clangLex clangParse clangRewrite clangRewriteFrontend clangSema clangSerialization clangSupport clangTooling clangToolingASTDiff clangToolingCore clangToolingInclusions
|
||||||
CLANG_LIBS = $(START_GROUP) $(addprefix -l,$(CLANG_LIB_NAMES)) $(END_GROUP) -lstdc++
|
CLANG_LIBS = $(START_GROUP) $(addprefix -l,$(CLANG_LIB_NAMES)) $(END_GROUP) -lstdc++
|
||||||
|
|
||||||
# Libraries that should be linked in for the statically linked LLD.
|
# Libraries that should be linked in for the statically linked LLD.
|
||||||
@@ -238,7 +238,7 @@ gen-device-renesas: build/gen-device-svd
|
|||||||
GO111MODULE=off $(GO) fmt ./src/device/renesas
|
GO111MODULE=off $(GO) fmt ./src/device/renesas
|
||||||
|
|
||||||
$(LLVM_PROJECTDIR)/llvm:
|
$(LLVM_PROJECTDIR)/llvm:
|
||||||
git clone -b tinygo_xtensa_release_18.1.2 --depth=1 https://github.com/tinygo-org/llvm-project $(LLVM_PROJECTDIR)
|
git clone -b xtensa_release_19.1.2 --depth=1 https://github.com/espressif/llvm-project $(LLVM_PROJECTDIR)
|
||||||
llvm-source: $(LLVM_PROJECTDIR)/llvm ## Get LLVM sources
|
llvm-source: $(LLVM_PROJECTDIR)/llvm ## Get LLVM sources
|
||||||
|
|
||||||
# Configure LLVM.
|
# Configure LLVM.
|
||||||
@@ -267,16 +267,17 @@ lib/wasi-libc/sysroot/lib/wasm32-wasi/libc.a:
|
|||||||
cd lib/wasi-libc && $(MAKE) -j4 EXTRA_CFLAGS="-O2 -g -DNDEBUG -mnontrapping-fptoint -msign-ext" MALLOC_IMPL=none CC="$(CLANG)" AR=$(LLVM_AR) NM=$(LLVM_NM)
|
cd lib/wasi-libc && $(MAKE) -j4 EXTRA_CFLAGS="-O2 -g -DNDEBUG -mnontrapping-fptoint -msign-ext" MALLOC_IMPL=none CC="$(CLANG)" AR=$(LLVM_AR) NM=$(LLVM_NM)
|
||||||
|
|
||||||
# Generate WASI syscall bindings
|
# Generate WASI syscall bindings
|
||||||
WASM_TOOLS_MODULE=github.com/bytecodealliance/wasm-tools-go
|
WASM_TOOLS_MODULE=go.bytecodealliance.org
|
||||||
.PHONY: wasi-syscall
|
.PHONY: wasi-syscall
|
||||||
wasi-syscall: wasi-cm
|
wasi-syscall: wasi-cm
|
||||||
|
rm -rf ./src/internal/wasi/*
|
||||||
go run -modfile ./internal/wasm-tools/go.mod $(WASM_TOOLS_MODULE)/cmd/wit-bindgen-go generate --versioned -o ./src/internal -p internal --cm internal/cm ./lib/wasi-cli/wit
|
go run -modfile ./internal/wasm-tools/go.mod $(WASM_TOOLS_MODULE)/cmd/wit-bindgen-go generate --versioned -o ./src/internal -p internal --cm internal/cm ./lib/wasi-cli/wit
|
||||||
|
|
||||||
# Copy package cm into src/internal/cm
|
# Copy package cm into src/internal/cm
|
||||||
.PHONY: wasi-cm
|
.PHONY: wasi-cm
|
||||||
wasi-cm:
|
wasi-cm:
|
||||||
# rm -rf ./src/internal/cm
|
rm -rf ./src/internal/cm/*
|
||||||
rsync -rv --delete --exclude '*_test.go' $(shell go list -modfile ./internal/wasm-tools/go.mod -m -f {{.Dir}} $(WASM_TOOLS_MODULE))/cm ./src/internal/
|
rsync -rv --delete --exclude go.mod --exclude '*_test.go' --exclude '*_json.go' --exclude '*.md' --exclude LICENSE $(shell go list -modfile ./internal/wasm-tools/go.mod -m -f {{.Dir}} $(WASM_TOOLS_MODULE)/cm)/ ./src/internal/cm
|
||||||
|
|
||||||
# Check for Node.js used during WASM tests.
|
# Check for Node.js used during WASM tests.
|
||||||
NODEJS_VERSION := $(word 1,$(subst ., ,$(shell node -v | cut -c 2-)))
|
NODEJS_VERSION := $(word 1,$(subst ., ,$(shell node -v | cut -c 2-)))
|
||||||
@@ -309,11 +310,9 @@ TEST_PACKAGES_FAST = \
|
|||||||
container/heap \
|
container/heap \
|
||||||
container/list \
|
container/list \
|
||||||
container/ring \
|
container/ring \
|
||||||
crypto/des \
|
|
||||||
crypto/ecdsa \
|
crypto/ecdsa \
|
||||||
crypto/elliptic \
|
crypto/elliptic \
|
||||||
crypto/md5 \
|
crypto/md5 \
|
||||||
crypto/rc4 \
|
|
||||||
crypto/sha1 \
|
crypto/sha1 \
|
||||||
crypto/sha256 \
|
crypto/sha256 \
|
||||||
crypto/sha512 \
|
crypto/sha512 \
|
||||||
@@ -355,17 +354,11 @@ TEST_PACKAGES_FAST = \
|
|||||||
unique \
|
unique \
|
||||||
$(nil)
|
$(nil)
|
||||||
|
|
||||||
# Assume this will go away before Go2, so only check minor version.
|
|
||||||
ifeq ($(filter $(shell $(GO) env GOVERSION | cut -f 2 -d.), 16 17 18), )
|
|
||||||
TEST_PACKAGES_FAST += crypto/internal/nistec/fiat
|
|
||||||
else
|
|
||||||
TEST_PACKAGES_FAST += crypto/elliptic/internal/fiat
|
|
||||||
endif
|
|
||||||
|
|
||||||
# archive/zip requires os.ReadAt, which is not yet supported on windows
|
# archive/zip requires os.ReadAt, which is not yet supported on windows
|
||||||
# bytes requires mmap
|
# bytes requires mmap
|
||||||
# compress/flate appears to hang on wasi
|
# compress/flate appears to hang on wasi
|
||||||
# crypto/aes fails on wasi, needs panic()/recover()
|
# crypto/aes fails on wasi, needs panic()/recover()
|
||||||
|
# crypto/des fails on wasi, needs panic()/recover()
|
||||||
# crypto/hmac fails on wasi, it exits with a "slice out of range" panic
|
# crypto/hmac fails on wasi, it exits with a "slice out of range" panic
|
||||||
# debug/plan9obj requires os.ReadAt, which is not yet supported on windows
|
# debug/plan9obj requires os.ReadAt, which is not yet supported on windows
|
||||||
# image requires recover(), which is not yet supported on wasi
|
# image requires recover(), which is not yet supported on wasi
|
||||||
@@ -386,6 +379,7 @@ TEST_PACKAGES_LINUX := \
|
|||||||
archive/zip \
|
archive/zip \
|
||||||
compress/flate \
|
compress/flate \
|
||||||
crypto/aes \
|
crypto/aes \
|
||||||
|
crypto/des \
|
||||||
crypto/hmac \
|
crypto/hmac \
|
||||||
debug/dwarf \
|
debug/dwarf \
|
||||||
debug/plan9obj \
|
debug/plan9obj \
|
||||||
@@ -405,14 +399,45 @@ TEST_PACKAGES_LINUX := \
|
|||||||
|
|
||||||
TEST_PACKAGES_DARWIN := $(TEST_PACKAGES_LINUX)
|
TEST_PACKAGES_DARWIN := $(TEST_PACKAGES_LINUX)
|
||||||
|
|
||||||
|
# os/user requires t.Skip() support
|
||||||
TEST_PACKAGES_WINDOWS := \
|
TEST_PACKAGES_WINDOWS := \
|
||||||
compress/flate \
|
compress/flate \
|
||||||
|
crypto/des \
|
||||||
crypto/hmac \
|
crypto/hmac \
|
||||||
os/user \
|
|
||||||
strconv \
|
strconv \
|
||||||
text/template/parse \
|
text/template/parse \
|
||||||
$(nil)
|
$(nil)
|
||||||
|
|
||||||
|
|
||||||
|
# These packages cannot be tested on wasm, mostly because these tests assume a
|
||||||
|
# working filesystem. This could perhaps be fixed, by supporting filesystem
|
||||||
|
# access when running inside Node.js.
|
||||||
|
TEST_PACKAGES_WASM = $(filter-out $(TEST_PACKAGES_NONWASM), $(TEST_PACKAGES_FAST))
|
||||||
|
TEST_PACKAGES_NONWASM = \
|
||||||
|
compress/lzw \
|
||||||
|
compress/zlib \
|
||||||
|
crypto/ecdsa \
|
||||||
|
debug/macho \
|
||||||
|
embed/internal/embedtest \
|
||||||
|
go/format \
|
||||||
|
os \
|
||||||
|
testing \
|
||||||
|
$(nil)
|
||||||
|
|
||||||
|
# These packages cannot be tested on baremetal.
|
||||||
|
#
|
||||||
|
# Some reasons why the tests don't pass on baremetal:
|
||||||
|
#
|
||||||
|
# * No filesystem is available, so packages like compress/zlib can't be tested
|
||||||
|
# (just like wasm).
|
||||||
|
# * picolibc math functions apparently are less precise, the math package
|
||||||
|
# fails on baremetal.
|
||||||
|
TEST_PACKAGES_BAREMETAL = $(filter-out $(TEST_PACKAGES_NONBAREMETAL), $(TEST_PACKAGES_FAST))
|
||||||
|
TEST_PACKAGES_NONBAREMETAL = \
|
||||||
|
$(TEST_PACKAGES_NONWASM) \
|
||||||
|
math \
|
||||||
|
$(nil)
|
||||||
|
|
||||||
# Report platforms on which each standard library package is known to pass tests
|
# Report platforms on which each standard library package is known to pass tests
|
||||||
jointmp := $(shell echo /tmp/join.$$$$)
|
jointmp := $(shell echo /tmp/join.$$$$)
|
||||||
report-stdlib-tests-pass:
|
report-stdlib-tests-pass:
|
||||||
@@ -456,6 +481,8 @@ tinygo-bench-fast:
|
|||||||
$(TINYGO) test -bench . $(TEST_PACKAGES_HOST)
|
$(TINYGO) test -bench . $(TEST_PACKAGES_HOST)
|
||||||
|
|
||||||
# Same thing, except for wasi rather than the current platform.
|
# Same thing, except for wasi rather than the current platform.
|
||||||
|
tinygo-test-wasm:
|
||||||
|
$(TINYGO) test -target wasm $(TEST_PACKAGES_WASM)
|
||||||
tinygo-test-wasi:
|
tinygo-test-wasi:
|
||||||
$(TINYGO) test -target wasip1 $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_SLOW) ./tests/runtime_wasi
|
$(TINYGO) test -target wasip1 $(TEST_PACKAGES_FAST) $(TEST_PACKAGES_SLOW) ./tests/runtime_wasi
|
||||||
tinygo-test-wasip1:
|
tinygo-test-wasip1:
|
||||||
@@ -490,6 +517,10 @@ tinygo-bench-wasip2:
|
|||||||
tinygo-bench-wasip2-fast:
|
tinygo-bench-wasip2-fast:
|
||||||
$(TINYGO) test -target wasip2 -bench . $(TEST_PACKAGES_FAST)
|
$(TINYGO) test -target wasip2 -bench . $(TEST_PACKAGES_FAST)
|
||||||
|
|
||||||
|
# Run tests on riscv-qemu since that one provides a large amount of memory.
|
||||||
|
tinygo-test-baremetal:
|
||||||
|
$(TINYGO) test -target riscv-qemu $(TEST_PACKAGES_BAREMETAL)
|
||||||
|
|
||||||
# Test external packages in a large corpus.
|
# Test external packages in a large corpus.
|
||||||
test-corpus:
|
test-corpus:
|
||||||
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags byollvm -run TestCorpus . -corpus=testdata/corpus.yaml
|
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags byollvm -run TestCorpus . -corpus=testdata/corpus.yaml
|
||||||
@@ -497,11 +528,8 @@ test-corpus-fast:
|
|||||||
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags byollvm -run TestCorpus -short . -corpus=testdata/corpus.yaml
|
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags byollvm -run TestCorpus -short . -corpus=testdata/corpus.yaml
|
||||||
test-corpus-wasi: wasi-libc
|
test-corpus-wasi: wasi-libc
|
||||||
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags byollvm -run TestCorpus . -corpus=testdata/corpus.yaml -target=wasip1
|
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags byollvm -run TestCorpus . -corpus=testdata/corpus.yaml -target=wasip1
|
||||||
|
test-corpus-wasip2: wasi-libc
|
||||||
tinygo-baremetal:
|
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags byollvm -run TestCorpus . -corpus=testdata/corpus.yaml -target=wasip2
|
||||||
# Regression tests that run on a baremetal target and don't fit in either main_test.go or smoketest.
|
|
||||||
# regression test for #2666: e.g. encoding/hex must pass on baremetal
|
|
||||||
$(TINYGO) test -target cortex-m-qemu encoding/hex
|
|
||||||
|
|
||||||
.PHONY: testchdir
|
.PHONY: testchdir
|
||||||
testchdir:
|
testchdir:
|
||||||
@@ -523,6 +551,8 @@ smoketest: testchdir
|
|||||||
# regression test for #2563
|
# regression test for #2563
|
||||||
cd tests/os/smoke && $(TINYGO) test -c -target=pybadge && rm smoke.test
|
cd tests/os/smoke && $(TINYGO) test -c -target=pybadge && rm smoke.test
|
||||||
# test all examples (except pwm)
|
# test all examples (except pwm)
|
||||||
|
$(TINYGO) build -size short -o test.hex -target=pga2350 examples/echo
|
||||||
|
@$(MD5SUM) test.hex
|
||||||
$(TINYGO) build -size short -o test.hex -target=pca10040 examples/blinky1
|
$(TINYGO) build -size short -o test.hex -target=pca10040 examples/blinky1
|
||||||
@$(MD5SUM) test.hex
|
@$(MD5SUM) test.hex
|
||||||
$(TINYGO) build -size short -o test.hex -target=pca10040 examples/adc
|
$(TINYGO) build -size short -o test.hex -target=pca10040 examples/adc
|
||||||
@@ -571,21 +601,23 @@ smoketest: testchdir
|
|||||||
@$(MD5SUM) test.hex
|
@$(MD5SUM) test.hex
|
||||||
# test simulated boards on play.tinygo.org
|
# test simulated boards on play.tinygo.org
|
||||||
ifneq ($(WASM), 0)
|
ifneq ($(WASM), 0)
|
||||||
$(TINYGO) build -size short -o test.wasm -tags=arduino examples/blinky1
|
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o test.wasm -tags=arduino examples/blinky1
|
||||||
@$(MD5SUM) test.wasm
|
@$(MD5SUM) test.wasm
|
||||||
$(TINYGO) build -size short -o test.wasm -tags=hifive1b examples/blinky1
|
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o test.wasm -tags=hifive1b examples/blinky1
|
||||||
@$(MD5SUM) test.wasm
|
@$(MD5SUM) test.wasm
|
||||||
$(TINYGO) build -size short -o test.wasm -tags=reelboard examples/blinky1
|
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o test.wasm -tags=reelboard examples/blinky1
|
||||||
@$(MD5SUM) test.wasm
|
@$(MD5SUM) test.wasm
|
||||||
$(TINYGO) build -size short -o test.wasm -tags=microbit examples/microbit-blink
|
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o test.wasm -tags=microbit examples/microbit-blink
|
||||||
@$(MD5SUM) test.wasm
|
@$(MD5SUM) test.wasm
|
||||||
$(TINYGO) build -size short -o test.wasm -tags=circuitplay_express examples/blinky1
|
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o test.wasm -tags=circuitplay_express examples/blinky1
|
||||||
@$(MD5SUM) test.wasm
|
@$(MD5SUM) test.wasm
|
||||||
$(TINYGO) build -size short -o test.wasm -tags=circuitplay_bluefruit examples/blinky1
|
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o test.wasm -tags=circuitplay_bluefruit examples/blinky1
|
||||||
@$(MD5SUM) test.wasm
|
@$(MD5SUM) test.wasm
|
||||||
$(TINYGO) build -size short -o test.wasm -tags=mch2022 examples/machinetest
|
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o test.wasm -tags=mch2022 examples/machinetest
|
||||||
@$(MD5SUM) test.wasm
|
@$(MD5SUM) test.wasm
|
||||||
$(TINYGO) build -size short -o test.wasm -tags=gopher_badge examples/blinky1
|
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o test.wasm -tags=gopher_badge examples/blinky1
|
||||||
|
@$(MD5SUM) test.wasm
|
||||||
|
GOOS=js GOARCH=wasm $(TINYGO) build -size short -o test.wasm -tags=pico examples/blinky1
|
||||||
@$(MD5SUM) test.wasm
|
@$(MD5SUM) test.wasm
|
||||||
endif
|
endif
|
||||||
# test all targets/boards
|
# test all targets/boards
|
||||||
@@ -745,6 +777,10 @@ endif
|
|||||||
@$(MD5SUM) test.hex
|
@$(MD5SUM) test.hex
|
||||||
$(TINYGO) build -size short -o test.hex -target=tiny2350 examples/blinky1
|
$(TINYGO) build -size short -o test.hex -target=tiny2350 examples/blinky1
|
||||||
@$(MD5SUM) test.hex
|
@$(MD5SUM) test.hex
|
||||||
|
$(TINYGO) build -size short -o test.hex -target=pico-plus2 examples/blinky1
|
||||||
|
@$(MD5SUM) test.hex
|
||||||
|
$(TINYGO) build -size short -o test.hex -target=waveshare-rp2040-tiny examples/echo
|
||||||
|
@$(MD5SUM) test.hex
|
||||||
# test pwm
|
# test pwm
|
||||||
$(TINYGO) build -size short -o test.hex -target=itsybitsy-m0 examples/pwm
|
$(TINYGO) build -size short -o test.hex -target=itsybitsy-m0 examples/pwm
|
||||||
@$(MD5SUM) test.hex
|
@$(MD5SUM) test.hex
|
||||||
@@ -826,6 +862,8 @@ endif
|
|||||||
ifneq ($(XTENSA), 0)
|
ifneq ($(XTENSA), 0)
|
||||||
$(TINYGO) build -size short -o test.bin -target=esp32-mini32 examples/blinky1
|
$(TINYGO) build -size short -o test.bin -target=esp32-mini32 examples/blinky1
|
||||||
@$(MD5SUM) test.bin
|
@$(MD5SUM) test.bin
|
||||||
|
$(TINYGO) build -size short -o test.bin -target=esp32c3-supermini examples/blinky1
|
||||||
|
@$(MD5SUM) test.bin
|
||||||
$(TINYGO) build -size short -o test.bin -target=nodemcu examples/blinky1
|
$(TINYGO) build -size short -o test.bin -target=nodemcu examples/blinky1
|
||||||
@$(MD5SUM) test.bin
|
@$(MD5SUM) test.bin
|
||||||
$(TINYGO) build -size short -o test.bin -target m5stack-core2 examples/machinetest
|
$(TINYGO) build -size short -o test.bin -target m5stack-core2 examples/machinetest
|
||||||
@@ -859,6 +897,14 @@ endif
|
|||||||
@$(MD5SUM) test.hex
|
@$(MD5SUM) test.hex
|
||||||
$(TINYGO) build -size short -o test.hex -target=tkey examples/blinky1
|
$(TINYGO) build -size short -o test.hex -target=tkey examples/blinky1
|
||||||
@$(MD5SUM) test.hex
|
@$(MD5SUM) test.hex
|
||||||
|
$(TINYGO) build -size short -o test.hex -target=elecrow-rp2040 examples/blinky1
|
||||||
|
@$(MD5SUM) test.hex
|
||||||
|
$(TINYGO) build -size short -o test.hex -target=elecrow-rp2350 examples/blinky1
|
||||||
|
@$(MD5SUM) test.hex
|
||||||
|
$(TINYGO) build -size short -o test.hex -target=hw-651 examples/machinetest
|
||||||
|
@$(MD5SUM) test.hex
|
||||||
|
$(TINYGO) build -size short -o test.hex -target=hw-651-s110v8 examples/machinetest
|
||||||
|
@$(MD5SUM) test.hex
|
||||||
ifneq ($(WASM), 0)
|
ifneq ($(WASM), 0)
|
||||||
$(TINYGO) build -size short -o wasm.wasm -target=wasm examples/wasm/export
|
$(TINYGO) build -size short -o wasm.wasm -target=wasm examples/wasm/export
|
||||||
$(TINYGO) build -size short -o wasm.wasm -target=wasm examples/wasm/main
|
$(TINYGO) build -size short -o wasm.wasm -target=wasm examples/wasm/main
|
||||||
@@ -895,6 +941,7 @@ wasmtest:
|
|||||||
|
|
||||||
build/release: tinygo gen-device wasi-libc $(if $(filter 1,$(USE_SYSTEM_BINARYEN)),,binaryen)
|
build/release: tinygo gen-device wasi-libc $(if $(filter 1,$(USE_SYSTEM_BINARYEN)),,binaryen)
|
||||||
@mkdir -p build/release/tinygo/bin
|
@mkdir -p build/release/tinygo/bin
|
||||||
|
@mkdir -p build/release/tinygo/lib/bdwgc
|
||||||
@mkdir -p build/release/tinygo/lib/clang/include
|
@mkdir -p build/release/tinygo/lib/clang/include
|
||||||
@mkdir -p build/release/tinygo/lib/CMSIS/CMSIS
|
@mkdir -p build/release/tinygo/lib/CMSIS/CMSIS
|
||||||
@mkdir -p build/release/tinygo/lib/macos-minimal-sdk
|
@mkdir -p build/release/tinygo/lib/macos-minimal-sdk
|
||||||
@@ -916,6 +963,7 @@ build/release: tinygo gen-device wasi-libc $(if $(filter 1,$(USE_SYSTEM_BINARYEN
|
|||||||
ifneq ($(USE_SYSTEM_BINARYEN),1)
|
ifneq ($(USE_SYSTEM_BINARYEN),1)
|
||||||
@cp -p build/wasm-opt$(EXE) build/release/tinygo/bin
|
@cp -p build/wasm-opt$(EXE) build/release/tinygo/bin
|
||||||
endif
|
endif
|
||||||
|
@cp -rp lib/bdwgc/* build/release/tinygo/lib/bdwgc
|
||||||
@cp -p $(abspath $(CLANG_SRC))/lib/Headers/*.h build/release/tinygo/lib/clang/include
|
@cp -p $(abspath $(CLANG_SRC))/lib/Headers/*.h build/release/tinygo/lib/clang/include
|
||||||
@cp -rp lib/CMSIS/CMSIS/Include build/release/tinygo/lib/CMSIS/CMSIS
|
@cp -rp lib/CMSIS/CMSIS/Include build/release/tinygo/lib/CMSIS/CMSIS
|
||||||
@cp -rp lib/CMSIS/README.md build/release/tinygo/lib/CMSIS
|
@cp -rp lib/CMSIS/README.md build/release/tinygo/lib/CMSIS
|
||||||
@@ -929,6 +977,7 @@ endif
|
|||||||
@cp -rp lib/musl/crt/crt1.c build/release/tinygo/lib/musl/crt
|
@cp -rp lib/musl/crt/crt1.c build/release/tinygo/lib/musl/crt
|
||||||
@cp -rp lib/musl/COPYRIGHT build/release/tinygo/lib/musl
|
@cp -rp lib/musl/COPYRIGHT build/release/tinygo/lib/musl
|
||||||
@cp -rp lib/musl/include build/release/tinygo/lib/musl
|
@cp -rp lib/musl/include build/release/tinygo/lib/musl
|
||||||
|
@cp -rp lib/musl/src/ctype build/release/tinygo/lib/musl/src
|
||||||
@cp -rp lib/musl/src/env build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/env build/release/tinygo/lib/musl/src
|
||||||
@cp -rp lib/musl/src/errno build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/errno build/release/tinygo/lib/musl/src
|
||||||
@cp -rp lib/musl/src/exit build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/exit build/release/tinygo/lib/musl/src
|
||||||
@@ -943,8 +992,10 @@ endif
|
|||||||
@cp -rp lib/musl/src/math build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/math build/release/tinygo/lib/musl/src
|
||||||
@cp -rp lib/musl/src/misc build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/misc build/release/tinygo/lib/musl/src
|
||||||
@cp -rp lib/musl/src/multibyte build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/multibyte build/release/tinygo/lib/musl/src
|
||||||
|
@cp -rp lib/musl/src/sched build/release/tinygo/lib/musl/src
|
||||||
@cp -rp lib/musl/src/signal build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/signal build/release/tinygo/lib/musl/src
|
||||||
@cp -rp lib/musl/src/stdio build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/stdio build/release/tinygo/lib/musl/src
|
||||||
|
@cp -rp lib/musl/src/stdlib build/release/tinygo/lib/musl/src
|
||||||
@cp -rp lib/musl/src/string build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/string build/release/tinygo/lib/musl/src
|
||||||
@cp -rp lib/musl/src/thread build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/thread build/release/tinygo/lib/musl/src
|
||||||
@cp -rp lib/musl/src/time build/release/tinygo/lib/musl/src
|
@cp -rp lib/musl/src/time build/release/tinygo/lib/musl/src
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Copyright (c) 2018-2023 The TinyGo Authors. All rights reserved.
|
Copyright (c) 2018-2025 The TinyGo Authors. All rights reserved.
|
||||||
|
|
||||||
TinyGo includes portions of the Go standard library.
|
TinyGo includes portions of the Go standard library.
|
||||||
Copyright (c) 2009-2023 The Go Authors. All rights reserved.
|
Copyright (c) 2009-2024 The Go Authors. All rights reserved.
|
||||||
|
|
||||||
TinyGo includes portions of LLVM, which is under the Apache License v2.0 with
|
TinyGo includes portions of LLVM, which is under the Apache License v2.0 with
|
||||||
LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information.
|
LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
|||||||
@@ -48,20 +48,22 @@ Here is a small TinyGo program for use by a WASI host application:
|
|||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
//go:wasm-module yourmodulename
|
//go:wasmexport add
|
||||||
//export add
|
|
||||||
func add(x, y uint32) uint32 {
|
func add(x, y uint32) uint32 {
|
||||||
return x + y
|
return x + y
|
||||||
}
|
}
|
||||||
|
|
||||||
// main is required for the `wasip1` target, even if it isn't used.
|
|
||||||
func main() {}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This compiles the above TinyGo program for use on any WASI runtime:
|
This compiles the above TinyGo program for use on any WASI Preview 1 runtime:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
tinygo build -o main.wasm -target=wasip1 main.go
|
tinygo build -buildmode=c-shared -o add.wasm -target=wasip1 add.go
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use the same syntax as Go 1.24+:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
GOARCH=wasip1 GOOS=wasm tinygo build -buildmode=c-shared -o add.wasm add.go
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package builder
|
||||||
|
|
||||||
|
// The well-known conservative Boehm-Demers-Weiser GC.
|
||||||
|
// This file provides a way to compile this GC for use with TinyGo.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/tinygo-org/tinygo/goenv"
|
||||||
|
)
|
||||||
|
|
||||||
|
var BoehmGC = Library{
|
||||||
|
name: "bdwgc",
|
||||||
|
cflags: func(target, headerPath string) []string {
|
||||||
|
libdir := filepath.Join(goenv.Get("TINYGOROOT"), "lib/bdwgc")
|
||||||
|
return []string{
|
||||||
|
// use a modern environment
|
||||||
|
"-DUSE_MMAP", // mmap is available
|
||||||
|
"-DUSE_MUNMAP", // return memory to the OS using munmap
|
||||||
|
"-DGC_BUILTIN_ATOMIC", // use compiler intrinsics for atomic operations
|
||||||
|
"-DNO_EXECUTE_PERMISSION", // don't make the heap executable
|
||||||
|
|
||||||
|
// specific flags for TinyGo
|
||||||
|
"-DALL_INTERIOR_POINTERS", // scan interior pointers (needed for Go)
|
||||||
|
"-DIGNORE_DYNAMIC_LOADING", // we don't support dynamic loading at the moment
|
||||||
|
"-DNO_GETCONTEXT", // musl doesn't support getcontext()
|
||||||
|
|
||||||
|
// Special flag to work around the lack of __data_start in ld.lld.
|
||||||
|
// TODO: try to fix this in LLVM/lld directly so we don't have to
|
||||||
|
// work around it anymore.
|
||||||
|
"-DGC_DONT_REGISTER_MAIN_STATIC_DATA",
|
||||||
|
|
||||||
|
// Do not scan the stack. We have our own mechanism to do this.
|
||||||
|
"-DSTACK_NOT_SCANNED",
|
||||||
|
|
||||||
|
// Assertions can be enabled while debugging GC issues.
|
||||||
|
//"-DGC_ASSERTIONS",
|
||||||
|
|
||||||
|
// Threading is not yet supported, so these are disabled.
|
||||||
|
//"-DGC_THREADS",
|
||||||
|
//"-DTHREAD_LOCAL_ALLOC",
|
||||||
|
|
||||||
|
"-I" + libdir + "/include",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sourceDir: func() string {
|
||||||
|
return filepath.Join(goenv.Get("TINYGOROOT"), "lib/bdwgc")
|
||||||
|
},
|
||||||
|
librarySources: func(target string) ([]string, error) {
|
||||||
|
return []string{
|
||||||
|
"allchblk.c",
|
||||||
|
"alloc.c",
|
||||||
|
"blacklst.c",
|
||||||
|
"dbg_mlc.c",
|
||||||
|
"dyn_load.c",
|
||||||
|
"finalize.c",
|
||||||
|
"headers.c",
|
||||||
|
"mach_dep.c",
|
||||||
|
"malloc.c",
|
||||||
|
"mark.c",
|
||||||
|
"mark_rts.c",
|
||||||
|
"misc.c",
|
||||||
|
"new_hblk.c",
|
||||||
|
"obj_map.c",
|
||||||
|
"os_dep.c",
|
||||||
|
"pthread_stop_world.c",
|
||||||
|
"pthread_support.c",
|
||||||
|
"reclaim.c",
|
||||||
|
}, nil
|
||||||
|
},
|
||||||
|
}
|
||||||
+77
-48
@@ -147,20 +147,22 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
|||||||
// the libc needs them.
|
// the libc needs them.
|
||||||
root := goenv.Get("TINYGOROOT")
|
root := goenv.Get("TINYGOROOT")
|
||||||
var libcDependencies []*compileJob
|
var libcDependencies []*compileJob
|
||||||
|
var libcJob *compileJob
|
||||||
switch config.Target.Libc {
|
switch config.Target.Libc {
|
||||||
case "darwin-libSystem":
|
case "darwin-libSystem":
|
||||||
job := makeDarwinLibSystemJob(config, tmpdir)
|
job := makeDarwinLibSystemJob(config, tmpdir)
|
||||||
libcDependencies = append(libcDependencies, job)
|
libcDependencies = append(libcDependencies, job)
|
||||||
case "musl":
|
case "musl":
|
||||||
job, unlock, err := libMusl.load(config, tmpdir)
|
var unlock func()
|
||||||
|
libcJob, unlock, err = libMusl.load(config, tmpdir, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return BuildResult{}, err
|
return BuildResult{}, err
|
||||||
}
|
}
|
||||||
defer unlock()
|
defer unlock()
|
||||||
libcDependencies = append(libcDependencies, dummyCompileJob(filepath.Join(filepath.Dir(job.result), "crt1.o")))
|
libcDependencies = append(libcDependencies, dummyCompileJob(filepath.Join(filepath.Dir(libcJob.result), "crt1.o")))
|
||||||
libcDependencies = append(libcDependencies, job)
|
libcDependencies = append(libcDependencies, libcJob)
|
||||||
case "picolibc":
|
case "picolibc":
|
||||||
libcJob, unlock, err := libPicolibc.load(config, tmpdir)
|
libcJob, unlock, err := libPicolibc.load(config, tmpdir, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return BuildResult{}, err
|
return BuildResult{}, err
|
||||||
}
|
}
|
||||||
@@ -173,14 +175,14 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
|||||||
}
|
}
|
||||||
libcDependencies = append(libcDependencies, dummyCompileJob(path))
|
libcDependencies = append(libcDependencies, dummyCompileJob(path))
|
||||||
case "wasmbuiltins":
|
case "wasmbuiltins":
|
||||||
libcJob, unlock, err := libWasmBuiltins.load(config, tmpdir)
|
libcJob, unlock, err := libWasmBuiltins.load(config, tmpdir, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return BuildResult{}, err
|
return BuildResult{}, err
|
||||||
}
|
}
|
||||||
defer unlock()
|
defer unlock()
|
||||||
libcDependencies = append(libcDependencies, libcJob)
|
libcDependencies = append(libcDependencies, libcJob)
|
||||||
case "mingw-w64":
|
case "mingw-w64":
|
||||||
job, unlock, err := libMinGW.load(config, tmpdir)
|
job, unlock, err := libMinGW.load(config, tmpdir, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return BuildResult{}, err
|
return BuildResult{}, err
|
||||||
}
|
}
|
||||||
@@ -449,8 +451,15 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
|||||||
if global.IsNil() {
|
if global.IsNil() {
|
||||||
return errors.New("global not found: " + globalName)
|
return errors.New("global not found: " + globalName)
|
||||||
}
|
}
|
||||||
|
globalType := global.GlobalValueType()
|
||||||
|
if globalType.TypeKind() != llvm.StructTypeKind || globalType.StructName() != "runtime._string" {
|
||||||
|
// Verify this is indeed a string. This is needed so
|
||||||
|
// that makeGlobalsModule can just create the right
|
||||||
|
// globals of string type without checking.
|
||||||
|
return fmt.Errorf("%s: not a string", globalName)
|
||||||
|
}
|
||||||
name := global.Name()
|
name := global.Name()
|
||||||
newGlobal := llvm.AddGlobal(mod, global.GlobalValueType(), name+".tmp")
|
newGlobal := llvm.AddGlobal(mod, globalType, name+".tmp")
|
||||||
global.ReplaceAllUsesWith(newGlobal)
|
global.ReplaceAllUsesWith(newGlobal)
|
||||||
global.EraseFromParentAsGlobal()
|
global.EraseFromParentAsGlobal()
|
||||||
newGlobal.SetName(name)
|
newGlobal.SetName(name)
|
||||||
@@ -538,6 +547,15 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Insert values from -ldflags="-X ..." into the IR.
|
||||||
|
// This is a separate module, so that the "runtime._string" type
|
||||||
|
// doesn't need to match precisely. LLVM tends to rename that type
|
||||||
|
// sometimes, leading to errors. But linking in a separate module
|
||||||
|
// works fine. See:
|
||||||
|
// https://github.com/tinygo-org/tinygo/issues/4810
|
||||||
|
globalsMod := makeGlobalsModule(ctx, globalValues, machine)
|
||||||
|
llvm.LinkModules(mod, globalsMod)
|
||||||
|
|
||||||
// Create runtime.initAll function that calls the runtime
|
// Create runtime.initAll function that calls the runtime
|
||||||
// initializer of each package.
|
// initializer of each package.
|
||||||
llvmInitFn := mod.NamedFunction("runtime.initAll")
|
llvmInitFn := mod.NamedFunction("runtime.initAll")
|
||||||
@@ -590,7 +608,7 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
|||||||
|
|
||||||
// Run all optimization passes, which are much more effective now
|
// Run all optimization passes, which are much more effective now
|
||||||
// that the optimizer can see the whole program at once.
|
// that the optimizer can see the whole program at once.
|
||||||
err := optimizeProgram(mod, config, globalValues)
|
err := optimizeProgram(mod, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -604,6 +622,11 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the output directory, if needed
|
||||||
|
if err := os.MkdirAll(filepath.Dir(outpath), 0777); err != nil {
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether we only need to create an object file.
|
// Check whether we only need to create an object file.
|
||||||
// If so, we don't need to link anything and will be finished quickly.
|
// If so, we don't need to link anything and will be finished quickly.
|
||||||
outext := filepath.Ext(outpath)
|
outext := filepath.Ext(outpath)
|
||||||
@@ -667,10 +690,20 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
|||||||
ldflags = append(ldflags, "--no-entry")
|
ldflags = append(ldflags, "--no-entry")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.Options.BuildMode == "wasi-legacy" {
|
||||||
|
if !strings.HasPrefix(config.Triple(), "wasm32-") {
|
||||||
|
return result, fmt.Errorf("buildmode wasi-legacy is only supported on wasm")
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.Options.Scheduler != "none" {
|
||||||
|
return result, fmt.Errorf("buildmode wasi-legacy only supports scheduler=none")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add compiler-rt dependency if needed. Usually this is a simple load from
|
// Add compiler-rt dependency if needed. Usually this is a simple load from
|
||||||
// a cache.
|
// a cache.
|
||||||
if config.Target.RTLib == "compiler-rt" {
|
if config.Target.RTLib == "compiler-rt" {
|
||||||
job, unlock, err := libCompilerRT.load(config, tmpdir)
|
job, unlock, err := libCompilerRT.load(config, tmpdir, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
@@ -678,6 +711,19 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
|||||||
linkerDependencies = append(linkerDependencies, job)
|
linkerDependencies = append(linkerDependencies, job)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The Boehm collector is stored in a separate C library.
|
||||||
|
if config.GC() == "boehm" {
|
||||||
|
if libcJob == nil {
|
||||||
|
return BuildResult{}, fmt.Errorf("boehm GC isn't supported with libc %s", config.Target.Libc)
|
||||||
|
}
|
||||||
|
job, unlock, err := BoehmGC.load(config, tmpdir, libcJob)
|
||||||
|
if err != nil {
|
||||||
|
return BuildResult{}, err
|
||||||
|
}
|
||||||
|
defer unlock()
|
||||||
|
linkerDependencies = append(linkerDependencies, job)
|
||||||
|
}
|
||||||
|
|
||||||
// Add jobs to compile extra files. These files are in C or assembly and
|
// Add jobs to compile extra files. These files are in C or assembly and
|
||||||
// contain things like the interrupt vector table and low level operations
|
// contain things like the interrupt vector table and low level operations
|
||||||
// such as stack switching.
|
// such as stack switching.
|
||||||
@@ -1130,7 +1176,7 @@ func createEmbedObjectFile(data, hexSum, sourceFile, sourceDir, tmpdir string, c
|
|||||||
// optimizeProgram runs a series of optimizations and transformations that are
|
// optimizeProgram runs a series of optimizations and transformations that are
|
||||||
// needed to convert a program to its final form. Some transformations are not
|
// needed to convert a program to its final form. Some transformations are not
|
||||||
// optional and must be run as the compiler expects them to run.
|
// optional and must be run as the compiler expects them to run.
|
||||||
func optimizeProgram(mod llvm.Module, config *compileopts.Config, globalValues map[string]map[string]string) error {
|
func optimizeProgram(mod llvm.Module, config *compileopts.Config) error {
|
||||||
err := interp.Run(mod, config.Options.InterpTimeout, config.DumpSSA())
|
err := interp.Run(mod, config.Options.InterpTimeout, config.DumpSSA())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1148,12 +1194,6 @@ func optimizeProgram(mod llvm.Module, config *compileopts.Config, globalValues m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert values from -ldflags="-X ..." into the IR.
|
|
||||||
err = setGlobalValues(mod, globalValues)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run most of the whole-program optimizations (including the whole
|
// Run most of the whole-program optimizations (including the whole
|
||||||
// O0/O1/O2/Os/Oz optimization pipeline).
|
// O0/O1/O2/Os/Oz optimization pipeline).
|
||||||
errs := transform.Optimize(mod, config)
|
errs := transform.Optimize(mod, config)
|
||||||
@@ -1167,10 +1207,19 @@ func optimizeProgram(mod llvm.Module, config *compileopts.Config, globalValues m
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// setGlobalValues sets the global values from the -ldflags="-X ..." compiler
|
func makeGlobalsModule(ctx llvm.Context, globals map[string]map[string]string, machine llvm.TargetMachine) llvm.Module {
|
||||||
// option in the given module. An error may be returned if the global is not of
|
mod := ctx.NewModule("cmdline-globals")
|
||||||
// the expected type.
|
targetData := machine.CreateTargetData()
|
||||||
func setGlobalValues(mod llvm.Module, globals map[string]map[string]string) error {
|
defer targetData.Dispose()
|
||||||
|
mod.SetDataLayout(targetData.String())
|
||||||
|
|
||||||
|
stringType := ctx.StructCreateNamed("runtime._string")
|
||||||
|
uintptrType := ctx.IntType(targetData.PointerSize() * 8)
|
||||||
|
stringType.StructSetBody([]llvm.Type{
|
||||||
|
llvm.PointerType(ctx.Int8Type(), 0),
|
||||||
|
uintptrType,
|
||||||
|
}, false)
|
||||||
|
|
||||||
var pkgPaths []string
|
var pkgPaths []string
|
||||||
for pkgPath := range globals {
|
for pkgPath := range globals {
|
||||||
pkgPaths = append(pkgPaths, pkgPath)
|
pkgPaths = append(pkgPaths, pkgPath)
|
||||||
@@ -1186,24 +1235,6 @@ func setGlobalValues(mod llvm.Module, globals map[string]map[string]string) erro
|
|||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
value := pkg[name]
|
value := pkg[name]
|
||||||
globalName := pkgPath + "." + name
|
globalName := pkgPath + "." + name
|
||||||
global := mod.NamedGlobal(globalName)
|
|
||||||
if global.IsNil() || !global.Initializer().IsNil() {
|
|
||||||
// The global either does not exist (optimized away?) or has
|
|
||||||
// some value, in which case it has already been initialized at
|
|
||||||
// package init time.
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// A strin is a {ptr, len} pair. We need these types to build the
|
|
||||||
// initializer.
|
|
||||||
initializerType := global.GlobalValueType()
|
|
||||||
if initializerType.TypeKind() != llvm.StructTypeKind || initializerType.StructName() == "" {
|
|
||||||
return fmt.Errorf("%s: not a string", globalName)
|
|
||||||
}
|
|
||||||
elementTypes := initializerType.StructElementTypes()
|
|
||||||
if len(elementTypes) != 2 {
|
|
||||||
return fmt.Errorf("%s: not a string", globalName)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a buffer for the string contents.
|
// Create a buffer for the string contents.
|
||||||
bufInitializer := mod.Context().ConstString(value, false)
|
bufInitializer := mod.Context().ConstString(value, false)
|
||||||
@@ -1214,22 +1245,20 @@ func setGlobalValues(mod llvm.Module, globals map[string]map[string]string) erro
|
|||||||
buf.SetLinkage(llvm.PrivateLinkage)
|
buf.SetLinkage(llvm.PrivateLinkage)
|
||||||
|
|
||||||
// Create the string value, which is a {ptr, len} pair.
|
// Create the string value, which is a {ptr, len} pair.
|
||||||
zero := llvm.ConstInt(mod.Context().Int32Type(), 0, false)
|
length := llvm.ConstInt(uintptrType, uint64(len(value)), false)
|
||||||
ptr := llvm.ConstGEP(bufInitializer.Type(), buf, []llvm.Value{zero, zero})
|
initializer := llvm.ConstNamedStruct(stringType, []llvm.Value{
|
||||||
if ptr.Type() != elementTypes[0] {
|
buf,
|
||||||
return fmt.Errorf("%s: not a string", globalName)
|
|
||||||
}
|
|
||||||
length := llvm.ConstInt(elementTypes[1], uint64(len(value)), false)
|
|
||||||
initializer := llvm.ConstNamedStruct(initializerType, []llvm.Value{
|
|
||||||
ptr,
|
|
||||||
length,
|
length,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Set the initializer. No initializer should be set at this point.
|
// Create the string global.
|
||||||
|
global := llvm.AddGlobal(mod, stringType, globalName)
|
||||||
global.SetInitializer(initializer)
|
global.SetInitializer(initializer)
|
||||||
|
global.SetAlignment(targetData.PrefTypeAlignment(stringType))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
|
return mod
|
||||||
}
|
}
|
||||||
|
|
||||||
// functionStackSizes keeps stack size information about a single function
|
// functionStackSizes keeps stack size information about a single function
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ func TestClangAttributes(t *testing.T) {
|
|||||||
{GOOS: "darwin", GOARCH: "arm64"},
|
{GOOS: "darwin", GOARCH: "arm64"},
|
||||||
{GOOS: "windows", GOARCH: "amd64"},
|
{GOOS: "windows", GOARCH: "amd64"},
|
||||||
{GOOS: "windows", GOARCH: "arm64"},
|
{GOOS: "windows", GOARCH: "arm64"},
|
||||||
{GOOS: "wasip1", GOARCH: "wasm"},
|
|
||||||
} {
|
} {
|
||||||
name := "GOOS=" + options.GOOS + ",GOARCH=" + options.GOARCH
|
name := "GOOS=" + options.GOOS + ",GOARCH=" + options.GOARCH
|
||||||
if options.GOARCH == "arm" {
|
if options.GOARCH == "arm" {
|
||||||
|
|||||||
+14
-14
@@ -145,6 +145,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Opts.RelaxELFRelocations = !Args.hasArg(OPT_mrelax_relocations_no);
|
Opts.RelaxELFRelocations = !Args.hasArg(OPT_mrelax_relocations_no);
|
||||||
|
Opts.SSE2AVX = Args.hasArg(OPT_msse2avx);
|
||||||
if (auto *DwarfFormatArg = Args.getLastArg(OPT_gdwarf64, OPT_gdwarf32))
|
if (auto *DwarfFormatArg = Args.getLastArg(OPT_gdwarf64, OPT_gdwarf32))
|
||||||
Opts.Dwarf64 = DwarfFormatArg->getOption().matches(OPT_gdwarf64);
|
Opts.Dwarf64 = DwarfFormatArg->getOption().matches(OPT_gdwarf64);
|
||||||
Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 2, Diags);
|
Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 2, Diags);
|
||||||
@@ -234,6 +235,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
|
|||||||
|
|
||||||
Opts.EmitCompactUnwindNonCanonical =
|
Opts.EmitCompactUnwindNonCanonical =
|
||||||
Args.hasArg(OPT_femit_compact_unwind_non_canonical);
|
Args.hasArg(OPT_femit_compact_unwind_non_canonical);
|
||||||
|
Opts.Crel = Args.hasArg(OPT_crel);
|
||||||
|
|
||||||
Opts.AsSecureLogFile = Args.getLastArgValue(OPT_as_secure_log_file);
|
Opts.AsSecureLogFile = Args.getLastArgValue(OPT_as_secure_log_file);
|
||||||
|
|
||||||
@@ -287,8 +289,14 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
|||||||
assert(MRI && "Unable to create target register info!");
|
assert(MRI && "Unable to create target register info!");
|
||||||
|
|
||||||
MCTargetOptions MCOptions;
|
MCTargetOptions MCOptions;
|
||||||
|
MCOptions.MCRelaxAll = Opts.RelaxAll;
|
||||||
MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind;
|
MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind;
|
||||||
MCOptions.EmitCompactUnwindNonCanonical = Opts.EmitCompactUnwindNonCanonical;
|
MCOptions.EmitCompactUnwindNonCanonical = Opts.EmitCompactUnwindNonCanonical;
|
||||||
|
MCOptions.MCSaveTempLabels = Opts.SaveTemporaryLabels;
|
||||||
|
MCOptions.Crel = Opts.Crel;
|
||||||
|
MCOptions.X86RelaxRelocations = Opts.RelaxELFRelocations;
|
||||||
|
MCOptions.X86Sse2Avx = Opts.SSE2AVX;
|
||||||
|
MCOptions.CompressDebugSections = Opts.CompressDebugSections;
|
||||||
MCOptions.AsSecureLogFile = Opts.AsSecureLogFile;
|
MCOptions.AsSecureLogFile = Opts.AsSecureLogFile;
|
||||||
|
|
||||||
std::unique_ptr<MCAsmInfo> MAI(
|
std::unique_ptr<MCAsmInfo> MAI(
|
||||||
@@ -297,9 +305,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
|||||||
|
|
||||||
// Ensure MCAsmInfo initialization occurs before any use, otherwise sections
|
// Ensure MCAsmInfo initialization occurs before any use, otherwise sections
|
||||||
// may be created with a combination of default and explicit settings.
|
// may be created with a combination of default and explicit settings.
|
||||||
MAI->setCompressDebugSections(Opts.CompressDebugSections);
|
|
||||||
|
|
||||||
MAI->setRelaxELFRelocations(Opts.RelaxELFRelocations);
|
|
||||||
|
|
||||||
bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj;
|
bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj;
|
||||||
if (Opts.OutputPath.empty())
|
if (Opts.OutputPath.empty())
|
||||||
@@ -343,8 +349,6 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
|||||||
MOFI->setDarwinTargetVariantSDKVersion(Opts.DarwinTargetVariantSDKVersion);
|
MOFI->setDarwinTargetVariantSDKVersion(Opts.DarwinTargetVariantSDKVersion);
|
||||||
Ctx.setObjectFileInfo(MOFI.get());
|
Ctx.setObjectFileInfo(MOFI.get());
|
||||||
|
|
||||||
if (Opts.SaveTemporaryLabels)
|
|
||||||
Ctx.setAllowTemporaryLabels(false);
|
|
||||||
if (Opts.GenDwarfForAssembly)
|
if (Opts.GenDwarfForAssembly)
|
||||||
Ctx.setGenDwarfForAssembly(true);
|
Ctx.setGenDwarfForAssembly(true);
|
||||||
if (!Opts.DwarfDebugFlags.empty())
|
if (!Opts.DwarfDebugFlags.empty())
|
||||||
@@ -381,6 +385,9 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
|||||||
MCOptions.MCNoWarn = Opts.NoWarn;
|
MCOptions.MCNoWarn = Opts.NoWarn;
|
||||||
MCOptions.MCFatalWarnings = Opts.FatalWarnings;
|
MCOptions.MCFatalWarnings = Opts.FatalWarnings;
|
||||||
MCOptions.MCNoTypeCheck = Opts.NoTypeCheck;
|
MCOptions.MCNoTypeCheck = Opts.NoTypeCheck;
|
||||||
|
MCOptions.ShowMCInst = Opts.ShowInst;
|
||||||
|
MCOptions.AsmVerbose = true;
|
||||||
|
MCOptions.MCUseDwarfDirectory = MCTargetOptions::EnableDwarfDirectory;
|
||||||
MCOptions.ABIName = Opts.TargetABI;
|
MCOptions.ABIName = Opts.TargetABI;
|
||||||
|
|
||||||
// FIXME: There is a bit of code duplication with addPassesToEmitFile.
|
// FIXME: There is a bit of code duplication with addPassesToEmitFile.
|
||||||
@@ -395,10 +402,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
|||||||
TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions));
|
TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions));
|
||||||
|
|
||||||
auto FOut = std::make_unique<formatted_raw_ostream>(*Out);
|
auto FOut = std::make_unique<formatted_raw_ostream>(*Out);
|
||||||
Str.reset(TheTarget->createAsmStreamer(
|
Str.reset(TheTarget->createAsmStreamer(Ctx, std::move(FOut), IP,
|
||||||
Ctx, std::move(FOut), /*asmverbose*/ true,
|
std::move(CE), std::move(MAB)));
|
||||||
/*useDwarfDirectory*/ true, IP, std::move(CE), std::move(MAB),
|
|
||||||
Opts.ShowInst));
|
|
||||||
} else if (Opts.OutputType == AssemblerInvocation::FT_Null) {
|
} else if (Opts.OutputType == AssemblerInvocation::FT_Null) {
|
||||||
Str.reset(createNullStreamer(Ctx));
|
Str.reset(createNullStreamer(Ctx));
|
||||||
} else {
|
} else {
|
||||||
@@ -421,9 +426,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
|||||||
|
|
||||||
Triple T(Opts.Triple);
|
Triple T(Opts.Triple);
|
||||||
Str.reset(TheTarget->createMCObjectStreamer(
|
Str.reset(TheTarget->createMCObjectStreamer(
|
||||||
T, Ctx, std::move(MAB), std::move(OW), std::move(CE), *STI,
|
T, Ctx, std::move(MAB), std::move(OW), std::move(CE), *STI));
|
||||||
Opts.RelaxAll, Opts.IncrementalLinkerCompatible,
|
|
||||||
/*DWARFMustBeAtTheEnd*/ true));
|
|
||||||
Str.get()->initSections(Opts.NoExecStack, *STI);
|
Str.get()->initSections(Opts.NoExecStack, *STI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,9 +439,6 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
|||||||
Str.get()->emitZeros(1);
|
Str.get()->emitZeros(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assembly to object compilation should leverage assembly info.
|
|
||||||
Str->setUseAssemblerInfoForParsing(true);
|
|
||||||
|
|
||||||
bool Failed = false;
|
bool Failed = false;
|
||||||
|
|
||||||
std::unique_ptr<MCAsmParser> Parser(
|
std::unique_ptr<MCAsmParser> Parser(
|
||||||
|
|||||||
+25
-1
@@ -38,10 +38,17 @@ struct AssemblerInvocation {
|
|||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
std::vector<std::string> IncludePaths;
|
std::vector<std::string> IncludePaths;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned NoInitialTextSection : 1;
|
unsigned NoInitialTextSection : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned SaveTemporaryLabels : 1;
|
unsigned SaveTemporaryLabels : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned GenDwarfForAssembly : 1;
|
unsigned GenDwarfForAssembly : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned RelaxELFRelocations : 1;
|
unsigned RelaxELFRelocations : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
|
unsigned SSE2AVX : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned Dwarf64 : 1;
|
unsigned Dwarf64 : 1;
|
||||||
unsigned DwarfVersion;
|
unsigned DwarfVersion;
|
||||||
std::string DwarfDebugFlags;
|
std::string DwarfDebugFlags;
|
||||||
@@ -66,7 +73,9 @@ struct AssemblerInvocation {
|
|||||||
FT_Obj ///< Object file output.
|
FT_Obj ///< Object file output.
|
||||||
};
|
};
|
||||||
FileType OutputType;
|
FileType OutputType;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned ShowHelp : 1;
|
unsigned ShowHelp : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned ShowVersion : 1;
|
unsigned ShowVersion : 1;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
@@ -74,28 +83,41 @@ struct AssemblerInvocation {
|
|||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
unsigned OutputAsmVariant;
|
unsigned OutputAsmVariant;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned ShowEncoding : 1;
|
unsigned ShowEncoding : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned ShowInst : 1;
|
unsigned ShowInst : 1;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
/// @name Assembler Options
|
/// @name Assembler Options
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned RelaxAll : 1;
|
unsigned RelaxAll : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned NoExecStack : 1;
|
unsigned NoExecStack : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned FatalWarnings : 1;
|
unsigned FatalWarnings : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned NoWarn : 1;
|
unsigned NoWarn : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned NoTypeCheck : 1;
|
unsigned NoTypeCheck : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned IncrementalLinkerCompatible : 1;
|
unsigned IncrementalLinkerCompatible : 1;
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned EmbedBitcode : 1;
|
unsigned EmbedBitcode : 1;
|
||||||
|
|
||||||
/// Whether to emit DWARF unwind info.
|
/// Whether to emit DWARF unwind info.
|
||||||
EmitDwarfUnwindType EmitDwarfUnwind;
|
EmitDwarfUnwindType EmitDwarfUnwind;
|
||||||
|
|
||||||
// Whether to emit compact-unwind for non-canonical entries.
|
// Whether to emit compact-unwind for non-canonical entries.
|
||||||
// Note: maybe overridden by other constraints.
|
// Note: maybe overriden by other constraints.
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
unsigned EmitCompactUnwindNonCanonical : 1;
|
unsigned EmitCompactUnwindNonCanonical : 1;
|
||||||
|
|
||||||
|
LLVM_PREFERRED_TYPE(bool)
|
||||||
|
unsigned Crel : 1;
|
||||||
|
|
||||||
/// The name of the relocation model to use.
|
/// The name of the relocation model to use.
|
||||||
std::string RelocationModel;
|
std::string RelocationModel;
|
||||||
|
|
||||||
@@ -126,6 +148,7 @@ public:
|
|||||||
ShowInst = 0;
|
ShowInst = 0;
|
||||||
ShowEncoding = 0;
|
ShowEncoding = 0;
|
||||||
RelaxAll = 0;
|
RelaxAll = 0;
|
||||||
|
SSE2AVX = 0;
|
||||||
NoExecStack = 0;
|
NoExecStack = 0;
|
||||||
FatalWarnings = 0;
|
FatalWarnings = 0;
|
||||||
NoWarn = 0;
|
NoWarn = 0;
|
||||||
@@ -136,6 +159,7 @@ public:
|
|||||||
EmbedBitcode = 0;
|
EmbedBitcode = 0;
|
||||||
EmitDwarfUnwind = EmitDwarfUnwindType::Default;
|
EmitDwarfUnwind = EmitDwarfUnwindType::Default;
|
||||||
EmitCompactUnwindNonCanonical = false;
|
EmitCompactUnwindNonCanonical = false;
|
||||||
|
Crel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool CreateFromArgs(AssemblerInvocation &Res,
|
static bool CreateFromArgs(AssemblerInvocation &Res,
|
||||||
|
|||||||
+2
-2
@@ -26,7 +26,7 @@ func NewConfig(options *compileopts.Options) (*compileopts.Config, error) {
|
|||||||
|
|
||||||
// Version range supported by TinyGo.
|
// Version range supported by TinyGo.
|
||||||
const minorMin = 19
|
const minorMin = 19
|
||||||
const minorMax = 23
|
const minorMax = 24
|
||||||
|
|
||||||
// Check that we support this Go toolchain version.
|
// Check that we support this Go toolchain version.
|
||||||
gorootMajor, gorootMinor, err := goenv.GetGorootVersion()
|
gorootMajor, gorootMinor, err := goenv.GetGorootVersion()
|
||||||
@@ -36,7 +36,7 @@ func NewConfig(options *compileopts.Options) (*compileopts.Config, error) {
|
|||||||
if gorootMajor != 1 || gorootMinor < minorMin || gorootMinor > minorMax {
|
if gorootMajor != 1 || gorootMinor < minorMin || gorootMinor > minorMax {
|
||||||
// Note: when this gets updated, also update the Go compatibility matrix:
|
// Note: when this gets updated, also update the Go compatibility matrix:
|
||||||
// https://github.com/tinygo-org/tinygo-site/blob/dev/content/docs/reference/go-compat-matrix.md
|
// https://github.com/tinygo-org/tinygo-site/blob/dev/content/docs/reference/go-compat-matrix.md
|
||||||
return nil, fmt.Errorf("requires go version 1.19 through 1.23, got go%d.%d", gorootMajor, gorootMinor)
|
return nil, fmt.Errorf("requires go version 1.%d through 1.%d, got go%d.%d", minorMin, minorMax, gorootMajor, gorootMinor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the Go toolchain version isn't too new, if we haven't been
|
// Check that the Go toolchain version isn't too new, if we haven't been
|
||||||
|
|||||||
+20
-5
@@ -43,7 +43,11 @@ type Library struct {
|
|||||||
// output archive file, it is expected to be removed after use.
|
// output archive file, it is expected to be removed after use.
|
||||||
// As a side effect, this call creates the library header files if they didn't
|
// As a side effect, this call creates the library header files if they didn't
|
||||||
// exist yet.
|
// exist yet.
|
||||||
func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJob, abortLock func(), err error) {
|
// The provided libc job (if not null) will cause this libc to be added as a
|
||||||
|
// dependency for all C compiler jobs, and adds libc headers for the given
|
||||||
|
// target config. In other words, pass this libc if the library needs a libc to
|
||||||
|
// compile.
|
||||||
|
func (l *Library) load(config *compileopts.Config, tmpdir string, libc *compileJob) (job *compileJob, abortLock func(), err error) {
|
||||||
outdir, precompiled := config.LibcPath(l.name)
|
outdir, precompiled := config.LibcPath(l.name)
|
||||||
archiveFilePath := filepath.Join(outdir, "lib.a")
|
archiveFilePath := filepath.Join(outdir, "lib.a")
|
||||||
if precompiled {
|
if precompiled {
|
||||||
@@ -181,6 +185,9 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
|
|||||||
args = append(args, "-mfpu=vfpv2")
|
args = append(args, "-mfpu=vfpv2")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if libc != nil {
|
||||||
|
args = append(args, config.LibcCFlags()...)
|
||||||
|
}
|
||||||
|
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
|
|
||||||
@@ -233,7 +240,7 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
|
|||||||
objpath := filepath.Join(dir, cleanpath+".o")
|
objpath := filepath.Join(dir, cleanpath+".o")
|
||||||
os.MkdirAll(filepath.Dir(objpath), 0o777)
|
os.MkdirAll(filepath.Dir(objpath), 0o777)
|
||||||
objs = append(objs, objpath)
|
objs = append(objs, objpath)
|
||||||
job.dependencies = append(job.dependencies, &compileJob{
|
objfile := &compileJob{
|
||||||
description: "compile " + srcpath,
|
description: "compile " + srcpath,
|
||||||
run: func(*compileJob) error {
|
run: func(*compileJob) error {
|
||||||
var compileArgs []string
|
var compileArgs []string
|
||||||
@@ -248,7 +255,11 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
if libc != nil {
|
||||||
|
objfile.dependencies = append(objfile.dependencies, libc)
|
||||||
|
}
|
||||||
|
job.dependencies = append(job.dependencies, objfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create crt1.o job, if needed.
|
// Create crt1.o job, if needed.
|
||||||
@@ -257,7 +268,7 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
|
|||||||
// won't make much of a difference in speed).
|
// won't make much of a difference in speed).
|
||||||
if l.crt1Source != "" {
|
if l.crt1Source != "" {
|
||||||
srcpath := filepath.Join(sourceDir, l.crt1Source)
|
srcpath := filepath.Join(sourceDir, l.crt1Source)
|
||||||
job.dependencies = append(job.dependencies, &compileJob{
|
crt1Job := &compileJob{
|
||||||
description: "compile " + srcpath,
|
description: "compile " + srcpath,
|
||||||
run: func(*compileJob) error {
|
run: func(*compileJob) error {
|
||||||
var compileArgs []string
|
var compileArgs []string
|
||||||
@@ -277,7 +288,11 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
|
|||||||
}
|
}
|
||||||
return os.Rename(tmpfile.Name(), filepath.Join(outdir, "crt1.o"))
|
return os.Rename(tmpfile.Name(), filepath.Join(outdir, "crt1.o"))
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
if libc != nil {
|
||||||
|
crt1Job.dependencies = append(crt1Job.dependencies, libc)
|
||||||
|
}
|
||||||
|
job.dependencies = append(job.dependencies, crt1Job)
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = true
|
ok = true
|
||||||
|
|||||||
@@ -113,26 +113,32 @@ var libMusl = Library{
|
|||||||
librarySources: func(target string) ([]string, error) {
|
librarySources: func(target string) ([]string, error) {
|
||||||
arch := compileopts.MuslArchitecture(target)
|
arch := compileopts.MuslArchitecture(target)
|
||||||
globs := []string{
|
globs := []string{
|
||||||
|
"ctype/*.c",
|
||||||
"env/*.c",
|
"env/*.c",
|
||||||
"errno/*.c",
|
"errno/*.c",
|
||||||
"exit/*.c",
|
"exit/*.c",
|
||||||
"fcntl/*.c",
|
"fcntl/*.c",
|
||||||
"internal/defsysinfo.c",
|
"internal/defsysinfo.c",
|
||||||
|
"internal/intscan.c",
|
||||||
"internal/libc.c",
|
"internal/libc.c",
|
||||||
|
"internal/shgetc.c",
|
||||||
"internal/syscall_ret.c",
|
"internal/syscall_ret.c",
|
||||||
"internal/vdso.c",
|
"internal/vdso.c",
|
||||||
"legacy/*.c",
|
"legacy/*.c",
|
||||||
"locale/*.c",
|
"locale/*.c",
|
||||||
"linux/*.c",
|
"linux/*.c",
|
||||||
|
"locale/*.c",
|
||||||
"malloc/*.c",
|
"malloc/*.c",
|
||||||
"malloc/mallocng/*.c",
|
"malloc/mallocng/*.c",
|
||||||
"mman/*.c",
|
"mman/*.c",
|
||||||
"math/*.c",
|
"math/*.c",
|
||||||
"misc/*.c",
|
"misc/*.c",
|
||||||
"multibyte/*.c",
|
"multibyte/*.c",
|
||||||
|
"sched/*.c",
|
||||||
"signal/" + arch + "/*.s",
|
"signal/" + arch + "/*.s",
|
||||||
"signal/*.c",
|
"signal/*.c",
|
||||||
"stdio/*.c",
|
"stdio/*.c",
|
||||||
|
"stdlib/*.c",
|
||||||
"string/*.c",
|
"string/*.c",
|
||||||
"thread/" + arch + "/*.s",
|
"thread/" + arch + "/*.s",
|
||||||
"thread/*.c",
|
"thread/*.c",
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ func TestBinarySize(t *testing.T) {
|
|||||||
// This is a small number of very diverse targets that we want to test.
|
// This is a small number of very diverse targets that we want to test.
|
||||||
tests := []sizeTest{
|
tests := []sizeTest{
|
||||||
// microcontrollers
|
// microcontrollers
|
||||||
{"hifive1b", "examples/echo", 4600, 280, 0, 2268},
|
{"hifive1b", "examples/echo", 4560, 280, 0, 2268},
|
||||||
{"microbit", "examples/serial", 2908, 388, 8, 2272},
|
{"microbit", "examples/serial", 2916, 388, 8, 2272},
|
||||||
{"wioterminal", "examples/pininterrupt", 6140, 1484, 116, 6824},
|
{"wioterminal", "examples/pininterrupt", 7359, 1489, 116, 6912},
|
||||||
|
|
||||||
// TODO: also check wasm. Right now this is difficult, because
|
// TODO: also check wasm. Right now this is difficult, because
|
||||||
// wasm binaries are run through wasm-opt and therefore the
|
// wasm binaries are run through wasm-opt and therefore the
|
||||||
|
|||||||
+5
-5
@@ -114,8 +114,8 @@ func parseLLDErrors(text string) error {
|
|||||||
|
|
||||||
// Check for undefined symbols.
|
// Check for undefined symbols.
|
||||||
// This can happen in some cases like with CGo and //go:linkname tricker.
|
// This can happen in some cases like with CGo and //go:linkname tricker.
|
||||||
if matches := regexp.MustCompile(`^ld.lld: error: undefined symbol: (.*)\n`).FindStringSubmatch(message); matches != nil {
|
if matches := regexp.MustCompile(`^ld.lld(-[0-9]+)?: error: undefined symbol: (.*)\n`).FindStringSubmatch(message); matches != nil {
|
||||||
symbolName := matches[1]
|
symbolName := matches[2]
|
||||||
for _, line := range strings.Split(message, "\n") {
|
for _, line := range strings.Split(message, "\n") {
|
||||||
matches := regexp.MustCompile(`referenced by .* \(((.*):([0-9]+))\)`).FindStringSubmatch(line)
|
matches := regexp.MustCompile(`referenced by .* \(((.*):([0-9]+))\)`).FindStringSubmatch(line)
|
||||||
if matches != nil {
|
if matches != nil {
|
||||||
@@ -134,9 +134,9 @@ func parseLLDErrors(text string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for flash/RAM overflow.
|
// Check for flash/RAM overflow.
|
||||||
if matches := regexp.MustCompile(`^ld.lld: error: section '(.*?)' will not fit in region '(.*?)': overflowed by ([0-9]+) bytes$`).FindStringSubmatch(message); matches != nil {
|
if matches := regexp.MustCompile(`^ld.lld(-[0-9]+)?: error: section '(.*?)' will not fit in region '(.*?)': overflowed by ([0-9]+) bytes$`).FindStringSubmatch(message); matches != nil {
|
||||||
region := matches[2]
|
region := matches[3]
|
||||||
n, err := strconv.ParseUint(matches[3], 10, 64)
|
n, err := strconv.ParseUint(matches[4], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Should not happen at all (unless it overflows an uint64 for some reason).
|
// Should not happen at all (unless it overflows an uint64 for some reason).
|
||||||
continue
|
continue
|
||||||
|
|||||||
+45
-64
@@ -92,18 +92,18 @@ type noescapingFunc struct {
|
|||||||
// cgoAliases list type aliases between Go and C, for types that are equivalent
|
// cgoAliases list type aliases between Go and C, for types that are equivalent
|
||||||
// in both languages. See addTypeAliases.
|
// in both languages. See addTypeAliases.
|
||||||
var cgoAliases = map[string]string{
|
var cgoAliases = map[string]string{
|
||||||
"C.int8_t": "int8",
|
"_Cgo_int8_t": "int8",
|
||||||
"C.int16_t": "int16",
|
"_Cgo_int16_t": "int16",
|
||||||
"C.int32_t": "int32",
|
"_Cgo_int32_t": "int32",
|
||||||
"C.int64_t": "int64",
|
"_Cgo_int64_t": "int64",
|
||||||
"C.uint8_t": "uint8",
|
"_Cgo_uint8_t": "uint8",
|
||||||
"C.uint16_t": "uint16",
|
"_Cgo_uint16_t": "uint16",
|
||||||
"C.uint32_t": "uint32",
|
"_Cgo_uint32_t": "uint32",
|
||||||
"C.uint64_t": "uint64",
|
"_Cgo_uint64_t": "uint64",
|
||||||
"C.uintptr_t": "uintptr",
|
"_Cgo_uintptr_t": "uintptr",
|
||||||
"C.float": "float32",
|
"_Cgo_float": "float32",
|
||||||
"C.double": "float64",
|
"_Cgo_double": "float64",
|
||||||
"C._Bool": "bool",
|
"_Cgo__Bool": "bool",
|
||||||
}
|
}
|
||||||
|
|
||||||
// builtinAliases are handled specially because they only exist on the Go side
|
// builtinAliases are handled specially because they only exist on the Go side
|
||||||
@@ -145,48 +145,46 @@ typedef unsigned long long _Cgo_ulonglong;
|
|||||||
// The string/bytes functions below implement C.CString etc. To make sure the
|
// The string/bytes functions below implement C.CString etc. To make sure the
|
||||||
// runtime doesn't need to know the C int type, lengths are converted to uintptr
|
// runtime doesn't need to know the C int type, lengths are converted to uintptr
|
||||||
// first.
|
// first.
|
||||||
// These functions will be modified to get a "C." prefix, so the source below
|
|
||||||
// doesn't reflect the final AST.
|
|
||||||
const generatedGoFilePrefixBase = `
|
const generatedGoFilePrefixBase = `
|
||||||
import "syscall"
|
import "syscall"
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
var _ unsafe.Pointer
|
var _ unsafe.Pointer
|
||||||
|
|
||||||
//go:linkname C.CString runtime.cgo_CString
|
//go:linkname _Cgo_CString runtime.cgo_CString
|
||||||
func CString(string) *C.char
|
func _Cgo_CString(string) *_Cgo_char
|
||||||
|
|
||||||
//go:linkname C.GoString runtime.cgo_GoString
|
//go:linkname _Cgo_GoString runtime.cgo_GoString
|
||||||
func GoString(*C.char) string
|
func _Cgo_GoString(*_Cgo_char) string
|
||||||
|
|
||||||
//go:linkname C.__GoStringN runtime.cgo_GoStringN
|
//go:linkname _Cgo___GoStringN runtime.cgo_GoStringN
|
||||||
func __GoStringN(*C.char, uintptr) string
|
func _Cgo___GoStringN(*_Cgo_char, uintptr) string
|
||||||
|
|
||||||
func GoStringN(cstr *C.char, length C.int) string {
|
func _Cgo_GoStringN(cstr *_Cgo_char, length _Cgo_int) string {
|
||||||
return C.__GoStringN(cstr, uintptr(length))
|
return _Cgo___GoStringN(cstr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__GoBytes runtime.cgo_GoBytes
|
//go:linkname _Cgo___GoBytes runtime.cgo_GoBytes
|
||||||
func __GoBytes(unsafe.Pointer, uintptr) []byte
|
func _Cgo___GoBytes(unsafe.Pointer, uintptr) []byte
|
||||||
|
|
||||||
func GoBytes(ptr unsafe.Pointer, length C.int) []byte {
|
func _Cgo_GoBytes(ptr unsafe.Pointer, length _Cgo_int) []byte {
|
||||||
return C.__GoBytes(ptr, uintptr(length))
|
return _Cgo___GoBytes(ptr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__CBytes runtime.cgo_CBytes
|
//go:linkname _Cgo___CBytes runtime.cgo_CBytes
|
||||||
func __CBytes([]byte) unsafe.Pointer
|
func _Cgo___CBytes([]byte) unsafe.Pointer
|
||||||
|
|
||||||
func CBytes(b []byte) unsafe.Pointer {
|
func _Cgo_CBytes(b []byte) unsafe.Pointer {
|
||||||
return C.__CBytes(b)
|
return _Cgo___CBytes(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__get_errno_num runtime.cgo_errno
|
//go:linkname _Cgo___get_errno_num runtime.cgo_errno
|
||||||
func __get_errno_num() uintptr
|
func _Cgo___get_errno_num() uintptr
|
||||||
`
|
`
|
||||||
|
|
||||||
const generatedGoFilePrefixOther = generatedGoFilePrefixBase + `
|
const generatedGoFilePrefixOther = generatedGoFilePrefixBase + `
|
||||||
func __get_errno() error {
|
func _Cgo___get_errno() error {
|
||||||
return syscall.Errno(C.__get_errno_num())
|
return syscall.Errno(_Cgo___get_errno_num())
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
@@ -197,7 +195,7 @@ func __get_errno() error {
|
|||||||
// map the errno values to match the values in the syscall package.
|
// map the errno values to match the values in the syscall package.
|
||||||
// Source of the errno values: lib/mingw-w64/mingw-w64-headers/crt/errno.h
|
// Source of the errno values: lib/mingw-w64/mingw-w64-headers/crt/errno.h
|
||||||
const generatedGoFilePrefixWindows = generatedGoFilePrefixBase + `
|
const generatedGoFilePrefixWindows = generatedGoFilePrefixBase + `
|
||||||
var __errno_mapping = [...]syscall.Errno{
|
var _Cgo___errno_mapping = [...]syscall.Errno{
|
||||||
1: syscall.EPERM,
|
1: syscall.EPERM,
|
||||||
2: syscall.ENOENT,
|
2: syscall.ENOENT,
|
||||||
3: syscall.ESRCH,
|
3: syscall.ESRCH,
|
||||||
@@ -238,10 +236,10 @@ var __errno_mapping = [...]syscall.Errno{
|
|||||||
42: syscall.EILSEQ,
|
42: syscall.EILSEQ,
|
||||||
}
|
}
|
||||||
|
|
||||||
func __get_errno() error {
|
func _Cgo___get_errno() error {
|
||||||
num := C.__get_errno_num()
|
num := _Cgo___get_errno_num()
|
||||||
if num < uintptr(len(__errno_mapping)) {
|
if num < uintptr(len(_Cgo___errno_mapping)) {
|
||||||
if mapped := __errno_mapping[num]; mapped != 0 {
|
if mapped := _Cgo___errno_mapping[num]; mapped != 0 {
|
||||||
return mapped
|
return mapped
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -304,23 +302,6 @@ func Process(files []*ast.File, dir, importPath string, fset *token.FileSet, cfl
|
|||||||
// If the Comments field is not set to nil, the go/format package will get
|
// If the Comments field is not set to nil, the go/format package will get
|
||||||
// confused about where comments should go.
|
// confused about where comments should go.
|
||||||
p.generated.Comments = nil
|
p.generated.Comments = nil
|
||||||
// Adjust some of the functions in there.
|
|
||||||
for _, decl := range p.generated.Decls {
|
|
||||||
switch decl := decl.(type) {
|
|
||||||
case *ast.FuncDecl:
|
|
||||||
switch decl.Name.Name {
|
|
||||||
case "CString", "GoString", "GoStringN", "__GoStringN", "GoBytes", "__GoBytes", "CBytes", "__CBytes", "__get_errno_num", "__get_errno", "__errno_mapping":
|
|
||||||
// Adjust the name to have a "C." prefix so it is correctly
|
|
||||||
// resolved.
|
|
||||||
decl.Name.Name = "C." + decl.Name.Name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Patch some types, for example *C.char in C.CString.
|
|
||||||
cf := p.newCGoFile(nil, -1) // dummy *cgoFile for the walker
|
|
||||||
astutil.Apply(p.generated, func(cursor *astutil.Cursor) bool {
|
|
||||||
return cf.walker(cursor, nil)
|
|
||||||
}, nil)
|
|
||||||
|
|
||||||
// Find `import "C"` C fragments in the file.
|
// Find `import "C"` C fragments in the file.
|
||||||
p.cgoHeaders = make([]string, len(files)) // combined CGo header fragment for each file
|
p.cgoHeaders = make([]string, len(files)) // combined CGo header fragment for each file
|
||||||
@@ -399,7 +380,7 @@ func Process(files []*ast.File, dir, importPath string, fset *token.FileSet, cfl
|
|||||||
Tok: token.TYPE,
|
Tok: token.TYPE,
|
||||||
}
|
}
|
||||||
for _, name := range builtinAliases {
|
for _, name := range builtinAliases {
|
||||||
typeSpec := p.getIntegerType("C."+name, names["_Cgo_"+name])
|
typeSpec := p.getIntegerType("_Cgo_"+name, names["_Cgo_"+name])
|
||||||
gen.Specs = append(gen.Specs, typeSpec)
|
gen.Specs = append(gen.Specs, typeSpec)
|
||||||
}
|
}
|
||||||
p.generated.Decls = append(p.generated.Decls, gen)
|
p.generated.Decls = append(p.generated.Decls, gen)
|
||||||
@@ -1272,7 +1253,7 @@ func (p *cgoPackage) getUnnamedDeclName(prefix string, itf interface{}) string {
|
|||||||
func (f *cgoFile) getASTDeclName(name string, found clangCursor, iscall bool) string {
|
func (f *cgoFile) getASTDeclName(name string, found clangCursor, iscall bool) string {
|
||||||
// Some types are defined in stdint.h and map directly to a particular Go
|
// Some types are defined in stdint.h and map directly to a particular Go
|
||||||
// type.
|
// type.
|
||||||
if alias := cgoAliases["C."+name]; alias != "" {
|
if alias := cgoAliases["_Cgo_"+name]; alias != "" {
|
||||||
return alias
|
return alias
|
||||||
}
|
}
|
||||||
node := f.getASTDeclNode(name, found)
|
node := f.getASTDeclNode(name, found)
|
||||||
@@ -1282,7 +1263,7 @@ func (f *cgoFile) getASTDeclName(name string, found clangCursor, iscall bool) st
|
|||||||
}
|
}
|
||||||
return node.Name.Name
|
return node.Name.Name
|
||||||
}
|
}
|
||||||
return "C." + name
|
return "_Cgo_" + name
|
||||||
}
|
}
|
||||||
|
|
||||||
// getASTDeclNode will declare the given C AST node (if not already defined) and
|
// getASTDeclNode will declare the given C AST node (if not already defined) and
|
||||||
@@ -1382,8 +1363,8 @@ extern __typeof(%s) %s __attribute__((alias(%#v)));
|
|||||||
case *elaboratedTypeInfo:
|
case *elaboratedTypeInfo:
|
||||||
// Add struct bitfields.
|
// Add struct bitfields.
|
||||||
for _, bitfield := range elaboratedType.bitfields {
|
for _, bitfield := range elaboratedType.bitfields {
|
||||||
f.createBitfieldGetter(bitfield, "C."+name)
|
f.createBitfieldGetter(bitfield, "_Cgo_"+name)
|
||||||
f.createBitfieldSetter(bitfield, "C."+name)
|
f.createBitfieldSetter(bitfield, "_Cgo_"+name)
|
||||||
}
|
}
|
||||||
if elaboratedType.unionSize != 0 {
|
if elaboratedType.unionSize != 0 {
|
||||||
// Create union getters/setters.
|
// Create union getters/setters.
|
||||||
@@ -1392,7 +1373,7 @@ extern __typeof(%s) %s __attribute__((alias(%#v)));
|
|||||||
f.addError(elaboratedType.pos, fmt.Sprintf("union must have field with a single name, it has %d names", len(field.Names)))
|
f.addError(elaboratedType.pos, fmt.Sprintf("union must have field with a single name, it has %d names", len(field.Names)))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
f.createUnionAccessor(field, "C."+name)
|
f.createUnionAccessor(field, "_Cgo_"+name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1441,7 +1422,7 @@ func (f *cgoFile) walker(cursor *astutil.Cursor, names map[string]clangCursor) b
|
|||||||
node.Rhs = append(node.Rhs, &ast.CallExpr{
|
node.Rhs = append(node.Rhs, &ast.CallExpr{
|
||||||
Fun: &ast.Ident{
|
Fun: &ast.Ident{
|
||||||
NamePos: node.Lhs[1].End(),
|
NamePos: node.Lhs[1].End(),
|
||||||
Name: "C.__get_errno",
|
Name: "_Cgo___get_errno",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1466,7 +1447,7 @@ func (f *cgoFile) walker(cursor *astutil.Cursor, names map[string]clangCursor) b
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if x.Name == "C" {
|
if x.Name == "C" {
|
||||||
name := "C." + node.Sel.Name
|
name := "_Cgo_" + node.Sel.Name
|
||||||
if found, ok := names[node.Sel.Name]; ok {
|
if found, ok := names[node.Sel.Name]; ok {
|
||||||
name = f.getASTDeclName(node.Sel.Name, found, false)
|
name = f.getASTDeclName(node.Sel.Name, found, false)
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-27
@@ -219,7 +219,7 @@ func (f *cgoFile) createASTNode(name string, c clangCursor) (ast.Node, any) {
|
|||||||
numArgs := int(C.tinygo_clang_Cursor_getNumArguments(c))
|
numArgs := int(C.tinygo_clang_Cursor_getNumArguments(c))
|
||||||
obj := &ast.Object{
|
obj := &ast.Object{
|
||||||
Kind: ast.Fun,
|
Kind: ast.Fun,
|
||||||
Name: "C." + name,
|
Name: "_Cgo_" + name,
|
||||||
}
|
}
|
||||||
exportName := name
|
exportName := name
|
||||||
localName := name
|
localName := name
|
||||||
@@ -257,7 +257,7 @@ func (f *cgoFile) createASTNode(name string, c clangCursor) (ast.Node, any) {
|
|||||||
},
|
},
|
||||||
Name: &ast.Ident{
|
Name: &ast.Ident{
|
||||||
NamePos: pos,
|
NamePos: pos,
|
||||||
Name: "C." + localName,
|
Name: "_Cgo_" + localName,
|
||||||
Obj: obj,
|
Obj: obj,
|
||||||
},
|
},
|
||||||
Type: &ast.FuncType{
|
Type: &ast.FuncType{
|
||||||
@@ -319,7 +319,7 @@ func (f *cgoFile) createASTNode(name string, c clangCursor) (ast.Node, any) {
|
|||||||
return decl, stringSignature
|
return decl, stringSignature
|
||||||
case C.CXCursor_StructDecl, C.CXCursor_UnionDecl:
|
case C.CXCursor_StructDecl, C.CXCursor_UnionDecl:
|
||||||
typ := f.makeASTRecordType(c, pos)
|
typ := f.makeASTRecordType(c, pos)
|
||||||
typeName := "C." + name
|
typeName := "_Cgo_" + name
|
||||||
typeExpr := typ.typeExpr
|
typeExpr := typ.typeExpr
|
||||||
if typ.unionSize != 0 {
|
if typ.unionSize != 0 {
|
||||||
// Convert to a single-field struct type.
|
// Convert to a single-field struct type.
|
||||||
@@ -340,7 +340,7 @@ func (f *cgoFile) createASTNode(name string, c clangCursor) (ast.Node, any) {
|
|||||||
obj.Decl = typeSpec
|
obj.Decl = typeSpec
|
||||||
return typeSpec, typ
|
return typeSpec, typ
|
||||||
case C.CXCursor_TypedefDecl:
|
case C.CXCursor_TypedefDecl:
|
||||||
typeName := "C." + name
|
typeName := "_Cgo_" + name
|
||||||
underlyingType := C.tinygo_clang_getTypedefDeclUnderlyingType(c)
|
underlyingType := C.tinygo_clang_getTypedefDeclUnderlyingType(c)
|
||||||
obj := &ast.Object{
|
obj := &ast.Object{
|
||||||
Kind: ast.Typ,
|
Kind: ast.Typ,
|
||||||
@@ -378,12 +378,12 @@ func (f *cgoFile) createASTNode(name string, c clangCursor) (ast.Node, any) {
|
|||||||
}
|
}
|
||||||
obj := &ast.Object{
|
obj := &ast.Object{
|
||||||
Kind: ast.Var,
|
Kind: ast.Var,
|
||||||
Name: "C." + name,
|
Name: "_Cgo_" + name,
|
||||||
}
|
}
|
||||||
valueSpec := &ast.ValueSpec{
|
valueSpec := &ast.ValueSpec{
|
||||||
Names: []*ast.Ident{{
|
Names: []*ast.Ident{{
|
||||||
NamePos: pos,
|
NamePos: pos,
|
||||||
Name: "C." + name,
|
Name: "_Cgo_" + name,
|
||||||
Obj: obj,
|
Obj: obj,
|
||||||
}},
|
}},
|
||||||
Type: typeExpr,
|
Type: typeExpr,
|
||||||
@@ -407,12 +407,12 @@ func (f *cgoFile) createASTNode(name string, c clangCursor) (ast.Node, any) {
|
|||||||
}
|
}
|
||||||
obj := &ast.Object{
|
obj := &ast.Object{
|
||||||
Kind: ast.Con,
|
Kind: ast.Con,
|
||||||
Name: "C." + name,
|
Name: "_Cgo_" + name,
|
||||||
}
|
}
|
||||||
valueSpec := &ast.ValueSpec{
|
valueSpec := &ast.ValueSpec{
|
||||||
Names: []*ast.Ident{{
|
Names: []*ast.Ident{{
|
||||||
NamePos: pos,
|
NamePos: pos,
|
||||||
Name: "C." + name,
|
Name: "_Cgo_" + name,
|
||||||
Obj: obj,
|
Obj: obj,
|
||||||
}},
|
}},
|
||||||
Values: []ast.Expr{expr},
|
Values: []ast.Expr{expr},
|
||||||
@@ -423,7 +423,7 @@ func (f *cgoFile) createASTNode(name string, c clangCursor) (ast.Node, any) {
|
|||||||
case C.CXCursor_EnumDecl:
|
case C.CXCursor_EnumDecl:
|
||||||
obj := &ast.Object{
|
obj := &ast.Object{
|
||||||
Kind: ast.Typ,
|
Kind: ast.Typ,
|
||||||
Name: "C." + name,
|
Name: "_Cgo_" + name,
|
||||||
}
|
}
|
||||||
underlying := C.tinygo_clang_getEnumDeclIntegerType(c)
|
underlying := C.tinygo_clang_getEnumDeclIntegerType(c)
|
||||||
// TODO: gc's CGo implementation uses types such as `uint32` for enums
|
// TODO: gc's CGo implementation uses types such as `uint32` for enums
|
||||||
@@ -431,7 +431,7 @@ func (f *cgoFile) createASTNode(name string, c clangCursor) (ast.Node, any) {
|
|||||||
typeSpec := &ast.TypeSpec{
|
typeSpec := &ast.TypeSpec{
|
||||||
Name: &ast.Ident{
|
Name: &ast.Ident{
|
||||||
NamePos: pos,
|
NamePos: pos,
|
||||||
Name: "C." + name,
|
Name: "_Cgo_" + name,
|
||||||
Obj: obj,
|
Obj: obj,
|
||||||
},
|
},
|
||||||
Assign: pos,
|
Assign: pos,
|
||||||
@@ -454,12 +454,12 @@ func (f *cgoFile) createASTNode(name string, c clangCursor) (ast.Node, any) {
|
|||||||
}
|
}
|
||||||
obj := &ast.Object{
|
obj := &ast.Object{
|
||||||
Kind: ast.Con,
|
Kind: ast.Con,
|
||||||
Name: "C." + name,
|
Name: "_Cgo_" + name,
|
||||||
}
|
}
|
||||||
valueSpec := &ast.ValueSpec{
|
valueSpec := &ast.ValueSpec{
|
||||||
Names: []*ast.Ident{{
|
Names: []*ast.Ident{{
|
||||||
NamePos: pos,
|
NamePos: pos,
|
||||||
Name: "C." + name,
|
Name: "_Cgo_" + name,
|
||||||
Obj: obj,
|
Obj: obj,
|
||||||
}},
|
}},
|
||||||
Values: []ast.Expr{expr},
|
Values: []ast.Expr{expr},
|
||||||
@@ -745,27 +745,27 @@ func (f *cgoFile) makeASTType(typ C.CXType, pos token.Pos) ast.Expr {
|
|||||||
var typeName string
|
var typeName string
|
||||||
switch typ.kind {
|
switch typ.kind {
|
||||||
case C.CXType_Char_S, C.CXType_Char_U:
|
case C.CXType_Char_S, C.CXType_Char_U:
|
||||||
typeName = "C.char"
|
typeName = "_Cgo_char"
|
||||||
case C.CXType_SChar:
|
case C.CXType_SChar:
|
||||||
typeName = "C.schar"
|
typeName = "_Cgo_schar"
|
||||||
case C.CXType_UChar:
|
case C.CXType_UChar:
|
||||||
typeName = "C.uchar"
|
typeName = "_Cgo_uchar"
|
||||||
case C.CXType_Short:
|
case C.CXType_Short:
|
||||||
typeName = "C.short"
|
typeName = "_Cgo_short"
|
||||||
case C.CXType_UShort:
|
case C.CXType_UShort:
|
||||||
typeName = "C.ushort"
|
typeName = "_Cgo_ushort"
|
||||||
case C.CXType_Int:
|
case C.CXType_Int:
|
||||||
typeName = "C.int"
|
typeName = "_Cgo_int"
|
||||||
case C.CXType_UInt:
|
case C.CXType_UInt:
|
||||||
typeName = "C.uint"
|
typeName = "_Cgo_uint"
|
||||||
case C.CXType_Long:
|
case C.CXType_Long:
|
||||||
typeName = "C.long"
|
typeName = "_Cgo_long"
|
||||||
case C.CXType_ULong:
|
case C.CXType_ULong:
|
||||||
typeName = "C.ulong"
|
typeName = "_Cgo_ulong"
|
||||||
case C.CXType_LongLong:
|
case C.CXType_LongLong:
|
||||||
typeName = "C.longlong"
|
typeName = "_Cgo_longlong"
|
||||||
case C.CXType_ULongLong:
|
case C.CXType_ULongLong:
|
||||||
typeName = "C.ulonglong"
|
typeName = "_Cgo_ulonglong"
|
||||||
case C.CXType_Bool:
|
case C.CXType_Bool:
|
||||||
typeName = "bool"
|
typeName = "bool"
|
||||||
case C.CXType_Float, C.CXType_Double, C.CXType_LongDouble:
|
case C.CXType_Float, C.CXType_Double, C.CXType_LongDouble:
|
||||||
@@ -896,7 +896,7 @@ func (f *cgoFile) makeASTType(typ C.CXType, pos token.Pos) ast.Expr {
|
|||||||
typeSpelling := getString(C.clang_getTypeSpelling(typ))
|
typeSpelling := getString(C.clang_getTypeSpelling(typ))
|
||||||
typeKindSpelling := getString(C.clang_getTypeKindSpelling(typ.kind))
|
typeKindSpelling := getString(C.clang_getTypeKindSpelling(typ.kind))
|
||||||
f.addError(pos, fmt.Sprintf("unknown C type: %v (libclang type kind %s)", typeSpelling, typeKindSpelling))
|
f.addError(pos, fmt.Sprintf("unknown C type: %v (libclang type kind %s)", typeSpelling, typeKindSpelling))
|
||||||
typeName = "C.<unknown>"
|
typeName = "_Cgo_<unknown>"
|
||||||
}
|
}
|
||||||
return &ast.Ident{
|
return &ast.Ident{
|
||||||
NamePos: pos,
|
NamePos: pos,
|
||||||
@@ -913,7 +913,7 @@ func (p *cgoPackage) getIntegerType(name string, cursor clangCursor) *ast.TypeSp
|
|||||||
var goName string
|
var goName string
|
||||||
typeSize := C.clang_Type_getSizeOf(underlyingType)
|
typeSize := C.clang_Type_getSizeOf(underlyingType)
|
||||||
switch name {
|
switch name {
|
||||||
case "C.char":
|
case "_Cgo_char":
|
||||||
if typeSize != 1 {
|
if typeSize != 1 {
|
||||||
// This happens for some very special purpose architectures
|
// This happens for some very special purpose architectures
|
||||||
// (DSPs etc.) that are not currently targeted.
|
// (DSPs etc.) that are not currently targeted.
|
||||||
@@ -926,7 +926,7 @@ func (p *cgoPackage) getIntegerType(name string, cursor clangCursor) *ast.TypeSp
|
|||||||
case C.CXType_Char_U:
|
case C.CXType_Char_U:
|
||||||
goName = "uint8"
|
goName = "uint8"
|
||||||
}
|
}
|
||||||
case "C.schar", "C.short", "C.int", "C.long", "C.longlong":
|
case "_Cgo_schar", "_Cgo_short", "_Cgo_int", "_Cgo_long", "_Cgo_longlong":
|
||||||
switch typeSize {
|
switch typeSize {
|
||||||
case 1:
|
case 1:
|
||||||
goName = "int8"
|
goName = "int8"
|
||||||
@@ -937,7 +937,7 @@ func (p *cgoPackage) getIntegerType(name string, cursor clangCursor) *ast.TypeSp
|
|||||||
case 8:
|
case 8:
|
||||||
goName = "int64"
|
goName = "int64"
|
||||||
}
|
}
|
||||||
case "C.uchar", "C.ushort", "C.uint", "C.ulong", "C.ulonglong":
|
case "_Cgo_uchar", "_Cgo_ushort", "_Cgo_uint", "_Cgo_ulong", "_Cgo_ulonglong":
|
||||||
switch typeSize {
|
switch typeSize {
|
||||||
case 1:
|
case 1:
|
||||||
goName = "uint8"
|
goName = "uint8"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build !byollvm && !llvm15 && !llvm16 && !llvm17
|
//go:build !byollvm && llvm18
|
||||||
|
|
||||||
package cgo
|
package cgo
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
//go:build !byollvm && !llvm15 && !llvm16 && !llvm17 && !llvm18
|
||||||
|
|
||||||
|
package cgo
|
||||||
|
|
||||||
|
/*
|
||||||
|
#cgo linux CFLAGS: -I/usr/include/llvm-19 -I/usr/include/llvm-c-19 -I/usr/lib/llvm-19/include
|
||||||
|
#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/llvm@19/include
|
||||||
|
#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/llvm@19/include
|
||||||
|
#cgo freebsd CFLAGS: -I/usr/local/llvm19/include
|
||||||
|
#cgo linux LDFLAGS: -L/usr/lib/llvm-19/lib -lclang
|
||||||
|
#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/llvm@19/lib -lclang
|
||||||
|
#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@19/lib -lclang
|
||||||
|
#cgo freebsd LDFLAGS: -L/usr/local/llvm19/lib -lclang
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
Vendored
+31
-31
@@ -5,50 +5,50 @@ import "unsafe"
|
|||||||
|
|
||||||
var _ unsafe.Pointer
|
var _ unsafe.Pointer
|
||||||
|
|
||||||
//go:linkname C.CString runtime.cgo_CString
|
//go:linkname _Cgo_CString runtime.cgo_CString
|
||||||
func C.CString(string) *C.char
|
func _Cgo_CString(string) *_Cgo_char
|
||||||
|
|
||||||
//go:linkname C.GoString runtime.cgo_GoString
|
//go:linkname _Cgo_GoString runtime.cgo_GoString
|
||||||
func C.GoString(*C.char) string
|
func _Cgo_GoString(*_Cgo_char) string
|
||||||
|
|
||||||
//go:linkname C.__GoStringN runtime.cgo_GoStringN
|
//go:linkname _Cgo___GoStringN runtime.cgo_GoStringN
|
||||||
func C.__GoStringN(*C.char, uintptr) string
|
func _Cgo___GoStringN(*_Cgo_char, uintptr) string
|
||||||
|
|
||||||
func C.GoStringN(cstr *C.char, length C.int) string {
|
func _Cgo_GoStringN(cstr *_Cgo_char, length _Cgo_int) string {
|
||||||
return C.__GoStringN(cstr, uintptr(length))
|
return _Cgo___GoStringN(cstr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__GoBytes runtime.cgo_GoBytes
|
//go:linkname _Cgo___GoBytes runtime.cgo_GoBytes
|
||||||
func C.__GoBytes(unsafe.Pointer, uintptr) []byte
|
func _Cgo___GoBytes(unsafe.Pointer, uintptr) []byte
|
||||||
|
|
||||||
func C.GoBytes(ptr unsafe.Pointer, length C.int) []byte {
|
func _Cgo_GoBytes(ptr unsafe.Pointer, length _Cgo_int) []byte {
|
||||||
return C.__GoBytes(ptr, uintptr(length))
|
return _Cgo___GoBytes(ptr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__CBytes runtime.cgo_CBytes
|
//go:linkname _Cgo___CBytes runtime.cgo_CBytes
|
||||||
func C.__CBytes([]byte) unsafe.Pointer
|
func _Cgo___CBytes([]byte) unsafe.Pointer
|
||||||
|
|
||||||
func C.CBytes(b []byte) unsafe.Pointer {
|
func _Cgo_CBytes(b []byte) unsafe.Pointer {
|
||||||
return C.__CBytes(b)
|
return _Cgo___CBytes(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__get_errno_num runtime.cgo_errno
|
//go:linkname _Cgo___get_errno_num runtime.cgo_errno
|
||||||
func C.__get_errno_num() uintptr
|
func _Cgo___get_errno_num() uintptr
|
||||||
|
|
||||||
func C.__get_errno() error {
|
func _Cgo___get_errno() error {
|
||||||
return syscall.Errno(C.__get_errno_num())
|
return syscall.Errno(_Cgo___get_errno_num())
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
C.char uint8
|
_Cgo_char uint8
|
||||||
C.schar int8
|
_Cgo_schar int8
|
||||||
C.uchar uint8
|
_Cgo_uchar uint8
|
||||||
C.short int16
|
_Cgo_short int16
|
||||||
C.ushort uint16
|
_Cgo_ushort uint16
|
||||||
C.int int32
|
_Cgo_int int32
|
||||||
C.uint uint32
|
_Cgo_uint uint32
|
||||||
C.long int32
|
_Cgo_long int32
|
||||||
C.ulong uint32
|
_Cgo_ulong uint32
|
||||||
C.longlong int64
|
_Cgo_longlong int64
|
||||||
C.ulonglong uint64
|
_Cgo_ulonglong uint64
|
||||||
)
|
)
|
||||||
|
|||||||
Vendored
+38
-38
@@ -5,58 +5,58 @@ import "unsafe"
|
|||||||
|
|
||||||
var _ unsafe.Pointer
|
var _ unsafe.Pointer
|
||||||
|
|
||||||
//go:linkname C.CString runtime.cgo_CString
|
//go:linkname _Cgo_CString runtime.cgo_CString
|
||||||
func C.CString(string) *C.char
|
func _Cgo_CString(string) *_Cgo_char
|
||||||
|
|
||||||
//go:linkname C.GoString runtime.cgo_GoString
|
//go:linkname _Cgo_GoString runtime.cgo_GoString
|
||||||
func C.GoString(*C.char) string
|
func _Cgo_GoString(*_Cgo_char) string
|
||||||
|
|
||||||
//go:linkname C.__GoStringN runtime.cgo_GoStringN
|
//go:linkname _Cgo___GoStringN runtime.cgo_GoStringN
|
||||||
func C.__GoStringN(*C.char, uintptr) string
|
func _Cgo___GoStringN(*_Cgo_char, uintptr) string
|
||||||
|
|
||||||
func C.GoStringN(cstr *C.char, length C.int) string {
|
func _Cgo_GoStringN(cstr *_Cgo_char, length _Cgo_int) string {
|
||||||
return C.__GoStringN(cstr, uintptr(length))
|
return _Cgo___GoStringN(cstr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__GoBytes runtime.cgo_GoBytes
|
//go:linkname _Cgo___GoBytes runtime.cgo_GoBytes
|
||||||
func C.__GoBytes(unsafe.Pointer, uintptr) []byte
|
func _Cgo___GoBytes(unsafe.Pointer, uintptr) []byte
|
||||||
|
|
||||||
func C.GoBytes(ptr unsafe.Pointer, length C.int) []byte {
|
func _Cgo_GoBytes(ptr unsafe.Pointer, length _Cgo_int) []byte {
|
||||||
return C.__GoBytes(ptr, uintptr(length))
|
return _Cgo___GoBytes(ptr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__CBytes runtime.cgo_CBytes
|
//go:linkname _Cgo___CBytes runtime.cgo_CBytes
|
||||||
func C.__CBytes([]byte) unsafe.Pointer
|
func _Cgo___CBytes([]byte) unsafe.Pointer
|
||||||
|
|
||||||
func C.CBytes(b []byte) unsafe.Pointer {
|
func _Cgo_CBytes(b []byte) unsafe.Pointer {
|
||||||
return C.__CBytes(b)
|
return _Cgo___CBytes(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__get_errno_num runtime.cgo_errno
|
//go:linkname _Cgo___get_errno_num runtime.cgo_errno
|
||||||
func C.__get_errno_num() uintptr
|
func _Cgo___get_errno_num() uintptr
|
||||||
|
|
||||||
func C.__get_errno() error {
|
func _Cgo___get_errno() error {
|
||||||
return syscall.Errno(C.__get_errno_num())
|
return syscall.Errno(_Cgo___get_errno_num())
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
C.char uint8
|
_Cgo_char uint8
|
||||||
C.schar int8
|
_Cgo_schar int8
|
||||||
C.uchar uint8
|
_Cgo_uchar uint8
|
||||||
C.short int16
|
_Cgo_short int16
|
||||||
C.ushort uint16
|
_Cgo_ushort uint16
|
||||||
C.int int32
|
_Cgo_int int32
|
||||||
C.uint uint32
|
_Cgo_uint uint32
|
||||||
C.long int32
|
_Cgo_long int32
|
||||||
C.ulong uint32
|
_Cgo_ulong uint32
|
||||||
C.longlong int64
|
_Cgo_longlong int64
|
||||||
C.ulonglong uint64
|
_Cgo_ulonglong uint64
|
||||||
)
|
)
|
||||||
|
|
||||||
const C.foo = 3
|
const _Cgo_foo = 3
|
||||||
const C.bar = C.foo
|
const _Cgo_bar = _Cgo_foo
|
||||||
const C.unreferenced = 4
|
const _Cgo_unreferenced = 4
|
||||||
const C.referenced = C.unreferenced
|
const _Cgo_referenced = _Cgo_unreferenced
|
||||||
const C.fnlike_val = 5
|
const _Cgo_fnlike_val = 5
|
||||||
const C.square_val = (20 * 20)
|
const _Cgo_square_val = (20 * 20)
|
||||||
const C.add_val = (3 + 5)
|
const _Cgo_add_val = (3 + 5)
|
||||||
|
|||||||
Vendored
+46
-46
@@ -14,16 +14,16 @@
|
|||||||
// testdata/errors.go:3:1: function "unusedFunction" in #cgo noescape line is not used
|
// testdata/errors.go:3:1: function "unusedFunction" in #cgo noescape line is not used
|
||||||
|
|
||||||
// Type checking errors after CGo processing:
|
// Type checking errors after CGo processing:
|
||||||
// testdata/errors.go:102: cannot use 2 << 10 (untyped int constant 2048) as C.char value in variable declaration (overflows)
|
// testdata/errors.go:102: cannot use 2 << 10 (untyped int constant 2048) as _Cgo_char value in variable declaration (overflows)
|
||||||
// testdata/errors.go:105: unknown field z in struct literal
|
// testdata/errors.go:105: unknown field z in struct literal
|
||||||
// testdata/errors.go:108: undefined: C.SOME_CONST_1
|
// testdata/errors.go:108: undefined: _Cgo_SOME_CONST_1
|
||||||
// testdata/errors.go:110: cannot use C.SOME_CONST_3 (untyped int constant 1234) as byte value in variable declaration (overflows)
|
// testdata/errors.go:110: cannot use _Cgo_SOME_CONST_3 (untyped int constant 1234) as byte value in variable declaration (overflows)
|
||||||
// testdata/errors.go:112: undefined: C.SOME_CONST_4
|
// testdata/errors.go:112: undefined: _Cgo_SOME_CONST_4
|
||||||
// testdata/errors.go:114: undefined: C.SOME_CONST_b
|
// testdata/errors.go:114: undefined: _Cgo_SOME_CONST_b
|
||||||
// testdata/errors.go:116: undefined: C.SOME_CONST_startspace
|
// testdata/errors.go:116: undefined: _Cgo_SOME_CONST_startspace
|
||||||
// testdata/errors.go:119: undefined: C.SOME_PARAM_CONST_invalid
|
// testdata/errors.go:119: undefined: _Cgo_SOME_PARAM_CONST_invalid
|
||||||
// testdata/errors.go:122: undefined: C.add_toomuch
|
// testdata/errors.go:122: undefined: _Cgo_add_toomuch
|
||||||
// testdata/errors.go:123: undefined: C.add_toolittle
|
// testdata/errors.go:123: undefined: _Cgo_add_toolittle
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
@@ -32,58 +32,58 @@ import "unsafe"
|
|||||||
|
|
||||||
var _ unsafe.Pointer
|
var _ unsafe.Pointer
|
||||||
|
|
||||||
//go:linkname C.CString runtime.cgo_CString
|
//go:linkname _Cgo_CString runtime.cgo_CString
|
||||||
func C.CString(string) *C.char
|
func _Cgo_CString(string) *_Cgo_char
|
||||||
|
|
||||||
//go:linkname C.GoString runtime.cgo_GoString
|
//go:linkname _Cgo_GoString runtime.cgo_GoString
|
||||||
func C.GoString(*C.char) string
|
func _Cgo_GoString(*_Cgo_char) string
|
||||||
|
|
||||||
//go:linkname C.__GoStringN runtime.cgo_GoStringN
|
//go:linkname _Cgo___GoStringN runtime.cgo_GoStringN
|
||||||
func C.__GoStringN(*C.char, uintptr) string
|
func _Cgo___GoStringN(*_Cgo_char, uintptr) string
|
||||||
|
|
||||||
func C.GoStringN(cstr *C.char, length C.int) string {
|
func _Cgo_GoStringN(cstr *_Cgo_char, length _Cgo_int) string {
|
||||||
return C.__GoStringN(cstr, uintptr(length))
|
return _Cgo___GoStringN(cstr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__GoBytes runtime.cgo_GoBytes
|
//go:linkname _Cgo___GoBytes runtime.cgo_GoBytes
|
||||||
func C.__GoBytes(unsafe.Pointer, uintptr) []byte
|
func _Cgo___GoBytes(unsafe.Pointer, uintptr) []byte
|
||||||
|
|
||||||
func C.GoBytes(ptr unsafe.Pointer, length C.int) []byte {
|
func _Cgo_GoBytes(ptr unsafe.Pointer, length _Cgo_int) []byte {
|
||||||
return C.__GoBytes(ptr, uintptr(length))
|
return _Cgo___GoBytes(ptr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__CBytes runtime.cgo_CBytes
|
//go:linkname _Cgo___CBytes runtime.cgo_CBytes
|
||||||
func C.__CBytes([]byte) unsafe.Pointer
|
func _Cgo___CBytes([]byte) unsafe.Pointer
|
||||||
|
|
||||||
func C.CBytes(b []byte) unsafe.Pointer {
|
func _Cgo_CBytes(b []byte) unsafe.Pointer {
|
||||||
return C.__CBytes(b)
|
return _Cgo___CBytes(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__get_errno_num runtime.cgo_errno
|
//go:linkname _Cgo___get_errno_num runtime.cgo_errno
|
||||||
func C.__get_errno_num() uintptr
|
func _Cgo___get_errno_num() uintptr
|
||||||
|
|
||||||
func C.__get_errno() error {
|
func _Cgo___get_errno() error {
|
||||||
return syscall.Errno(C.__get_errno_num())
|
return syscall.Errno(_Cgo___get_errno_num())
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
C.char uint8
|
_Cgo_char uint8
|
||||||
C.schar int8
|
_Cgo_schar int8
|
||||||
C.uchar uint8
|
_Cgo_uchar uint8
|
||||||
C.short int16
|
_Cgo_short int16
|
||||||
C.ushort uint16
|
_Cgo_ushort uint16
|
||||||
C.int int32
|
_Cgo_int int32
|
||||||
C.uint uint32
|
_Cgo_uint uint32
|
||||||
C.long int32
|
_Cgo_long int32
|
||||||
C.ulong uint32
|
_Cgo_ulong uint32
|
||||||
C.longlong int64
|
_Cgo_longlong int64
|
||||||
C.ulonglong uint64
|
_Cgo_ulonglong uint64
|
||||||
)
|
)
|
||||||
type C.struct_point_t struct {
|
type _Cgo_struct_point_t struct {
|
||||||
x C.int
|
x _Cgo_int
|
||||||
y C.int
|
y _Cgo_int
|
||||||
}
|
}
|
||||||
type C.point_t = C.struct_point_t
|
type _Cgo_point_t = _Cgo_struct_point_t
|
||||||
|
|
||||||
const C.SOME_CONST_3 = 1234
|
const _Cgo_SOME_CONST_3 = 1234
|
||||||
const C.SOME_PARAM_CONST_valid = 3 + 4
|
const _Cgo_SOME_PARAM_CONST_valid = 3 + 4
|
||||||
|
|||||||
Vendored
+33
-33
@@ -10,53 +10,53 @@ import "unsafe"
|
|||||||
|
|
||||||
var _ unsafe.Pointer
|
var _ unsafe.Pointer
|
||||||
|
|
||||||
//go:linkname C.CString runtime.cgo_CString
|
//go:linkname _Cgo_CString runtime.cgo_CString
|
||||||
func C.CString(string) *C.char
|
func _Cgo_CString(string) *_Cgo_char
|
||||||
|
|
||||||
//go:linkname C.GoString runtime.cgo_GoString
|
//go:linkname _Cgo_GoString runtime.cgo_GoString
|
||||||
func C.GoString(*C.char) string
|
func _Cgo_GoString(*_Cgo_char) string
|
||||||
|
|
||||||
//go:linkname C.__GoStringN runtime.cgo_GoStringN
|
//go:linkname _Cgo___GoStringN runtime.cgo_GoStringN
|
||||||
func C.__GoStringN(*C.char, uintptr) string
|
func _Cgo___GoStringN(*_Cgo_char, uintptr) string
|
||||||
|
|
||||||
func C.GoStringN(cstr *C.char, length C.int) string {
|
func _Cgo_GoStringN(cstr *_Cgo_char, length _Cgo_int) string {
|
||||||
return C.__GoStringN(cstr, uintptr(length))
|
return _Cgo___GoStringN(cstr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__GoBytes runtime.cgo_GoBytes
|
//go:linkname _Cgo___GoBytes runtime.cgo_GoBytes
|
||||||
func C.__GoBytes(unsafe.Pointer, uintptr) []byte
|
func _Cgo___GoBytes(unsafe.Pointer, uintptr) []byte
|
||||||
|
|
||||||
func C.GoBytes(ptr unsafe.Pointer, length C.int) []byte {
|
func _Cgo_GoBytes(ptr unsafe.Pointer, length _Cgo_int) []byte {
|
||||||
return C.__GoBytes(ptr, uintptr(length))
|
return _Cgo___GoBytes(ptr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__CBytes runtime.cgo_CBytes
|
//go:linkname _Cgo___CBytes runtime.cgo_CBytes
|
||||||
func C.__CBytes([]byte) unsafe.Pointer
|
func _Cgo___CBytes([]byte) unsafe.Pointer
|
||||||
|
|
||||||
func C.CBytes(b []byte) unsafe.Pointer {
|
func _Cgo_CBytes(b []byte) unsafe.Pointer {
|
||||||
return C.__CBytes(b)
|
return _Cgo___CBytes(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__get_errno_num runtime.cgo_errno
|
//go:linkname _Cgo___get_errno_num runtime.cgo_errno
|
||||||
func C.__get_errno_num() uintptr
|
func _Cgo___get_errno_num() uintptr
|
||||||
|
|
||||||
func C.__get_errno() error {
|
func _Cgo___get_errno() error {
|
||||||
return syscall.Errno(C.__get_errno_num())
|
return syscall.Errno(_Cgo___get_errno_num())
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
C.char uint8
|
_Cgo_char uint8
|
||||||
C.schar int8
|
_Cgo_schar int8
|
||||||
C.uchar uint8
|
_Cgo_uchar uint8
|
||||||
C.short int16
|
_Cgo_short int16
|
||||||
C.ushort uint16
|
_Cgo_ushort uint16
|
||||||
C.int int32
|
_Cgo_int int32
|
||||||
C.uint uint32
|
_Cgo_uint uint32
|
||||||
C.long int32
|
_Cgo_long int32
|
||||||
C.ulong uint32
|
_Cgo_ulong uint32
|
||||||
C.longlong int64
|
_Cgo_longlong int64
|
||||||
C.ulonglong uint64
|
_Cgo_ulonglong uint64
|
||||||
)
|
)
|
||||||
|
|
||||||
const C.BAR = 3
|
const _Cgo_BAR = 3
|
||||||
const C.FOO_H = 1
|
const _Cgo_FOO_H = 1
|
||||||
|
|||||||
Vendored
+42
-42
@@ -5,80 +5,80 @@ import "unsafe"
|
|||||||
|
|
||||||
var _ unsafe.Pointer
|
var _ unsafe.Pointer
|
||||||
|
|
||||||
//go:linkname C.CString runtime.cgo_CString
|
//go:linkname _Cgo_CString runtime.cgo_CString
|
||||||
func C.CString(string) *C.char
|
func _Cgo_CString(string) *_Cgo_char
|
||||||
|
|
||||||
//go:linkname C.GoString runtime.cgo_GoString
|
//go:linkname _Cgo_GoString runtime.cgo_GoString
|
||||||
func C.GoString(*C.char) string
|
func _Cgo_GoString(*_Cgo_char) string
|
||||||
|
|
||||||
//go:linkname C.__GoStringN runtime.cgo_GoStringN
|
//go:linkname _Cgo___GoStringN runtime.cgo_GoStringN
|
||||||
func C.__GoStringN(*C.char, uintptr) string
|
func _Cgo___GoStringN(*_Cgo_char, uintptr) string
|
||||||
|
|
||||||
func C.GoStringN(cstr *C.char, length C.int) string {
|
func _Cgo_GoStringN(cstr *_Cgo_char, length _Cgo_int) string {
|
||||||
return C.__GoStringN(cstr, uintptr(length))
|
return _Cgo___GoStringN(cstr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__GoBytes runtime.cgo_GoBytes
|
//go:linkname _Cgo___GoBytes runtime.cgo_GoBytes
|
||||||
func C.__GoBytes(unsafe.Pointer, uintptr) []byte
|
func _Cgo___GoBytes(unsafe.Pointer, uintptr) []byte
|
||||||
|
|
||||||
func C.GoBytes(ptr unsafe.Pointer, length C.int) []byte {
|
func _Cgo_GoBytes(ptr unsafe.Pointer, length _Cgo_int) []byte {
|
||||||
return C.__GoBytes(ptr, uintptr(length))
|
return _Cgo___GoBytes(ptr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__CBytes runtime.cgo_CBytes
|
//go:linkname _Cgo___CBytes runtime.cgo_CBytes
|
||||||
func C.__CBytes([]byte) unsafe.Pointer
|
func _Cgo___CBytes([]byte) unsafe.Pointer
|
||||||
|
|
||||||
func C.CBytes(b []byte) unsafe.Pointer {
|
func _Cgo_CBytes(b []byte) unsafe.Pointer {
|
||||||
return C.__CBytes(b)
|
return _Cgo___CBytes(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__get_errno_num runtime.cgo_errno
|
//go:linkname _Cgo___get_errno_num runtime.cgo_errno
|
||||||
func C.__get_errno_num() uintptr
|
func _Cgo___get_errno_num() uintptr
|
||||||
|
|
||||||
func C.__get_errno() error {
|
func _Cgo___get_errno() error {
|
||||||
return syscall.Errno(C.__get_errno_num())
|
return syscall.Errno(_Cgo___get_errno_num())
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
C.char uint8
|
_Cgo_char uint8
|
||||||
C.schar int8
|
_Cgo_schar int8
|
||||||
C.uchar uint8
|
_Cgo_uchar uint8
|
||||||
C.short int16
|
_Cgo_short int16
|
||||||
C.ushort uint16
|
_Cgo_ushort uint16
|
||||||
C.int int32
|
_Cgo_int int32
|
||||||
C.uint uint32
|
_Cgo_uint uint32
|
||||||
C.long int32
|
_Cgo_long int32
|
||||||
C.ulong uint32
|
_Cgo_ulong uint32
|
||||||
C.longlong int64
|
_Cgo_longlong int64
|
||||||
C.ulonglong uint64
|
_Cgo_ulonglong uint64
|
||||||
)
|
)
|
||||||
|
|
||||||
//export foo
|
//export foo
|
||||||
func C.foo(a C.int, b C.int) C.int
|
func _Cgo_foo(a _Cgo_int, b _Cgo_int) _Cgo_int
|
||||||
|
|
||||||
var C.foo$funcaddr unsafe.Pointer
|
var _Cgo_foo$funcaddr unsafe.Pointer
|
||||||
|
|
||||||
//export variadic0
|
//export variadic0
|
||||||
//go:variadic
|
//go:variadic
|
||||||
func C.variadic0()
|
func _Cgo_variadic0()
|
||||||
|
|
||||||
var C.variadic0$funcaddr unsafe.Pointer
|
var _Cgo_variadic0$funcaddr unsafe.Pointer
|
||||||
|
|
||||||
//export variadic2
|
//export variadic2
|
||||||
//go:variadic
|
//go:variadic
|
||||||
func C.variadic2(x C.int, y C.int)
|
func _Cgo_variadic2(x _Cgo_int, y _Cgo_int)
|
||||||
|
|
||||||
var C.variadic2$funcaddr unsafe.Pointer
|
var _Cgo_variadic2$funcaddr unsafe.Pointer
|
||||||
|
|
||||||
//export _Cgo_static_173c95a79b6df1980521_staticfunc
|
//export _Cgo_static_173c95a79b6df1980521_staticfunc
|
||||||
func C.staticfunc!symbols.go(x C.int)
|
func _Cgo_staticfunc!symbols.go(x _Cgo_int)
|
||||||
|
|
||||||
var C.staticfunc!symbols.go$funcaddr unsafe.Pointer
|
var _Cgo_staticfunc!symbols.go$funcaddr unsafe.Pointer
|
||||||
|
|
||||||
//export notEscapingFunction
|
//export notEscapingFunction
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func C.notEscapingFunction(a *C.int)
|
func _Cgo_notEscapingFunction(a *_Cgo_int)
|
||||||
|
|
||||||
var C.notEscapingFunction$funcaddr unsafe.Pointer
|
var _Cgo_notEscapingFunction$funcaddr unsafe.Pointer
|
||||||
//go:extern someValue
|
//go:extern someValue
|
||||||
var C.someValue C.int
|
var _Cgo_someValue _Cgo_int
|
||||||
|
|||||||
Vendored
+103
-99
@@ -5,158 +5,162 @@ import "unsafe"
|
|||||||
|
|
||||||
var _ unsafe.Pointer
|
var _ unsafe.Pointer
|
||||||
|
|
||||||
//go:linkname C.CString runtime.cgo_CString
|
//go:linkname _Cgo_CString runtime.cgo_CString
|
||||||
func C.CString(string) *C.char
|
func _Cgo_CString(string) *_Cgo_char
|
||||||
|
|
||||||
//go:linkname C.GoString runtime.cgo_GoString
|
//go:linkname _Cgo_GoString runtime.cgo_GoString
|
||||||
func C.GoString(*C.char) string
|
func _Cgo_GoString(*_Cgo_char) string
|
||||||
|
|
||||||
//go:linkname C.__GoStringN runtime.cgo_GoStringN
|
//go:linkname _Cgo___GoStringN runtime.cgo_GoStringN
|
||||||
func C.__GoStringN(*C.char, uintptr) string
|
func _Cgo___GoStringN(*_Cgo_char, uintptr) string
|
||||||
|
|
||||||
func C.GoStringN(cstr *C.char, length C.int) string {
|
func _Cgo_GoStringN(cstr *_Cgo_char, length _Cgo_int) string {
|
||||||
return C.__GoStringN(cstr, uintptr(length))
|
return _Cgo___GoStringN(cstr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__GoBytes runtime.cgo_GoBytes
|
//go:linkname _Cgo___GoBytes runtime.cgo_GoBytes
|
||||||
func C.__GoBytes(unsafe.Pointer, uintptr) []byte
|
func _Cgo___GoBytes(unsafe.Pointer, uintptr) []byte
|
||||||
|
|
||||||
func C.GoBytes(ptr unsafe.Pointer, length C.int) []byte {
|
func _Cgo_GoBytes(ptr unsafe.Pointer, length _Cgo_int) []byte {
|
||||||
return C.__GoBytes(ptr, uintptr(length))
|
return _Cgo___GoBytes(ptr, uintptr(length))
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__CBytes runtime.cgo_CBytes
|
//go:linkname _Cgo___CBytes runtime.cgo_CBytes
|
||||||
func C.__CBytes([]byte) unsafe.Pointer
|
func _Cgo___CBytes([]byte) unsafe.Pointer
|
||||||
|
|
||||||
func C.CBytes(b []byte) unsafe.Pointer {
|
func _Cgo_CBytes(b []byte) unsafe.Pointer {
|
||||||
return C.__CBytes(b)
|
return _Cgo___CBytes(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname C.__get_errno_num runtime.cgo_errno
|
//go:linkname _Cgo___get_errno_num runtime.cgo_errno
|
||||||
func C.__get_errno_num() uintptr
|
func _Cgo___get_errno_num() uintptr
|
||||||
|
|
||||||
func C.__get_errno() error {
|
func _Cgo___get_errno() error {
|
||||||
return syscall.Errno(C.__get_errno_num())
|
return syscall.Errno(_Cgo___get_errno_num())
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
C.char uint8
|
_Cgo_char uint8
|
||||||
C.schar int8
|
_Cgo_schar int8
|
||||||
C.uchar uint8
|
_Cgo_uchar uint8
|
||||||
C.short int16
|
_Cgo_short int16
|
||||||
C.ushort uint16
|
_Cgo_ushort uint16
|
||||||
C.int int32
|
_Cgo_int int32
|
||||||
C.uint uint32
|
_Cgo_uint uint32
|
||||||
C.long int32
|
_Cgo_long int32
|
||||||
C.ulong uint32
|
_Cgo_ulong uint32
|
||||||
C.longlong int64
|
_Cgo_longlong int64
|
||||||
C.ulonglong uint64
|
_Cgo_ulonglong uint64
|
||||||
)
|
)
|
||||||
type C.myint = C.int
|
type _Cgo_myint = _Cgo_int
|
||||||
type C.struct_point2d_t struct {
|
type _Cgo_struct_point2d_t struct {
|
||||||
x C.int
|
x _Cgo_int
|
||||||
y C.int
|
y _Cgo_int
|
||||||
}
|
}
|
||||||
type C.point2d_t = C.struct_point2d_t
|
type _Cgo_point2d_t = _Cgo_struct_point2d_t
|
||||||
type C.struct_point3d struct {
|
type _Cgo_struct_point3d struct {
|
||||||
x C.int
|
x _Cgo_int
|
||||||
y C.int
|
y _Cgo_int
|
||||||
z C.int
|
z _Cgo_int
|
||||||
}
|
}
|
||||||
type C.point3d_t = C.struct_point3d
|
type _Cgo_point3d_t = _Cgo_struct_point3d
|
||||||
type C.struct_type1 struct {
|
type _Cgo_struct_type1 struct {
|
||||||
_type C.int
|
_type _Cgo_int
|
||||||
__type C.int
|
__type _Cgo_int
|
||||||
___type C.int
|
___type _Cgo_int
|
||||||
}
|
}
|
||||||
type C.struct_type2 struct{ _type C.int }
|
type _Cgo_struct_type2 struct{ _type _Cgo_int }
|
||||||
type C.union_union1_t struct{ i C.int }
|
type _Cgo_union_union1_t struct{ i _Cgo_int }
|
||||||
type C.union1_t = C.union_union1_t
|
type _Cgo_union1_t = _Cgo_union_union1_t
|
||||||
type C.union_union3_t struct{ $union uint64 }
|
type _Cgo_union_union3_t struct{ $union uint64 }
|
||||||
|
|
||||||
func (union *C.union_union3_t) unionfield_i() *C.int { return (*C.int)(unsafe.Pointer(&union.$union)) }
|
func (union *_Cgo_union_union3_t) unionfield_i() *_Cgo_int {
|
||||||
func (union *C.union_union3_t) unionfield_d() *float64 {
|
return (*_Cgo_int)(unsafe.Pointer(&union.$union))
|
||||||
|
}
|
||||||
|
func (union *_Cgo_union_union3_t) unionfield_d() *float64 {
|
||||||
return (*float64)(unsafe.Pointer(&union.$union))
|
return (*float64)(unsafe.Pointer(&union.$union))
|
||||||
}
|
}
|
||||||
func (union *C.union_union3_t) unionfield_s() *C.short {
|
func (union *_Cgo_union_union3_t) unionfield_s() *_Cgo_short {
|
||||||
return (*C.short)(unsafe.Pointer(&union.$union))
|
return (*_Cgo_short)(unsafe.Pointer(&union.$union))
|
||||||
}
|
}
|
||||||
|
|
||||||
type C.union3_t = C.union_union3_t
|
type _Cgo_union3_t = _Cgo_union_union3_t
|
||||||
type C.union_union2d struct{ $union [2]uint64 }
|
type _Cgo_union_union2d struct{ $union [2]uint64 }
|
||||||
|
|
||||||
func (union *C.union_union2d) unionfield_i() *C.int { return (*C.int)(unsafe.Pointer(&union.$union)) }
|
func (union *_Cgo_union_union2d) unionfield_i() *_Cgo_int {
|
||||||
func (union *C.union_union2d) unionfield_d() *[2]float64 {
|
return (*_Cgo_int)(unsafe.Pointer(&union.$union))
|
||||||
|
}
|
||||||
|
func (union *_Cgo_union_union2d) unionfield_d() *[2]float64 {
|
||||||
return (*[2]float64)(unsafe.Pointer(&union.$union))
|
return (*[2]float64)(unsafe.Pointer(&union.$union))
|
||||||
}
|
}
|
||||||
|
|
||||||
type C.union2d_t = C.union_union2d
|
type _Cgo_union2d_t = _Cgo_union_union2d
|
||||||
type C.union_unionarray_t struct{ arr [10]C.uchar }
|
type _Cgo_union_unionarray_t struct{ arr [10]_Cgo_uchar }
|
||||||
type C.unionarray_t = C.union_unionarray_t
|
type _Cgo_unionarray_t = _Cgo_union_unionarray_t
|
||||||
type C._Ctype_union___0 struct{ $union [3]uint32 }
|
type _Cgo__Ctype_union___0 struct{ $union [3]uint32 }
|
||||||
|
|
||||||
func (union *C._Ctype_union___0) unionfield_area() *C.point2d_t {
|
func (union *_Cgo__Ctype_union___0) unionfield_area() *_Cgo_point2d_t {
|
||||||
return (*C.point2d_t)(unsafe.Pointer(&union.$union))
|
return (*_Cgo_point2d_t)(unsafe.Pointer(&union.$union))
|
||||||
}
|
}
|
||||||
func (union *C._Ctype_union___0) unionfield_solid() *C.point3d_t {
|
func (union *_Cgo__Ctype_union___0) unionfield_solid() *_Cgo_point3d_t {
|
||||||
return (*C.point3d_t)(unsafe.Pointer(&union.$union))
|
return (*_Cgo_point3d_t)(unsafe.Pointer(&union.$union))
|
||||||
}
|
}
|
||||||
|
|
||||||
type C.struct_struct_nested_t struct {
|
type _Cgo_struct_struct_nested_t struct {
|
||||||
begin C.point2d_t
|
begin _Cgo_point2d_t
|
||||||
end C.point2d_t
|
end _Cgo_point2d_t
|
||||||
tag C.int
|
tag _Cgo_int
|
||||||
|
|
||||||
coord C._Ctype_union___0
|
coord _Cgo__Ctype_union___0
|
||||||
}
|
}
|
||||||
type C.struct_nested_t = C.struct_struct_nested_t
|
type _Cgo_struct_nested_t = _Cgo_struct_struct_nested_t
|
||||||
type C.union_union_nested_t struct{ $union [2]uint64 }
|
type _Cgo_union_union_nested_t struct{ $union [2]uint64 }
|
||||||
|
|
||||||
func (union *C.union_union_nested_t) unionfield_point() *C.point3d_t {
|
func (union *_Cgo_union_union_nested_t) unionfield_point() *_Cgo_point3d_t {
|
||||||
return (*C.point3d_t)(unsafe.Pointer(&union.$union))
|
return (*_Cgo_point3d_t)(unsafe.Pointer(&union.$union))
|
||||||
}
|
}
|
||||||
func (union *C.union_union_nested_t) unionfield_array() *C.unionarray_t {
|
func (union *_Cgo_union_union_nested_t) unionfield_array() *_Cgo_unionarray_t {
|
||||||
return (*C.unionarray_t)(unsafe.Pointer(&union.$union))
|
return (*_Cgo_unionarray_t)(unsafe.Pointer(&union.$union))
|
||||||
}
|
}
|
||||||
func (union *C.union_union_nested_t) unionfield_thing() *C.union3_t {
|
func (union *_Cgo_union_union_nested_t) unionfield_thing() *_Cgo_union3_t {
|
||||||
return (*C.union3_t)(unsafe.Pointer(&union.$union))
|
return (*_Cgo_union3_t)(unsafe.Pointer(&union.$union))
|
||||||
}
|
}
|
||||||
|
|
||||||
type C.union_nested_t = C.union_union_nested_t
|
type _Cgo_union_nested_t = _Cgo_union_union_nested_t
|
||||||
type C.enum_option = C.int
|
type _Cgo_enum_option = _Cgo_int
|
||||||
type C.option_t = C.enum_option
|
type _Cgo_option_t = _Cgo_enum_option
|
||||||
type C.enum_option2_t = C.uint
|
type _Cgo_enum_option2_t = _Cgo_uint
|
||||||
type C.option2_t = C.enum_option2_t
|
type _Cgo_option2_t = _Cgo_enum_option2_t
|
||||||
type C.struct_types_t struct {
|
type _Cgo_struct_types_t struct {
|
||||||
f float32
|
f float32
|
||||||
d float64
|
d float64
|
||||||
ptr *C.int
|
ptr *_Cgo_int
|
||||||
}
|
}
|
||||||
type C.types_t = C.struct_types_t
|
type _Cgo_types_t = _Cgo_struct_types_t
|
||||||
type C.myIntArray = [10]C.int
|
type _Cgo_myIntArray = [10]_Cgo_int
|
||||||
type C.struct_bitfield_t struct {
|
type _Cgo_struct_bitfield_t struct {
|
||||||
start C.uchar
|
start _Cgo_uchar
|
||||||
__bitfield_1 C.uchar
|
__bitfield_1 _Cgo_uchar
|
||||||
|
|
||||||
d C.uchar
|
d _Cgo_uchar
|
||||||
e C.uchar
|
e _Cgo_uchar
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *C.struct_bitfield_t) bitfield_a() C.uchar { return s.__bitfield_1 & 0x1f }
|
func (s *_Cgo_struct_bitfield_t) bitfield_a() _Cgo_uchar { return s.__bitfield_1 & 0x1f }
|
||||||
func (s *C.struct_bitfield_t) set_bitfield_a(value C.uchar) {
|
func (s *_Cgo_struct_bitfield_t) set_bitfield_a(value _Cgo_uchar) {
|
||||||
s.__bitfield_1 = s.__bitfield_1&^0x1f | value&0x1f<<0
|
s.__bitfield_1 = s.__bitfield_1&^0x1f | value&0x1f<<0
|
||||||
}
|
}
|
||||||
func (s *C.struct_bitfield_t) bitfield_b() C.uchar {
|
func (s *_Cgo_struct_bitfield_t) bitfield_b() _Cgo_uchar {
|
||||||
return s.__bitfield_1 >> 5 & 0x1
|
return s.__bitfield_1 >> 5 & 0x1
|
||||||
}
|
}
|
||||||
func (s *C.struct_bitfield_t) set_bitfield_b(value C.uchar) {
|
func (s *_Cgo_struct_bitfield_t) set_bitfield_b(value _Cgo_uchar) {
|
||||||
s.__bitfield_1 = s.__bitfield_1&^0x20 | value&0x1<<5
|
s.__bitfield_1 = s.__bitfield_1&^0x20 | value&0x1<<5
|
||||||
}
|
}
|
||||||
func (s *C.struct_bitfield_t) bitfield_c() C.uchar {
|
func (s *_Cgo_struct_bitfield_t) bitfield_c() _Cgo_uchar {
|
||||||
return s.__bitfield_1 >> 6
|
return s.__bitfield_1 >> 6
|
||||||
}
|
}
|
||||||
func (s *C.struct_bitfield_t) set_bitfield_c(value C.uchar,
|
func (s *_Cgo_struct_bitfield_t) set_bitfield_c(value _Cgo_uchar,
|
||||||
|
|
||||||
) { s.__bitfield_1 = s.__bitfield_1&0x3f | value<<6 }
|
) { s.__bitfield_1 = s.__bitfield_1&0x3f | value<<6 }
|
||||||
|
|
||||||
type C.bitfield_t = C.struct_bitfield_t
|
type _Cgo_bitfield_t = _Cgo_struct_bitfield_t
|
||||||
|
|||||||
+67
-53
@@ -261,6 +261,10 @@ func (c *Config) LibcPath(name string) (path string, precompiled bool) {
|
|||||||
if c.Target.SoftFloat {
|
if c.Target.SoftFloat {
|
||||||
archname += "-softfloat"
|
archname += "-softfloat"
|
||||||
}
|
}
|
||||||
|
if name == "bdwgc" {
|
||||||
|
// Boehm GC is compiled against a particular libc.
|
||||||
|
archname += "-" + c.Target.Libc
|
||||||
|
}
|
||||||
|
|
||||||
// Try to load a precompiled library.
|
// Try to load a precompiled library.
|
||||||
precompiledDir := filepath.Join(goenv.Get("TINYGOROOT"), "pkg", archname, name)
|
precompiledDir := filepath.Join(goenv.Get("TINYGOROOT"), "pkg", archname, name)
|
||||||
@@ -315,59 +319,7 @@ func (c *Config) CFlags(libclang bool) []string {
|
|||||||
"-resource-dir="+resourceDir,
|
"-resource-dir="+resourceDir,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
switch c.Target.Libc {
|
cflags = append(cflags, c.LibcCFlags()...)
|
||||||
case "darwin-libSystem":
|
|
||||||
root := goenv.Get("TINYGOROOT")
|
|
||||||
cflags = append(cflags,
|
|
||||||
"-nostdlibinc",
|
|
||||||
"-isystem", filepath.Join(root, "lib/macos-minimal-sdk/src/usr/include"),
|
|
||||||
)
|
|
||||||
case "picolibc":
|
|
||||||
root := goenv.Get("TINYGOROOT")
|
|
||||||
picolibcDir := filepath.Join(root, "lib", "picolibc", "newlib", "libc")
|
|
||||||
path, _ := c.LibcPath("picolibc")
|
|
||||||
cflags = append(cflags,
|
|
||||||
"-nostdlibinc",
|
|
||||||
"-isystem", filepath.Join(path, "include"),
|
|
||||||
"-isystem", filepath.Join(picolibcDir, "include"),
|
|
||||||
"-isystem", filepath.Join(picolibcDir, "tinystdio"),
|
|
||||||
"-D__PICOLIBC_ERRNO_FUNCTION=__errno_location",
|
|
||||||
)
|
|
||||||
case "musl":
|
|
||||||
root := goenv.Get("TINYGOROOT")
|
|
||||||
path, _ := c.LibcPath("musl")
|
|
||||||
arch := MuslArchitecture(c.Triple())
|
|
||||||
cflags = append(cflags,
|
|
||||||
"-nostdlibinc",
|
|
||||||
"-isystem", filepath.Join(path, "include"),
|
|
||||||
"-isystem", filepath.Join(root, "lib", "musl", "arch", arch),
|
|
||||||
"-isystem", filepath.Join(root, "lib", "musl", "arch", "generic"),
|
|
||||||
"-isystem", filepath.Join(root, "lib", "musl", "include"),
|
|
||||||
)
|
|
||||||
case "wasi-libc":
|
|
||||||
root := goenv.Get("TINYGOROOT")
|
|
||||||
cflags = append(cflags,
|
|
||||||
"-nostdlibinc",
|
|
||||||
"-isystem", root+"/lib/wasi-libc/sysroot/include")
|
|
||||||
case "wasmbuiltins":
|
|
||||||
// nothing to add (library is purely for builtins)
|
|
||||||
case "mingw-w64":
|
|
||||||
root := goenv.Get("TINYGOROOT")
|
|
||||||
path, _ := c.LibcPath("mingw-w64")
|
|
||||||
cflags = append(cflags,
|
|
||||||
"-nostdlibinc",
|
|
||||||
"-isystem", filepath.Join(path, "include"),
|
|
||||||
"-isystem", filepath.Join(root, "lib", "mingw-w64", "mingw-w64-headers", "crt"),
|
|
||||||
"-isystem", filepath.Join(root, "lib", "mingw-w64", "mingw-w64-headers", "defaults", "include"),
|
|
||||||
"-D_UCRT",
|
|
||||||
)
|
|
||||||
case "":
|
|
||||||
// No libc specified, nothing to add.
|
|
||||||
default:
|
|
||||||
// Incorrect configuration. This could be handled in a better way, but
|
|
||||||
// usually this will be found by developers (not by TinyGo users).
|
|
||||||
panic("unknown libc: " + c.Target.Libc)
|
|
||||||
}
|
|
||||||
// Always emit debug information. It is optionally stripped at link time.
|
// Always emit debug information. It is optionally stripped at link time.
|
||||||
cflags = append(cflags, "-gdwarf-4")
|
cflags = append(cflags, "-gdwarf-4")
|
||||||
// Use the same optimization level as TinyGo.
|
// Use the same optimization level as TinyGo.
|
||||||
@@ -394,6 +346,68 @@ func (c *Config) CFlags(libclang bool) []string {
|
|||||||
return cflags
|
return cflags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LibcCFlags returns the C compiler flags for the configured libc.
|
||||||
|
// It only uses flags that are part of the libc path (triple, cpu, abi, libc
|
||||||
|
// name) so it can safely be used to compile another C library.
|
||||||
|
func (c *Config) LibcCFlags() []string {
|
||||||
|
switch c.Target.Libc {
|
||||||
|
case "darwin-libSystem":
|
||||||
|
root := goenv.Get("TINYGOROOT")
|
||||||
|
return []string{
|
||||||
|
"-nostdlibinc",
|
||||||
|
"-isystem", filepath.Join(root, "lib/macos-minimal-sdk/src/usr/include"),
|
||||||
|
}
|
||||||
|
case "picolibc":
|
||||||
|
root := goenv.Get("TINYGOROOT")
|
||||||
|
picolibcDir := filepath.Join(root, "lib", "picolibc", "newlib", "libc")
|
||||||
|
path, _ := c.LibcPath("picolibc")
|
||||||
|
return []string{
|
||||||
|
"-nostdlibinc",
|
||||||
|
"-isystem", filepath.Join(path, "include"),
|
||||||
|
"-isystem", filepath.Join(picolibcDir, "include"),
|
||||||
|
"-isystem", filepath.Join(picolibcDir, "tinystdio"),
|
||||||
|
"-D__PICOLIBC_ERRNO_FUNCTION=__errno_location",
|
||||||
|
}
|
||||||
|
case "musl":
|
||||||
|
root := goenv.Get("TINYGOROOT")
|
||||||
|
path, _ := c.LibcPath("musl")
|
||||||
|
arch := MuslArchitecture(c.Triple())
|
||||||
|
return []string{
|
||||||
|
"-nostdlibinc",
|
||||||
|
"-isystem", filepath.Join(path, "include"),
|
||||||
|
"-isystem", filepath.Join(root, "lib", "musl", "arch", arch),
|
||||||
|
"-isystem", filepath.Join(root, "lib", "musl", "arch", "generic"),
|
||||||
|
"-isystem", filepath.Join(root, "lib", "musl", "include"),
|
||||||
|
}
|
||||||
|
case "wasi-libc":
|
||||||
|
root := goenv.Get("TINYGOROOT")
|
||||||
|
return []string{
|
||||||
|
"-nostdlibinc",
|
||||||
|
"-isystem", root + "/lib/wasi-libc/sysroot/include",
|
||||||
|
}
|
||||||
|
case "wasmbuiltins":
|
||||||
|
// nothing to add (library is purely for builtins)
|
||||||
|
return nil
|
||||||
|
case "mingw-w64":
|
||||||
|
root := goenv.Get("TINYGOROOT")
|
||||||
|
path, _ := c.LibcPath("mingw-w64")
|
||||||
|
return []string{
|
||||||
|
"-nostdlibinc",
|
||||||
|
"-isystem", filepath.Join(path, "include"),
|
||||||
|
"-isystem", filepath.Join(root, "lib", "mingw-w64", "mingw-w64-headers", "crt"),
|
||||||
|
"-isystem", filepath.Join(root, "lib", "mingw-w64", "mingw-w64-headers", "defaults", "include"),
|
||||||
|
"-D_UCRT",
|
||||||
|
}
|
||||||
|
case "":
|
||||||
|
// No libc specified, nothing to add.
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
// Incorrect configuration. This could be handled in a better way, but
|
||||||
|
// usually this will be found by developers (not by TinyGo users).
|
||||||
|
panic("unknown libc: " + c.Target.Libc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// LDFlags returns the flags to pass to the linker. A few more flags are needed
|
// LDFlags returns the flags to pass to the linker. A few more flags are needed
|
||||||
// (like the one for the compiler runtime), but this represents the majority of
|
// (like the one for the compiler runtime), but this represents the majority of
|
||||||
// the flags.
|
// the flags.
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
validBuildModeOptions = []string{"default", "c-shared"}
|
validBuildModeOptions = []string{"default", "c-shared", "wasi-legacy"}
|
||||||
validGCOptions = []string{"none", "leaking", "conservative", "custom", "precise"}
|
validGCOptions = []string{"none", "leaking", "conservative", "custom", "precise", "boehm"}
|
||||||
validSchedulerOptions = []string{"none", "tasks", "asyncify"}
|
validSchedulerOptions = []string{"none", "tasks", "asyncify"}
|
||||||
validSerialOptions = []string{"none", "uart", "usb", "rtt"}
|
validSerialOptions = []string{"none", "uart", "usb", "rtt"}
|
||||||
validPrintSizeOptions = []string{"none", "short", "full", "html"}
|
validPrintSizeOptions = []string{"none", "short", "full", "html"}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func TestVerifyOptions(t *testing.T) {
|
func TestVerifyOptions(t *testing.T) {
|
||||||
|
|
||||||
expectedGCError := errors.New(`invalid gc option 'incorrect': valid values are none, leaking, conservative, custom, precise`)
|
expectedGCError := errors.New(`invalid gc option 'incorrect': valid values are none, leaking, conservative, custom, precise, boehm`)
|
||||||
expectedSchedulerError := errors.New(`invalid scheduler option 'incorrect': valid values are none, tasks, asyncify`)
|
expectedSchedulerError := errors.New(`invalid scheduler option 'incorrect': valid values are none, tasks, asyncify`)
|
||||||
expectedPrintSizeError := errors.New(`invalid size option 'incorrect': valid values are none, short, full, html`)
|
expectedPrintSizeError := errors.New(`invalid size option 'incorrect': valid values are none, short, full, html`)
|
||||||
expectedPanicStrategyError := errors.New(`invalid panic option 'incorrect': valid values are print, trap`)
|
expectedPanicStrategyError := errors.New(`invalid panic option 'incorrect': valid values are print, trap`)
|
||||||
|
|||||||
+9
-30
@@ -247,7 +247,6 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
|
|||||||
GOOS: options.GOOS,
|
GOOS: options.GOOS,
|
||||||
GOARCH: options.GOARCH,
|
GOARCH: options.GOARCH,
|
||||||
BuildTags: []string{options.GOOS, options.GOARCH},
|
BuildTags: []string{options.GOOS, options.GOARCH},
|
||||||
GC: "precise",
|
|
||||||
Scheduler: "tasks",
|
Scheduler: "tasks",
|
||||||
Linker: "cc",
|
Linker: "cc",
|
||||||
DefaultStackSize: 1024 * 64, // 64kB
|
DefaultStackSize: 1024 * 64, // 64kB
|
||||||
@@ -328,14 +327,14 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
|
|||||||
spec.CPU = "generic"
|
spec.CPU = "generic"
|
||||||
llvmarch = "aarch64"
|
llvmarch = "aarch64"
|
||||||
if options.GOOS == "darwin" {
|
if options.GOOS == "darwin" {
|
||||||
spec.Features = "+fp-armv8,+neon"
|
spec.Features = "+ete,+fp-armv8,+neon,+trbe,+v8a"
|
||||||
// Looks like Apple prefers to call this architecture ARM64
|
// Looks like Apple prefers to call this architecture ARM64
|
||||||
// instead of AArch64.
|
// instead of AArch64.
|
||||||
llvmarch = "arm64"
|
llvmarch = "arm64"
|
||||||
} else if options.GOOS == "windows" {
|
} else if options.GOOS == "windows" {
|
||||||
spec.Features = "+fp-armv8,+neon,-fmv"
|
spec.Features = "+ete,+fp-armv8,+neon,+trbe,+v8a,-fmv"
|
||||||
} else { // linux
|
} else { // linux
|
||||||
spec.Features = "+fp-armv8,+neon,-fmv,-outline-atomics"
|
spec.Features = "+ete,+fp-armv8,+neon,+trbe,+v8a,-fmv,-outline-atomics"
|
||||||
}
|
}
|
||||||
case "mips", "mipsle":
|
case "mips", "mipsle":
|
||||||
spec.CPU = "mips32"
|
spec.CPU = "mips32"
|
||||||
@@ -356,15 +355,7 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
|
|||||||
return nil, fmt.Errorf("invalid GOMIPS=%s: must be hardfloat or softfloat", options.GOMIPS)
|
return nil, fmt.Errorf("invalid GOMIPS=%s: must be hardfloat or softfloat", options.GOMIPS)
|
||||||
}
|
}
|
||||||
case "wasm":
|
case "wasm":
|
||||||
llvmarch = "wasm32"
|
return nil, fmt.Errorf("GOARCH=wasm but GOOS is unset. Please set GOOS to wasm, wasip1, or wasip2.")
|
||||||
spec.CPU = "generic"
|
|
||||||
spec.Features = "+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext"
|
|
||||||
spec.BuildTags = append(spec.BuildTags, "tinygo.wasm")
|
|
||||||
spec.CFlags = append(spec.CFlags,
|
|
||||||
"-mbulk-memory",
|
|
||||||
"-mnontrapping-fptoint",
|
|
||||||
"-msign-ext",
|
|
||||||
)
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unknown GOARCH=%s", options.GOARCH)
|
return nil, fmt.Errorf("unknown GOARCH=%s", options.GOARCH)
|
||||||
}
|
}
|
||||||
@@ -374,6 +365,7 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
|
|||||||
llvmvendor := "unknown"
|
llvmvendor := "unknown"
|
||||||
switch options.GOOS {
|
switch options.GOOS {
|
||||||
case "darwin":
|
case "darwin":
|
||||||
|
spec.GC = "precise"
|
||||||
platformVersion := "10.12.0"
|
platformVersion := "10.12.0"
|
||||||
if options.GOARCH == "arm64" {
|
if options.GOARCH == "arm64" {
|
||||||
platformVersion = "11.0.0" // first macosx platform with arm64 support
|
platformVersion = "11.0.0" // first macosx platform with arm64 support
|
||||||
@@ -396,6 +388,7 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
|
|||||||
"src/runtime/runtime_unix.c",
|
"src/runtime/runtime_unix.c",
|
||||||
"src/runtime/signal.c")
|
"src/runtime/signal.c")
|
||||||
case "linux":
|
case "linux":
|
||||||
|
spec.GC = "boehm"
|
||||||
spec.Linker = "ld.lld"
|
spec.Linker = "ld.lld"
|
||||||
spec.RTLib = "compiler-rt"
|
spec.RTLib = "compiler-rt"
|
||||||
spec.Libc = "musl"
|
spec.Libc = "musl"
|
||||||
@@ -419,6 +412,7 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
|
|||||||
"src/runtime/runtime_unix.c",
|
"src/runtime/runtime_unix.c",
|
||||||
"src/runtime/signal.c")
|
"src/runtime/signal.c")
|
||||||
case "windows":
|
case "windows":
|
||||||
|
spec.GC = "precise"
|
||||||
spec.Linker = "ld.lld"
|
spec.Linker = "ld.lld"
|
||||||
spec.Libc = "mingw-w64"
|
spec.Libc = "mingw-w64"
|
||||||
// Note: using a medium code model, low image base and no ASLR
|
// Note: using a medium code model, low image base and no ASLR
|
||||||
@@ -444,23 +438,8 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
|
|||||||
"--no-insert-timestamp",
|
"--no-insert-timestamp",
|
||||||
"--no-dynamicbase",
|
"--no-dynamicbase",
|
||||||
)
|
)
|
||||||
case "wasip1":
|
case "wasm", "wasip1", "wasip2":
|
||||||
spec.GC = "" // use default GC
|
return nil, fmt.Errorf("GOOS=%s but GOARCH is unset. Please set GOARCH to wasm", options.GOOS)
|
||||||
spec.Scheduler = "asyncify"
|
|
||||||
spec.Linker = "wasm-ld"
|
|
||||||
spec.RTLib = "compiler-rt"
|
|
||||||
spec.Libc = "wasi-libc"
|
|
||||||
spec.DefaultStackSize = 1024 * 64 // 64kB
|
|
||||||
spec.LDFlags = append(spec.LDFlags,
|
|
||||||
"--stack-first",
|
|
||||||
"--no-demangle",
|
|
||||||
)
|
|
||||||
spec.Emulator = "wasmtime run --dir={tmpDir}::/tmp {}"
|
|
||||||
spec.ExtraFiles = append(spec.ExtraFiles,
|
|
||||||
"src/runtime/asm_tinygowasm.S",
|
|
||||||
"src/internal/task/task_asyncify_wasm.S",
|
|
||||||
)
|
|
||||||
llvmos = "wasi"
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unknown GOOS=%s", options.GOOS)
|
return nil, fmt.Errorf("unknown GOOS=%s", options.GOOS)
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-5
@@ -18,11 +18,12 @@ var stdlibAliases = map[string]string{
|
|||||||
// crypto packages
|
// crypto packages
|
||||||
"crypto/ed25519/internal/edwards25519/field.feMul": "crypto/ed25519/internal/edwards25519/field.feMulGeneric",
|
"crypto/ed25519/internal/edwards25519/field.feMul": "crypto/ed25519/internal/edwards25519/field.feMulGeneric",
|
||||||
"crypto/internal/edwards25519/field.feSquare": "crypto/ed25519/internal/edwards25519/field.feSquareGeneric",
|
"crypto/internal/edwards25519/field.feSquare": "crypto/ed25519/internal/edwards25519/field.feSquareGeneric",
|
||||||
"crypto/md5.block": "crypto/md5.blockGeneric",
|
"crypto/md5.block": "crypto/md5.blockGeneric",
|
||||||
"crypto/sha1.block": "crypto/sha1.blockGeneric",
|
"crypto/sha1.block": "crypto/sha1.blockGeneric",
|
||||||
"crypto/sha1.blockAMD64": "crypto/sha1.blockGeneric",
|
"crypto/sha1.blockAMD64": "crypto/sha1.blockGeneric",
|
||||||
"crypto/sha256.block": "crypto/sha256.blockGeneric",
|
"crypto/sha256.block": "crypto/sha256.blockGeneric",
|
||||||
"crypto/sha512.blockAMD64": "crypto/sha512.blockGeneric",
|
"crypto/sha512.blockAMD64": "crypto/sha512.blockGeneric",
|
||||||
|
"internal/chacha8rand.block": "internal/chacha8rand.block_generic",
|
||||||
|
|
||||||
// AES
|
// AES
|
||||||
"crypto/aes.decryptBlockAsm": "crypto/aes.decryptBlock",
|
"crypto/aes.decryptBlockAsm": "crypto/aes.decryptBlock",
|
||||||
|
|||||||
+1
-1
@@ -161,7 +161,7 @@ str x2, [x1, #8]
|
|||||||
mov x0, #0
|
mov x0, #0
|
||||||
1:
|
1:
|
||||||
`
|
`
|
||||||
constraints = "={x0},{x1},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{lr},~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7},~{q8},~{q9},~{q10},~{q11},~{q12},~{q13},~{q14},~{q15},~{q16},~{q17},~{q18},~{q19},~{q20},~{q21},~{q22},~{q23},~{q24},~{q25},~{q26},~{q27},~{q28},~{q29},~{q30},~{nzcv},~{ffr},~{vg},~{memory}"
|
constraints = "={x0},{x1},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{lr},~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7},~{q8},~{q9},~{q10},~{q11},~{q12},~{q13},~{q14},~{q15},~{q16},~{q17},~{q18},~{q19},~{q20},~{q21},~{q22},~{q23},~{q24},~{q25},~{q26},~{q27},~{q28},~{q29},~{q30},~{nzcv},~{ffr},~{memory}"
|
||||||
if b.GOOS != "darwin" && b.GOOS != "windows" {
|
if b.GOOS != "darwin" && b.GOOS != "windows" {
|
||||||
// These registers cause the following warning when compiling for
|
// These registers cause the following warning when compiling for
|
||||||
// MacOS and Windows:
|
// MacOS and Windows:
|
||||||
|
|||||||
@@ -371,13 +371,6 @@ func (c *compilerContext) getPointerBitmap(typ llvm.Type, pos token.Pos) *big.In
|
|||||||
return big.NewInt(1)
|
return big.NewInt(1)
|
||||||
case llvm.StructTypeKind:
|
case llvm.StructTypeKind:
|
||||||
ptrs := big.NewInt(0)
|
ptrs := big.NewInt(0)
|
||||||
if typ.StructName() == "runtime.funcValue" {
|
|
||||||
// Hack: the type runtime.funcValue contains an 'id' field which is
|
|
||||||
// of type uintptr, but before the LowerFuncValues pass it actually
|
|
||||||
// contains a pointer (ptrtoint) to a global. This trips up the
|
|
||||||
// interp package. Therefore, make the id field a pointer for now.
|
|
||||||
typ = c.ctx.StructType([]llvm.Type{c.dataPtrType, c.dataPtrType}, false)
|
|
||||||
}
|
|
||||||
for i, subtyp := range typ.StructElementTypes() {
|
for i, subtyp := range typ.StructElementTypes() {
|
||||||
subptrs := c.getPointerBitmap(subtyp, pos)
|
subptrs := c.getPointerBitmap(subtyp, pos)
|
||||||
if subptrs.BitLen() == 0 {
|
if subptrs.BitLen() == 0 {
|
||||||
|
|||||||
+8
-4
@@ -283,6 +283,11 @@ func (c *compilerContext) getFunctionInfo(f *ssa.Function) functionInfo {
|
|||||||
info.wasmName = "_start"
|
info.wasmName = "_start"
|
||||||
info.exported = true
|
info.exported = true
|
||||||
}
|
}
|
||||||
|
if info.linkName == "runtime.wasmEntryLegacy" && c.BuildMode == "wasi-legacy" {
|
||||||
|
info.linkName = "_start"
|
||||||
|
info.wasmName = "_start"
|
||||||
|
info.exported = true
|
||||||
|
}
|
||||||
|
|
||||||
// Check for //go: pragmas, which may change the link name (among others).
|
// Check for //go: pragmas, which may change the link name (among others).
|
||||||
c.parsePragmas(&info, f)
|
c.parsePragmas(&info, f)
|
||||||
@@ -427,9 +432,8 @@ func (c *compilerContext) parsePragmas(info *functionInfo, f *ssa.Function) {
|
|||||||
// pass for C variadic functions. This includes both explicit
|
// pass for C variadic functions. This includes both explicit
|
||||||
// (with ...) and implicit (no parameters in signature)
|
// (with ...) and implicit (no parameters in signature)
|
||||||
// functions.
|
// functions.
|
||||||
if strings.HasPrefix(f.Name(), "C.") {
|
if strings.HasPrefix(f.Name(), "_Cgo_") {
|
||||||
// This prefix cannot naturally be created, it must have
|
// This prefix was created as a result of CGo preprocessing.
|
||||||
// been created as a result of CGo preprocessing.
|
|
||||||
info.variadic = true
|
info.variadic = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -442,7 +446,7 @@ func (c *compilerContext) parsePragmas(info *functionInfo, f *ssa.Function) {
|
|||||||
// The list of allowed types is based on this proposal:
|
// The list of allowed types is based on this proposal:
|
||||||
// https://github.com/golang/go/issues/59149
|
// https://github.com/golang/go/issues/59149
|
||||||
func (c *compilerContext) checkWasmImportExport(f *ssa.Function, pragma string) {
|
func (c *compilerContext) checkWasmImportExport(f *ssa.Function, pragma string) {
|
||||||
if c.pkg.Path() == "runtime" || c.pkg.Path() == "syscall/js" || c.pkg.Path() == "syscall" {
|
if c.pkg.Path() == "runtime" || c.pkg.Path() == "syscall/js" || c.pkg.Path() == "syscall" || c.pkg.Path() == "crypto/internal/sysrand" {
|
||||||
// The runtime is a special case. Allow all kinds of parameters
|
// The runtime is a special case. Allow all kinds of parameters
|
||||||
// (importantly, including pointers).
|
// (importantly, including pointers).
|
||||||
return
|
return
|
||||||
|
|||||||
Vendored
+3
-3
@@ -206,7 +206,7 @@ entry:
|
|||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nounwind }
|
attributes #3 = { nounwind }
|
||||||
|
|||||||
Vendored
+6
-6
@@ -82,11 +82,11 @@ entry:
|
|||||||
store i32 1, ptr %select.send.value, align 4
|
store i32 1, ptr %select.send.value, align 4
|
||||||
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %select.states.alloca)
|
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %select.states.alloca)
|
||||||
store ptr %ch1, ptr %select.states.alloca, align 4
|
store ptr %ch1, ptr %select.states.alloca, align 4
|
||||||
%select.states.alloca.repack1 = getelementptr inbounds %runtime.chanSelectState, ptr %select.states.alloca, i32 0, i32 1
|
%select.states.alloca.repack1 = getelementptr inbounds i8, ptr %select.states.alloca, i32 4
|
||||||
store ptr %select.send.value, ptr %select.states.alloca.repack1, align 4
|
store ptr %select.send.value, ptr %select.states.alloca.repack1, align 4
|
||||||
%0 = getelementptr inbounds [2 x %runtime.chanSelectState], ptr %select.states.alloca, i32 0, i32 1
|
%0 = getelementptr inbounds i8, ptr %select.states.alloca, i32 8
|
||||||
store ptr %ch2, ptr %0, align 4
|
store ptr %ch2, ptr %0, align 4
|
||||||
%.repack3 = getelementptr inbounds [2 x %runtime.chanSelectState], ptr %select.states.alloca, i32 0, i32 1, i32 1
|
%.repack3 = getelementptr inbounds i8, ptr %select.states.alloca, i32 12
|
||||||
store ptr null, ptr %.repack3, align 4
|
store ptr null, ptr %.repack3, align 4
|
||||||
%select.result = call { i32, i1 } @runtime.chanSelect(ptr undef, ptr nonnull %select.states.alloca, i32 2, i32 2, ptr null, i32 0, i32 0, ptr undef) #4
|
%select.result = call { i32, i1 } @runtime.chanSelect(ptr undef, ptr nonnull %select.states.alloca, i32 2, i32 2, ptr null, i32 0, i32 0, ptr undef) #4
|
||||||
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %select.states.alloca)
|
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %select.states.alloca)
|
||||||
@@ -107,8 +107,8 @@ select.body: ; preds = %select.next
|
|||||||
|
|
||||||
declare { i32, i1 } @runtime.chanSelect(ptr, ptr, i32, i32, ptr, i32, i32, ptr) #1
|
declare { i32, i1 } @runtime.chanSelect(ptr, ptr, i32, i32, ptr, i32, i32, ptr) #1
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
||||||
attributes #4 = { nounwind }
|
attributes #4 = { nounwind }
|
||||||
|
|||||||
+10
-11
@@ -5,7 +5,6 @@ target triple = "thumbv7m-unknown-unknown-eabi"
|
|||||||
|
|
||||||
%runtime.deferFrame = type { ptr, ptr, [0 x ptr], ptr, i8, %runtime._interface }
|
%runtime.deferFrame = type { ptr, ptr, [0 x ptr], ptr, i8, %runtime._interface }
|
||||||
%runtime._interface = type { ptr, ptr }
|
%runtime._interface = type { ptr, ptr }
|
||||||
%runtime._defer = type { i32, ptr }
|
|
||||||
|
|
||||||
; Function Attrs: allockind("alloc,zeroed") allocsize(0)
|
; Function Attrs: allockind("alloc,zeroed") allocsize(0)
|
||||||
declare noalias nonnull ptr @runtime.alloc(i32, ptr, ptr) #0
|
declare noalias nonnull ptr @runtime.alloc(i32, ptr, ptr) #0
|
||||||
@@ -28,7 +27,7 @@ entry:
|
|||||||
%0 = call ptr @llvm.stacksave.p0()
|
%0 = call ptr @llvm.stacksave.p0()
|
||||||
call void @runtime.setupDeferFrame(ptr nonnull %deferframe.buf, ptr %0, ptr undef) #4
|
call void @runtime.setupDeferFrame(ptr nonnull %deferframe.buf, ptr %0, ptr undef) #4
|
||||||
store i32 0, ptr %defer.alloca, align 4
|
store i32 0, ptr %defer.alloca, align 4
|
||||||
%defer.alloca.repack15 = getelementptr inbounds { i32, ptr }, ptr %defer.alloca, i32 0, i32 1
|
%defer.alloca.repack15 = getelementptr inbounds i8, ptr %defer.alloca, i32 4
|
||||||
store ptr null, ptr %defer.alloca.repack15, align 4
|
store ptr null, ptr %defer.alloca.repack15, align 4
|
||||||
store ptr %defer.alloca, ptr %deferPtr, align 4
|
store ptr %defer.alloca, ptr %deferPtr, align 4
|
||||||
%setjmp = call i32 asm "\0Amovs r0, #0\0Amov r2, pc\0Astr r2, [r1, #4]", "={r0},{r1},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{lr},~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7},~{q8},~{q9},~{q10},~{q11},~{q12},~{q13},~{q14},~{q15},~{cpsr},~{memory}"(ptr nonnull %deferframe.buf) #5
|
%setjmp = call i32 asm "\0Amovs r0, #0\0Amov r2, pc\0Astr r2, [r1, #4]", "={r0},{r1},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{lr},~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7},~{q8},~{q9},~{q10},~{q11},~{q12},~{q13},~{q14},~{q15},~{cpsr},~{memory}"(ptr nonnull %deferframe.buf) #5
|
||||||
@@ -52,7 +51,7 @@ rundefers.loophead: ; preds = %3, %rundefers.block
|
|||||||
br i1 %stackIsNil, label %rundefers.end, label %rundefers.loop
|
br i1 %stackIsNil, label %rundefers.end, label %rundefers.loop
|
||||||
|
|
||||||
rundefers.loop: ; preds = %rundefers.loophead
|
rundefers.loop: ; preds = %rundefers.loophead
|
||||||
%stack.next.gep = getelementptr inbounds %runtime._defer, ptr %2, i32 0, i32 1
|
%stack.next.gep = getelementptr inbounds i8, ptr %2, i32 4
|
||||||
%stack.next = load ptr, ptr %stack.next.gep, align 4
|
%stack.next = load ptr, ptr %stack.next.gep, align 4
|
||||||
store ptr %stack.next, ptr %deferPtr, align 4
|
store ptr %stack.next, ptr %deferPtr, align 4
|
||||||
%callback = load i32, ptr %2, align 4
|
%callback = load i32, ptr %2, align 4
|
||||||
@@ -88,7 +87,7 @@ rundefers.loophead6: ; preds = %5, %lpad
|
|||||||
br i1 %stackIsNil7, label %rundefers.end3, label %rundefers.loop5
|
br i1 %stackIsNil7, label %rundefers.end3, label %rundefers.loop5
|
||||||
|
|
||||||
rundefers.loop5: ; preds = %rundefers.loophead6
|
rundefers.loop5: ; preds = %rundefers.loophead6
|
||||||
%stack.next.gep8 = getelementptr inbounds %runtime._defer, ptr %4, i32 0, i32 1
|
%stack.next.gep8 = getelementptr inbounds i8, ptr %4, i32 4
|
||||||
%stack.next9 = load ptr, ptr %stack.next.gep8, align 4
|
%stack.next9 = load ptr, ptr %stack.next.gep8, align 4
|
||||||
store ptr %stack.next9, ptr %deferPtr, align 4
|
store ptr %stack.next9, ptr %deferPtr, align 4
|
||||||
%callback11 = load i32, ptr %4, align 4
|
%callback11 = load i32, ptr %4, align 4
|
||||||
@@ -145,11 +144,11 @@ entry:
|
|||||||
%0 = call ptr @llvm.stacksave.p0()
|
%0 = call ptr @llvm.stacksave.p0()
|
||||||
call void @runtime.setupDeferFrame(ptr nonnull %deferframe.buf, ptr %0, ptr undef) #4
|
call void @runtime.setupDeferFrame(ptr nonnull %deferframe.buf, ptr %0, ptr undef) #4
|
||||||
store i32 0, ptr %defer.alloca, align 4
|
store i32 0, ptr %defer.alloca, align 4
|
||||||
%defer.alloca.repack22 = getelementptr inbounds { i32, ptr }, ptr %defer.alloca, i32 0, i32 1
|
%defer.alloca.repack22 = getelementptr inbounds i8, ptr %defer.alloca, i32 4
|
||||||
store ptr null, ptr %defer.alloca.repack22, align 4
|
store ptr null, ptr %defer.alloca.repack22, align 4
|
||||||
store ptr %defer.alloca, ptr %deferPtr, align 4
|
store ptr %defer.alloca, ptr %deferPtr, align 4
|
||||||
store i32 1, ptr %defer.alloca2, align 4
|
store i32 1, ptr %defer.alloca2, align 4
|
||||||
%defer.alloca2.repack23 = getelementptr inbounds { i32, ptr }, ptr %defer.alloca2, i32 0, i32 1
|
%defer.alloca2.repack23 = getelementptr inbounds i8, ptr %defer.alloca2, i32 4
|
||||||
store ptr %defer.alloca, ptr %defer.alloca2.repack23, align 4
|
store ptr %defer.alloca, ptr %defer.alloca2.repack23, align 4
|
||||||
store ptr %defer.alloca2, ptr %deferPtr, align 4
|
store ptr %defer.alloca2, ptr %deferPtr, align 4
|
||||||
%setjmp = call i32 asm "\0Amovs r0, #0\0Amov r2, pc\0Astr r2, [r1, #4]", "={r0},{r1},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{lr},~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7},~{q8},~{q9},~{q10},~{q11},~{q12},~{q13},~{q14},~{q15},~{cpsr},~{memory}"(ptr nonnull %deferframe.buf) #5
|
%setjmp = call i32 asm "\0Amovs r0, #0\0Amov r2, pc\0Astr r2, [r1, #4]", "={r0},{r1},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{lr},~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7},~{q8},~{q9},~{q10},~{q11},~{q12},~{q13},~{q14},~{q15},~{cpsr},~{memory}"(ptr nonnull %deferframe.buf) #5
|
||||||
@@ -173,7 +172,7 @@ rundefers.loophead: ; preds = %4, %3, %rundefers.b
|
|||||||
br i1 %stackIsNil, label %rundefers.end, label %rundefers.loop
|
br i1 %stackIsNil, label %rundefers.end, label %rundefers.loop
|
||||||
|
|
||||||
rundefers.loop: ; preds = %rundefers.loophead
|
rundefers.loop: ; preds = %rundefers.loophead
|
||||||
%stack.next.gep = getelementptr inbounds %runtime._defer, ptr %2, i32 0, i32 1
|
%stack.next.gep = getelementptr inbounds i8, ptr %2, i32 4
|
||||||
%stack.next = load ptr, ptr %stack.next.gep, align 4
|
%stack.next = load ptr, ptr %stack.next.gep, align 4
|
||||||
store ptr %stack.next, ptr %deferPtr, align 4
|
store ptr %stack.next, ptr %deferPtr, align 4
|
||||||
%callback = load i32, ptr %2, align 4
|
%callback = load i32, ptr %2, align 4
|
||||||
@@ -219,7 +218,7 @@ rundefers.loophead10: ; preds = %7, %6, %lpad
|
|||||||
br i1 %stackIsNil11, label %rundefers.end7, label %rundefers.loop9
|
br i1 %stackIsNil11, label %rundefers.end7, label %rundefers.loop9
|
||||||
|
|
||||||
rundefers.loop9: ; preds = %rundefers.loophead10
|
rundefers.loop9: ; preds = %rundefers.loophead10
|
||||||
%stack.next.gep12 = getelementptr inbounds %runtime._defer, ptr %5, i32 0, i32 1
|
%stack.next.gep12 = getelementptr inbounds i8, ptr %5, i32 4
|
||||||
%stack.next13 = load ptr, ptr %stack.next.gep12, align 4
|
%stack.next13 = load ptr, ptr %stack.next.gep12, align 4
|
||||||
store ptr %stack.next13, ptr %deferPtr, align 4
|
store ptr %stack.next13, ptr %deferPtr, align 4
|
||||||
%callback15 = load i32, ptr %5, align 4
|
%callback15 = load i32, ptr %5, align 4
|
||||||
@@ -271,9 +270,9 @@ entry:
|
|||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
||||||
attributes #1 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
attributes #1 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
||||||
attributes #2 = { "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
attributes #2 = { "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
||||||
attributes #3 = { nocallback nofree nosync nounwind willreturn }
|
attributes #3 = { nocallback nofree nosync nounwind willreturn }
|
||||||
attributes #4 = { nounwind }
|
attributes #4 = { nounwind }
|
||||||
attributes #5 = { nounwind returns_twice }
|
attributes #5 = { nounwind returns_twice }
|
||||||
|
|||||||
Vendored
+3
-3
@@ -93,6 +93,6 @@ entry:
|
|||||||
ret i8 %0
|
ret i8 %0
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
|
|||||||
Vendored
+3
-3
@@ -44,7 +44,7 @@ entry:
|
|||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nounwind }
|
attributes #3 = { nounwind }
|
||||||
|
|||||||
Vendored
+10
-10
@@ -105,18 +105,18 @@ entry:
|
|||||||
%makeslice = call align 1 dereferenceable(5) ptr @runtime.alloc(i32 5, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3
|
%makeslice = call align 1 dereferenceable(5) ptr @runtime.alloc(i32 5, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3
|
||||||
call void @runtime.trackPointer(ptr nonnull %makeslice, ptr nonnull %stackalloc, ptr undef) #3
|
call void @runtime.trackPointer(ptr nonnull %makeslice, ptr nonnull %stackalloc, ptr undef) #3
|
||||||
store ptr %makeslice, ptr @main.slice1, align 4
|
store ptr %makeslice, ptr @main.slice1, align 4
|
||||||
store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice1, i32 0, i32 1), align 4
|
store i32 5, ptr getelementptr inbounds (i8, ptr @main.slice1, i32 4), align 4
|
||||||
store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice1, i32 0, i32 2), align 4
|
store i32 5, ptr getelementptr inbounds (i8, ptr @main.slice1, i32 8), align 4
|
||||||
%makeslice1 = call align 4 dereferenceable(20) ptr @runtime.alloc(i32 20, ptr nonnull inttoptr (i32 67 to ptr), ptr undef) #3
|
%makeslice1 = call align 4 dereferenceable(20) ptr @runtime.alloc(i32 20, ptr nonnull inttoptr (i32 67 to ptr), ptr undef) #3
|
||||||
call void @runtime.trackPointer(ptr nonnull %makeslice1, ptr nonnull %stackalloc, ptr undef) #3
|
call void @runtime.trackPointer(ptr nonnull %makeslice1, ptr nonnull %stackalloc, ptr undef) #3
|
||||||
store ptr %makeslice1, ptr @main.slice2, align 4
|
store ptr %makeslice1, ptr @main.slice2, align 4
|
||||||
store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice2, i32 0, i32 1), align 4
|
store i32 5, ptr getelementptr inbounds (i8, ptr @main.slice2, i32 4), align 4
|
||||||
store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice2, i32 0, i32 2), align 4
|
store i32 5, ptr getelementptr inbounds (i8, ptr @main.slice2, i32 8), align 4
|
||||||
%makeslice3 = call align 4 dereferenceable(60) ptr @runtime.alloc(i32 60, ptr nonnull inttoptr (i32 71 to ptr), ptr undef) #3
|
%makeslice3 = call align 4 dereferenceable(60) ptr @runtime.alloc(i32 60, ptr nonnull inttoptr (i32 71 to ptr), ptr undef) #3
|
||||||
call void @runtime.trackPointer(ptr nonnull %makeslice3, ptr nonnull %stackalloc, ptr undef) #3
|
call void @runtime.trackPointer(ptr nonnull %makeslice3, ptr nonnull %stackalloc, ptr undef) #3
|
||||||
store ptr %makeslice3, ptr @main.slice3, align 4
|
store ptr %makeslice3, ptr @main.slice3, align 4
|
||||||
store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice3, i32 0, i32 1), align 4
|
store i32 5, ptr getelementptr inbounds (i8, ptr @main.slice3, i32 4), align 4
|
||||||
store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice3, i32 0, i32 2), align 4
|
store i32 5, ptr getelementptr inbounds (i8, ptr @main.slice3, i32 8), align 4
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ entry:
|
|||||||
%0 = call align 8 dereferenceable(16) ptr @runtime.alloc(i32 16, ptr null, ptr undef) #3
|
%0 = call align 8 dereferenceable(16) ptr @runtime.alloc(i32 16, ptr null, ptr undef) #3
|
||||||
call void @runtime.trackPointer(ptr nonnull %0, ptr nonnull %stackalloc, ptr undef) #3
|
call void @runtime.trackPointer(ptr nonnull %0, ptr nonnull %stackalloc, ptr undef) #3
|
||||||
store double %v.r, ptr %0, align 8
|
store double %v.r, ptr %0, align 8
|
||||||
%.repack1 = getelementptr inbounds { double, double }, ptr %0, i32 0, i32 1
|
%.repack1 = getelementptr inbounds i8, ptr %0, i32 8
|
||||||
store double %v.i, ptr %.repack1, align 8
|
store double %v.i, ptr %.repack1, align 8
|
||||||
%1 = insertvalue %runtime._interface { ptr @"reflect/types.type:basic:complex128", ptr undef }, ptr %0, 1
|
%1 = insertvalue %runtime._interface { ptr @"reflect/types.type:basic:complex128", ptr undef }, ptr %0, 1
|
||||||
call void @runtime.trackPointer(ptr nonnull @"reflect/types.type:basic:complex128", ptr nonnull %stackalloc, ptr undef) #3
|
call void @runtime.trackPointer(ptr nonnull @"reflect/types.type:basic:complex128", ptr nonnull %stackalloc, ptr undef) #3
|
||||||
@@ -135,7 +135,7 @@ entry:
|
|||||||
ret %runtime._interface %1
|
ret %runtime._interface %1
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nounwind }
|
attributes #3 = { nounwind }
|
||||||
|
|||||||
Vendored
+4
-4
@@ -36,7 +36,7 @@ entry:
|
|||||||
br i1 %4, label %unsafe.String.throw, label %unsafe.String.next
|
br i1 %4, label %unsafe.String.throw, label %unsafe.String.next
|
||||||
|
|
||||||
unsafe.String.next: ; preds = %entry
|
unsafe.String.next: ; preds = %entry
|
||||||
%5 = zext i16 %len to i32
|
%5 = zext nneg i16 %len to i32
|
||||||
%6 = insertvalue %runtime._string undef, ptr %ptr, 0
|
%6 = insertvalue %runtime._string undef, ptr %ptr, 0
|
||||||
%7 = insertvalue %runtime._string %6, i32 %5, 1
|
%7 = insertvalue %runtime._string %6, i32 %5, 1
|
||||||
call void @runtime.trackPointer(ptr %ptr, ptr nonnull %stackalloc, ptr undef) #3
|
call void @runtime.trackPointer(ptr %ptr, ptr nonnull %stackalloc, ptr undef) #3
|
||||||
@@ -57,7 +57,7 @@ entry:
|
|||||||
ret ptr %s.data
|
ret ptr %s.data
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nounwind }
|
attributes #3 = { nounwind }
|
||||||
|
|||||||
Vendored
+3
-3
@@ -171,9 +171,9 @@ declare i32 @llvm.smax.i32(i32, i32) #4
|
|||||||
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
|
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
|
||||||
declare i32 @llvm.umax.i32(i32, i32) #4
|
declare i32 @llvm.umax.i32(i32, i32) #4
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
|
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
|
||||||
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
|
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
|
||||||
attributes #5 = { nounwind }
|
attributes #5 = { nounwind }
|
||||||
|
|||||||
+21
-21
@@ -65,7 +65,7 @@ entry:
|
|||||||
store i32 3, ptr %n, align 4
|
store i32 3, ptr %n, align 4
|
||||||
%0 = call align 4 dereferenceable(8) ptr @runtime.alloc(i32 8, ptr null, ptr undef) #9
|
%0 = call align 4 dereferenceable(8) ptr @runtime.alloc(i32 8, ptr null, ptr undef) #9
|
||||||
store i32 5, ptr %0, align 4
|
store i32 5, ptr %0, align 4
|
||||||
%1 = getelementptr inbounds { i32, ptr }, ptr %0, i32 0, i32 1
|
%1 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
store ptr %n, ptr %1, align 4
|
store ptr %n, ptr %1, align 4
|
||||||
%stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @"main.closureFunctionGoroutine$1$gowrapper" to i32), ptr undef) #9
|
%stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @"main.closureFunctionGoroutine$1$gowrapper" to i32), ptr undef) #9
|
||||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"main.closureFunctionGoroutine$1$gowrapper" to i32), ptr nonnull %0, i32 %stacksize, ptr undef) #9
|
call void @"internal/task.start"(i32 ptrtoint (ptr @"main.closureFunctionGoroutine$1$gowrapper" to i32), ptr nonnull %0, i32 %stacksize, ptr undef) #9
|
||||||
@@ -87,7 +87,7 @@ entry:
|
|||||||
define linkonce_odr void @"main.closureFunctionGoroutine$1$gowrapper"(ptr %0) unnamed_addr #5 {
|
define linkonce_odr void @"main.closureFunctionGoroutine$1$gowrapper"(ptr %0) unnamed_addr #5 {
|
||||||
entry:
|
entry:
|
||||||
%1 = load i32, ptr %0, align 4
|
%1 = load i32, ptr %0, align 4
|
||||||
%2 = getelementptr inbounds { i32, ptr }, ptr %0, i32 0, i32 1
|
%2 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
%3 = load ptr, ptr %2, align 4
|
%3 = load ptr, ptr %2, align 4
|
||||||
call void @"main.closureFunctionGoroutine$1"(i32 %1, ptr %3)
|
call void @"main.closureFunctionGoroutine$1"(i32 %1, ptr %3)
|
||||||
ret void
|
ret void
|
||||||
@@ -104,9 +104,9 @@ define hidden void @main.funcGoroutine(ptr %fn.context, ptr %fn.funcptr, ptr %co
|
|||||||
entry:
|
entry:
|
||||||
%0 = call align 4 dereferenceable(12) ptr @runtime.alloc(i32 12, ptr null, ptr undef) #9
|
%0 = call align 4 dereferenceable(12) ptr @runtime.alloc(i32 12, ptr null, ptr undef) #9
|
||||||
store i32 5, ptr %0, align 4
|
store i32 5, ptr %0, align 4
|
||||||
%1 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 1
|
%1 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
store ptr %fn.context, ptr %1, align 4
|
store ptr %fn.context, ptr %1, align 4
|
||||||
%2 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 2
|
%2 = getelementptr inbounds i8, ptr %0, i32 8
|
||||||
store ptr %fn.funcptr, ptr %2, align 4
|
store ptr %fn.funcptr, ptr %2, align 4
|
||||||
%stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @main.funcGoroutine.gowrapper to i32), ptr undef) #9
|
%stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @main.funcGoroutine.gowrapper to i32), ptr undef) #9
|
||||||
call void @"internal/task.start"(i32 ptrtoint (ptr @main.funcGoroutine.gowrapper to i32), ptr nonnull %0, i32 %stacksize, ptr undef) #9
|
call void @"internal/task.start"(i32 ptrtoint (ptr @main.funcGoroutine.gowrapper to i32), ptr nonnull %0, i32 %stacksize, ptr undef) #9
|
||||||
@@ -117,9 +117,9 @@ entry:
|
|||||||
define linkonce_odr void @main.funcGoroutine.gowrapper(ptr %0) unnamed_addr #6 {
|
define linkonce_odr void @main.funcGoroutine.gowrapper(ptr %0) unnamed_addr #6 {
|
||||||
entry:
|
entry:
|
||||||
%1 = load i32, ptr %0, align 4
|
%1 = load i32, ptr %0, align 4
|
||||||
%2 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 1
|
%2 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
%3 = load ptr, ptr %2, align 4
|
%3 = load ptr, ptr %2, align 4
|
||||||
%4 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 2
|
%4 = getelementptr inbounds i8, ptr %0, i32 8
|
||||||
%5 = load ptr, ptr %4, align 4
|
%5 = load ptr, ptr %4, align 4
|
||||||
call void %5(i32 %1, ptr %3) #9
|
call void %5(i32 %1, ptr %3) #9
|
||||||
ret void
|
ret void
|
||||||
@@ -154,11 +154,11 @@ define hidden void @main.startInterfaceMethod(ptr %itf.typecode, ptr %itf.value,
|
|||||||
entry:
|
entry:
|
||||||
%0 = call align 4 dereferenceable(16) ptr @runtime.alloc(i32 16, ptr null, ptr undef) #9
|
%0 = call align 4 dereferenceable(16) ptr @runtime.alloc(i32 16, ptr null, ptr undef) #9
|
||||||
store ptr %itf.value, ptr %0, align 4
|
store ptr %itf.value, ptr %0, align 4
|
||||||
%1 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 1
|
%1 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
store ptr @"main$string", ptr %1, align 4
|
store ptr @"main$string", ptr %1, align 4
|
||||||
%2 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 2
|
%2 = getelementptr inbounds i8, ptr %0, i32 8
|
||||||
store i32 4, ptr %2, align 4
|
store i32 4, ptr %2, align 4
|
||||||
%3 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 3
|
%3 = getelementptr inbounds i8, ptr %0, i32 12
|
||||||
store ptr %itf.typecode, ptr %3, align 4
|
store ptr %itf.typecode, ptr %3, align 4
|
||||||
%stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), ptr undef) #9
|
%stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), ptr undef) #9
|
||||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), ptr nonnull %0, i32 %stacksize, ptr undef) #9
|
call void @"internal/task.start"(i32 ptrtoint (ptr @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), ptr nonnull %0, i32 %stacksize, ptr undef) #9
|
||||||
@@ -171,23 +171,23 @@ declare void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(ptr, ptr, i
|
|||||||
define linkonce_odr void @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper"(ptr %0) unnamed_addr #8 {
|
define linkonce_odr void @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper"(ptr %0) unnamed_addr #8 {
|
||||||
entry:
|
entry:
|
||||||
%1 = load ptr, ptr %0, align 4
|
%1 = load ptr, ptr %0, align 4
|
||||||
%2 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 1
|
%2 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
%3 = load ptr, ptr %2, align 4
|
%3 = load ptr, ptr %2, align 4
|
||||||
%4 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 2
|
%4 = getelementptr inbounds i8, ptr %0, i32 8
|
||||||
%5 = load i32, ptr %4, align 4
|
%5 = load i32, ptr %4, align 4
|
||||||
%6 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 3
|
%6 = getelementptr inbounds i8, ptr %0, i32 12
|
||||||
%7 = load ptr, ptr %6, align 4
|
%7 = load ptr, ptr %6, align 4
|
||||||
call void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(ptr %1, ptr %3, i32 %5, ptr %7, ptr undef) #9
|
call void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(ptr %1, ptr %3, i32 %5, ptr %7, ptr undef) #9
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
||||||
attributes #1 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
attributes #1 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
||||||
attributes #2 = { "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
attributes #2 = { "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
|
||||||
attributes #3 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="main.regularFunction" }
|
attributes #3 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="main.regularFunction" }
|
||||||
attributes #4 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="main.inlineFunctionGoroutine$1" }
|
attributes #4 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="main.inlineFunctionGoroutine$1" }
|
||||||
attributes #5 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="main.closureFunctionGoroutine$1" }
|
attributes #5 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="main.closureFunctionGoroutine$1" }
|
||||||
attributes #6 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper" }
|
attributes #6 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper" }
|
||||||
attributes #7 = { "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-invoke"="reflect/methods.Print(string)" "tinygo-methods"="reflect/methods.Print(string)" }
|
attributes #7 = { "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-invoke"="reflect/methods.Print(string)" "tinygo-methods"="reflect/methods.Print(string)" }
|
||||||
attributes #8 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="interface:{Print:func:{basic:string}{}}.Print$invoke" }
|
attributes #8 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="interface:{Print:func:{basic:string}{}}.Print$invoke" }
|
||||||
attributes #9 = { nounwind }
|
attributes #9 = { nounwind }
|
||||||
|
|||||||
+21
-21
@@ -72,7 +72,7 @@ entry:
|
|||||||
%0 = call align 4 dereferenceable(8) ptr @runtime.alloc(i32 8, ptr null, ptr undef) #9
|
%0 = call align 4 dereferenceable(8) ptr @runtime.alloc(i32 8, ptr null, ptr undef) #9
|
||||||
call void @runtime.trackPointer(ptr nonnull %0, ptr nonnull %stackalloc, ptr undef) #9
|
call void @runtime.trackPointer(ptr nonnull %0, ptr nonnull %stackalloc, ptr undef) #9
|
||||||
store i32 5, ptr %0, align 4
|
store i32 5, ptr %0, align 4
|
||||||
%1 = getelementptr inbounds { i32, ptr }, ptr %0, i32 0, i32 1
|
%1 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
store ptr %n, ptr %1, align 4
|
store ptr %n, ptr %1, align 4
|
||||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"main.closureFunctionGoroutine$1$gowrapper" to i32), ptr nonnull %0, i32 65536, ptr undef) #9
|
call void @"internal/task.start"(i32 ptrtoint (ptr @"main.closureFunctionGoroutine$1$gowrapper" to i32), ptr nonnull %0, i32 65536, ptr undef) #9
|
||||||
%2 = load i32, ptr %n, align 4
|
%2 = load i32, ptr %n, align 4
|
||||||
@@ -93,7 +93,7 @@ entry:
|
|||||||
define linkonce_odr void @"main.closureFunctionGoroutine$1$gowrapper"(ptr %0) unnamed_addr #5 {
|
define linkonce_odr void @"main.closureFunctionGoroutine$1$gowrapper"(ptr %0) unnamed_addr #5 {
|
||||||
entry:
|
entry:
|
||||||
%1 = load i32, ptr %0, align 4
|
%1 = load i32, ptr %0, align 4
|
||||||
%2 = getelementptr inbounds { i32, ptr }, ptr %0, i32 0, i32 1
|
%2 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
%3 = load ptr, ptr %2, align 4
|
%3 = load ptr, ptr %2, align 4
|
||||||
call void @"main.closureFunctionGoroutine$1"(i32 %1, ptr %3)
|
call void @"main.closureFunctionGoroutine$1"(i32 %1, ptr %3)
|
||||||
call void @runtime.deadlock(ptr undef) #9
|
call void @runtime.deadlock(ptr undef) #9
|
||||||
@@ -113,9 +113,9 @@ entry:
|
|||||||
%0 = call align 4 dereferenceable(12) ptr @runtime.alloc(i32 12, ptr null, ptr undef) #9
|
%0 = call align 4 dereferenceable(12) ptr @runtime.alloc(i32 12, ptr null, ptr undef) #9
|
||||||
call void @runtime.trackPointer(ptr nonnull %0, ptr nonnull %stackalloc, ptr undef) #9
|
call void @runtime.trackPointer(ptr nonnull %0, ptr nonnull %stackalloc, ptr undef) #9
|
||||||
store i32 5, ptr %0, align 4
|
store i32 5, ptr %0, align 4
|
||||||
%1 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 1
|
%1 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
store ptr %fn.context, ptr %1, align 4
|
store ptr %fn.context, ptr %1, align 4
|
||||||
%2 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 2
|
%2 = getelementptr inbounds i8, ptr %0, i32 8
|
||||||
store ptr %fn.funcptr, ptr %2, align 4
|
store ptr %fn.funcptr, ptr %2, align 4
|
||||||
call void @"internal/task.start"(i32 ptrtoint (ptr @main.funcGoroutine.gowrapper to i32), ptr nonnull %0, i32 65536, ptr undef) #9
|
call void @"internal/task.start"(i32 ptrtoint (ptr @main.funcGoroutine.gowrapper to i32), ptr nonnull %0, i32 65536, ptr undef) #9
|
||||||
ret void
|
ret void
|
||||||
@@ -125,9 +125,9 @@ entry:
|
|||||||
define linkonce_odr void @main.funcGoroutine.gowrapper(ptr %0) unnamed_addr #6 {
|
define linkonce_odr void @main.funcGoroutine.gowrapper(ptr %0) unnamed_addr #6 {
|
||||||
entry:
|
entry:
|
||||||
%1 = load i32, ptr %0, align 4
|
%1 = load i32, ptr %0, align 4
|
||||||
%2 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 1
|
%2 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
%3 = load ptr, ptr %2, align 4
|
%3 = load ptr, ptr %2, align 4
|
||||||
%4 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 2
|
%4 = getelementptr inbounds i8, ptr %0, i32 8
|
||||||
%5 = load ptr, ptr %4, align 4
|
%5 = load ptr, ptr %4, align 4
|
||||||
call void %5(i32 %1, ptr %3) #9
|
call void %5(i32 %1, ptr %3) #9
|
||||||
call void @runtime.deadlock(ptr undef) #9
|
call void @runtime.deadlock(ptr undef) #9
|
||||||
@@ -165,11 +165,11 @@ entry:
|
|||||||
%0 = call align 4 dereferenceable(16) ptr @runtime.alloc(i32 16, ptr null, ptr undef) #9
|
%0 = call align 4 dereferenceable(16) ptr @runtime.alloc(i32 16, ptr null, ptr undef) #9
|
||||||
call void @runtime.trackPointer(ptr nonnull %0, ptr nonnull %stackalloc, ptr undef) #9
|
call void @runtime.trackPointer(ptr nonnull %0, ptr nonnull %stackalloc, ptr undef) #9
|
||||||
store ptr %itf.value, ptr %0, align 4
|
store ptr %itf.value, ptr %0, align 4
|
||||||
%1 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 1
|
%1 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
store ptr @"main$string", ptr %1, align 4
|
store ptr @"main$string", ptr %1, align 4
|
||||||
%2 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 2
|
%2 = getelementptr inbounds i8, ptr %0, i32 8
|
||||||
store i32 4, ptr %2, align 4
|
store i32 4, ptr %2, align 4
|
||||||
%3 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 3
|
%3 = getelementptr inbounds i8, ptr %0, i32 12
|
||||||
store ptr %itf.typecode, ptr %3, align 4
|
store ptr %itf.typecode, ptr %3, align 4
|
||||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), ptr nonnull %0, i32 65536, ptr undef) #9
|
call void @"internal/task.start"(i32 ptrtoint (ptr @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), ptr nonnull %0, i32 65536, ptr undef) #9
|
||||||
ret void
|
ret void
|
||||||
@@ -181,24 +181,24 @@ declare void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(ptr, ptr, i
|
|||||||
define linkonce_odr void @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper"(ptr %0) unnamed_addr #8 {
|
define linkonce_odr void @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper"(ptr %0) unnamed_addr #8 {
|
||||||
entry:
|
entry:
|
||||||
%1 = load ptr, ptr %0, align 4
|
%1 = load ptr, ptr %0, align 4
|
||||||
%2 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 1
|
%2 = getelementptr inbounds i8, ptr %0, i32 4
|
||||||
%3 = load ptr, ptr %2, align 4
|
%3 = load ptr, ptr %2, align 4
|
||||||
%4 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 2
|
%4 = getelementptr inbounds i8, ptr %0, i32 8
|
||||||
%5 = load i32, ptr %4, align 4
|
%5 = load i32, ptr %4, align 4
|
||||||
%6 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 3
|
%6 = getelementptr inbounds i8, ptr %0, i32 12
|
||||||
%7 = load ptr, ptr %6, align 4
|
%7 = load ptr, ptr %6, align 4
|
||||||
call void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(ptr %1, ptr %3, i32 %5, ptr %7, ptr undef) #9
|
call void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(ptr %1, ptr %3, i32 %5, ptr %7, ptr undef) #9
|
||||||
call void @runtime.deadlock(ptr undef) #9
|
call void @runtime.deadlock(ptr undef) #9
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="main.regularFunction" }
|
attributes #3 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "tinygo-gowrapper"="main.regularFunction" }
|
||||||
attributes #4 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="main.inlineFunctionGoroutine$1" }
|
attributes #4 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "tinygo-gowrapper"="main.inlineFunctionGoroutine$1" }
|
||||||
attributes #5 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="main.closureFunctionGoroutine$1" }
|
attributes #5 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "tinygo-gowrapper"="main.closureFunctionGoroutine$1" }
|
||||||
attributes #6 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper" }
|
attributes #6 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "tinygo-gowrapper" }
|
||||||
attributes #7 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-invoke"="reflect/methods.Print(string)" "tinygo-methods"="reflect/methods.Print(string)" }
|
attributes #7 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "tinygo-invoke"="reflect/methods.Print(string)" "tinygo-methods"="reflect/methods.Print(string)" }
|
||||||
attributes #8 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="interface:{Print:func:{basic:string}{}}.Print$invoke" }
|
attributes #8 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "tinygo-gowrapper"="interface:{Print:func:{basic:string}{}}.Print$invoke" }
|
||||||
attributes #9 = { nounwind }
|
attributes #9 = { nounwind }
|
||||||
|
|||||||
Vendored
+7
-7
@@ -130,11 +130,11 @@ entry:
|
|||||||
|
|
||||||
declare %runtime._string @"interface:{Error:func:{}{basic:string}}.Error$invoke"(ptr, ptr, ptr) #6
|
declare %runtime._string @"interface:{Error:func:{}{basic:string}}.Error$invoke"(ptr, ptr, ptr) #6
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-methods"="reflect/methods.Error() string" }
|
attributes #3 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "tinygo-methods"="reflect/methods.Error() string" }
|
||||||
attributes #4 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-methods"="reflect/methods.String() string" }
|
attributes #4 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "tinygo-methods"="reflect/methods.String() string" }
|
||||||
attributes #5 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-invoke"="main.$methods.foo(int) uint8" "tinygo-methods"="reflect/methods.String() string; main.$methods.foo(int) uint8" }
|
attributes #5 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "tinygo-invoke"="main.$methods.foo(int) uint8" "tinygo-methods"="reflect/methods.String() string; main.$methods.foo(int) uint8" }
|
||||||
attributes #6 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-invoke"="reflect/methods.Error() string" "tinygo-methods"="reflect/methods.Error() string" }
|
attributes #6 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "tinygo-invoke"="reflect/methods.Error() string" "tinygo-methods"="reflect/methods.Error() string" }
|
||||||
attributes #7 = { nounwind }
|
attributes #7 = { nounwind }
|
||||||
|
|||||||
Vendored
+3
-3
@@ -44,7 +44,7 @@ entry:
|
|||||||
ret ptr %x
|
ret ptr %x
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nounwind }
|
attributes #3 = { nounwind }
|
||||||
|
|||||||
Vendored
+10
-10
@@ -93,13 +93,13 @@ entry:
|
|||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "wasm-export-name"="extern_func" }
|
attributes #3 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "wasm-export-name"="extern_func" }
|
||||||
attributes #4 = { inlinehint nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #4 = { inlinehint nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #5 = { noinline nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #5 = { noinline nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #6 = { noinline nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "wasm-export-name"="exportedFunctionInSection" }
|
attributes #6 = { noinline nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "wasm-export-name"="exportedFunctionInSection" }
|
||||||
attributes #7 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "wasm-import-module"="modulename" "wasm-import-name"="import1" }
|
attributes #7 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "wasm-import-module"="modulename" "wasm-import-name"="import1" }
|
||||||
attributes #8 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "wasm-import-module"="foobar" "wasm-import-name"="imported" }
|
attributes #8 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "wasm-import-module"="foobar" "wasm-import-name"="imported" }
|
||||||
attributes #9 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "wasm-export-name"="exported" }
|
attributes #9 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" "wasm-export-name"="exported" }
|
||||||
|
|||||||
Vendored
+7
-7
@@ -51,9 +51,9 @@ entry:
|
|||||||
%varargs = call align 4 dereferenceable(12) ptr @runtime.alloc(i32 12, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3
|
%varargs = call align 4 dereferenceable(12) ptr @runtime.alloc(i32 12, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3
|
||||||
call void @runtime.trackPointer(ptr nonnull %varargs, ptr nonnull %stackalloc, ptr undef) #3
|
call void @runtime.trackPointer(ptr nonnull %varargs, ptr nonnull %stackalloc, ptr undef) #3
|
||||||
store i32 1, ptr %varargs, align 4
|
store i32 1, ptr %varargs, align 4
|
||||||
%0 = getelementptr inbounds [3 x i32], ptr %varargs, i32 0, i32 1
|
%0 = getelementptr inbounds i8, ptr %varargs, i32 4
|
||||||
store i32 2, ptr %0, align 4
|
store i32 2, ptr %0, align 4
|
||||||
%1 = getelementptr inbounds [3 x i32], ptr %varargs, i32 0, i32 2
|
%1 = getelementptr inbounds i8, ptr %varargs, i32 8
|
||||||
store i32 3, ptr %1, align 4
|
store i32 3, ptr %1, align 4
|
||||||
%append.new = call { ptr, i32, i32 } @runtime.sliceAppend(ptr %ints.data, ptr nonnull %varargs, i32 %ints.len, i32 %ints.cap, i32 3, i32 4, ptr undef) #3
|
%append.new = call { ptr, i32, i32 } @runtime.sliceAppend(ptr %ints.data, ptr nonnull %varargs, i32 %ints.len, i32 %ints.cap, i32 3, i32 4, ptr undef) #3
|
||||||
%append.newPtr = extractvalue { ptr, i32, i32 } %append.new, 0
|
%append.newPtr = extractvalue { ptr, i32, i32 } %append.new, 0
|
||||||
@@ -286,7 +286,7 @@ entry:
|
|||||||
br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
||||||
|
|
||||||
unsafe.Slice.next: ; preds = %entry
|
unsafe.Slice.next: ; preds = %entry
|
||||||
%5 = trunc i64 %len to i32
|
%5 = trunc nuw i64 %len to i32
|
||||||
%6 = insertvalue { ptr, i32, i32 } undef, ptr %ptr, 0
|
%6 = insertvalue { ptr, i32, i32 } undef, ptr %ptr, 0
|
||||||
%7 = insertvalue { ptr, i32, i32 } %6, i32 %5, 1
|
%7 = insertvalue { ptr, i32, i32 } %6, i32 %5, 1
|
||||||
%8 = insertvalue { ptr, i32, i32 } %7, i32 %5, 2
|
%8 = insertvalue { ptr, i32, i32 } %7, i32 %5, 2
|
||||||
@@ -310,7 +310,7 @@ entry:
|
|||||||
br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
||||||
|
|
||||||
unsafe.Slice.next: ; preds = %entry
|
unsafe.Slice.next: ; preds = %entry
|
||||||
%5 = trunc i64 %len to i32
|
%5 = trunc nuw i64 %len to i32
|
||||||
%6 = insertvalue { ptr, i32, i32 } undef, ptr %ptr, 0
|
%6 = insertvalue { ptr, i32, i32 } undef, ptr %ptr, 0
|
||||||
%7 = insertvalue { ptr, i32, i32 } %6, i32 %5, 1
|
%7 = insertvalue { ptr, i32, i32 } %6, i32 %5, 1
|
||||||
%8 = insertvalue { ptr, i32, i32 } %7, i32 %5, 2
|
%8 = insertvalue { ptr, i32, i32 } %7, i32 %5, 2
|
||||||
@@ -322,7 +322,7 @@ unsafe.Slice.throw: ; preds = %entry
|
|||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nounwind }
|
attributes #3 = { nounwind }
|
||||||
|
|||||||
Vendored
+3
-3
@@ -97,7 +97,7 @@ lookup.throw: ; preds = %entry
|
|||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { nounwind }
|
attributes #3 = { nounwind }
|
||||||
|
|||||||
Vendored
+6
-6
@@ -81,7 +81,7 @@ entry:
|
|||||||
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %hashmap.key)
|
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %hashmap.key)
|
||||||
%s.elt = extractvalue [2 x %main.hasPadding] %s, 0
|
%s.elt = extractvalue [2 x %main.hasPadding] %s, 0
|
||||||
store %main.hasPadding %s.elt, ptr %hashmap.key, align 4
|
store %main.hasPadding %s.elt, ptr %hashmap.key, align 4
|
||||||
%hashmap.key.repack1 = getelementptr inbounds [2 x %main.hasPadding], ptr %hashmap.key, i32 0, i32 1
|
%hashmap.key.repack1 = getelementptr inbounds i8, ptr %hashmap.key, i32 12
|
||||||
%s.elt2 = extractvalue [2 x %main.hasPadding] %s, 1
|
%s.elt2 = extractvalue [2 x %main.hasPadding] %s, 1
|
||||||
store %main.hasPadding %s.elt2, ptr %hashmap.key.repack1, align 4
|
store %main.hasPadding %s.elt2, ptr %hashmap.key.repack1, align 4
|
||||||
%0 = getelementptr inbounds i8, ptr %hashmap.key, i32 1
|
%0 = getelementptr inbounds i8, ptr %hashmap.key, i32 1
|
||||||
@@ -109,7 +109,7 @@ entry:
|
|||||||
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %hashmap.key)
|
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %hashmap.key)
|
||||||
%s.elt = extractvalue [2 x %main.hasPadding] %s, 0
|
%s.elt = extractvalue [2 x %main.hasPadding] %s, 0
|
||||||
store %main.hasPadding %s.elt, ptr %hashmap.key, align 4
|
store %main.hasPadding %s.elt, ptr %hashmap.key, align 4
|
||||||
%hashmap.key.repack1 = getelementptr inbounds [2 x %main.hasPadding], ptr %hashmap.key, i32 0, i32 1
|
%hashmap.key.repack1 = getelementptr inbounds i8, ptr %hashmap.key, i32 12
|
||||||
%s.elt2 = extractvalue [2 x %main.hasPadding] %s, 1
|
%s.elt2 = extractvalue [2 x %main.hasPadding] %s, 1
|
||||||
store %main.hasPadding %s.elt2, ptr %hashmap.key.repack1, align 4
|
store %main.hasPadding %s.elt2, ptr %hashmap.key.repack1, align 4
|
||||||
%0 = getelementptr inbounds i8, ptr %hashmap.key, i32 1
|
%0 = getelementptr inbounds i8, ptr %hashmap.key, i32 1
|
||||||
@@ -132,9 +132,9 @@ entry:
|
|||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #3 = { noinline nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
attributes #3 = { noinline nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,-multivalue,-reference-types" }
|
||||||
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
||||||
attributes #5 = { nounwind }
|
attributes #5 = { nounwind }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module github.com/tinygo-org/tinygo
|
|||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/aykevl/go-wasm v0.0.2-0.20240312204833-50275154210c
|
github.com/aykevl/go-wasm v0.0.2-0.20240825160117-b76c3f9f0982
|
||||||
github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2
|
github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2
|
||||||
github.com/chromedp/cdproto v0.0.0-20220113222801-0725d94bb6ee
|
github.com/chromedp/cdproto v0.0.0-20220113222801-0725d94bb6ee
|
||||||
github.com/chromedp/chromedp v0.7.6
|
github.com/chromedp/chromedp v0.7.6
|
||||||
@@ -20,7 +20,7 @@ require (
|
|||||||
golang.org/x/sys v0.21.0
|
golang.org/x/sys v0.21.0
|
||||||
golang.org/x/tools v0.22.1-0.20240621165957-db513b091504
|
golang.org/x/tools v0.22.1-0.20240621165957-db513b091504
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
tinygo.org/x/go-llvm v0.0.0-20240627184919-3b50c76783a8
|
tinygo.org/x/go-llvm v0.0.0-20250119132755-9dca92dfb4f9
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
github.com/aykevl/go-wasm v0.0.2-0.20240312204833-50275154210c h1:4T0Vj1UkGgcpkRrmn7SbokebnlfxJcMZPgWtOYACAAA=
|
github.com/aykevl/go-wasm v0.0.2-0.20240825160117-b76c3f9f0982 h1:cD7QfvrJdYmBw2tFP/VyKPT8ZESlcrwSwo7SvH9Y4dc=
|
||||||
github.com/aykevl/go-wasm v0.0.2-0.20240312204833-50275154210c/go.mod h1:7sXyiaA0WtSogCu67R2252fQpVmJMh9JWJ9ddtGkpWw=
|
github.com/aykevl/go-wasm v0.0.2-0.20240825160117-b76c3f9f0982/go.mod h1:7sXyiaA0WtSogCu67R2252fQpVmJMh9JWJ9ddtGkpWw=
|
||||||
github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2 h1:oMCHnXa6CCCafdPDbMh/lWRhRByN0VFLvv+g+ayx1SI=
|
github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2 h1:oMCHnXa6CCCafdPDbMh/lWRhRByN0VFLvv+g+ayx1SI=
|
||||||
github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI=
|
github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI=
|
||||||
github.com/chromedp/cdproto v0.0.0-20211126220118-81fa0469ad77/go.mod h1:At5TxYYdxkbQL0TSefRjhLE3Q0lgvqKKMSFUglJ7i1U=
|
github.com/chromedp/cdproto v0.0.0-20211126220118-81fa0469ad77/go.mod h1:At5TxYYdxkbQL0TSefRjhLE3Q0lgvqKKMSFUglJ7i1U=
|
||||||
@@ -74,5 +74,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
|
|||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
tinygo.org/x/go-llvm v0.0.0-20240627184919-3b50c76783a8 h1:bLsZXRUBavt++CJlMN7sppNziqu3LyamESLhFJcpqFQ=
|
tinygo.org/x/go-llvm v0.0.0-20250119132755-9dca92dfb4f9 h1:rMvEzuCYjyiR+pmdiCVWTQw3L6VqiSIXoL19I3lYufE=
|
||||||
tinygo.org/x/go-llvm v0.0.0-20240627184919-3b50c76783a8/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0=
|
tinygo.org/x/go-llvm v0.0.0-20250119132755-9dca92dfb4f9/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0=
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
// Version of TinyGo.
|
// Version of TinyGo.
|
||||||
// Update this value before release of new version of software.
|
// Update this value before release of new version of software.
|
||||||
const version = "0.35.0"
|
const version = "0.37.0"
|
||||||
|
|
||||||
// Return TinyGo version, either in the form 0.30.0 or as a development version
|
// Return TinyGo version, either in the form 0.30.0 or as a development version
|
||||||
// (like 0.30.0-dev-abcd012).
|
// (like 0.30.0-dev-abcd012).
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
module github.com/tinygo-org/tinygo/internal/tools
|
module github.com/tinygo-org/tinygo/internal/wasm-tools
|
||||||
|
|
||||||
go 1.22.4
|
go 1.23.0
|
||||||
|
|
||||||
require github.com/bytecodealliance/wasm-tools-go v0.3.1
|
require (
|
||||||
|
go.bytecodealliance.org v0.6.2
|
||||||
|
go.bytecodealliance.org/cm v0.2.2
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/coreos/go-semver v0.3.1 // indirect
|
github.com/coreos/go-semver v0.3.1 // indirect
|
||||||
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
|
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
|
||||||
github.com/klauspost/compress v1.17.9 // indirect
|
github.com/klauspost/compress v1.18.0 // indirect
|
||||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||||
github.com/regclient/regclient v0.7.1 // indirect
|
github.com/regclient/regclient v0.8.2 // indirect
|
||||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||||
|
github.com/tetratelabs/wazero v1.9.0 // indirect
|
||||||
github.com/ulikunitz/xz v0.5.12 // indirect
|
github.com/ulikunitz/xz v0.5.12 // indirect
|
||||||
github.com/urfave/cli/v3 v3.0.0-alpha9.2 // indirect
|
github.com/urfave/cli/v3 v3.0.0-beta1 // indirect
|
||||||
golang.org/x/mod v0.21.0 // indirect
|
golang.org/x/mod v0.24.0 // indirect
|
||||||
golang.org/x/sys v0.26.0 // indirect
|
golang.org/x/sys v0.31.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
+22
-18
@@ -1,5 +1,3 @@
|
|||||||
github.com/bytecodealliance/wasm-tools-go v0.3.1 h1:9Q9PjSzkbiVmkUvZ7nYCfJ02mcQDBalxycA3s8g7kR4=
|
|
||||||
github.com/bytecodealliance/wasm-tools-go v0.3.1/go.mod h1:vNAQ8DAEp6xvvk+TUHah5DslLEa76f4H6e737OeaxuY=
|
|
||||||
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
||||||
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
|
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -7,16 +5,16 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
|||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4=
|
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4=
|
||||||
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
|
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
|
||||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||||
github.com/olareg/olareg v0.1.0 h1:1dXBOgPrig5N7zoXyIZVQqU0QBo6sD9pbL6UYjY75CA=
|
github.com/olareg/olareg v0.1.1 h1:Ui7q93zjcoF+U9U71sgqgZWByDoZOpqHitUXEu2xV+g=
|
||||||
github.com/olareg/olareg v0.1.0/go.mod h1:RBuU7JW7SoIIxZKzLRhq8sVtQeAHzCAtRrXEBx2KlM4=
|
github.com/olareg/olareg v0.1.1/go.mod h1:w8NP4SWrHHtxsFaUiv1lnCnYPm4sN1seCd2h7FK/dc0=
|
||||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/regclient/regclient v0.7.1 h1:qEsJrTmZd98fZKjueAbrZCSNGU+ifnr6xjlSAs3WOPs=
|
github.com/regclient/regclient v0.8.2 h1:23BQ3jWgKYHHIXUhp/S9laVJDHDoOQaQCzXMJ4undVE=
|
||||||
github.com/regclient/regclient v0.7.1/go.mod h1:+w/BFtJuw0h0nzIw/z2+1FuA2/dVXBzDq4rYmziJpMc=
|
github.com/regclient/regclient v0.8.2/go.mod h1:uGyetv0o6VLyRDjtfeBqp/QBwRLJ3Hcn07/+8QbhNcM=
|
||||||
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
|
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
|
||||||
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
|
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
|
||||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||||
@@ -25,19 +23,25 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
|||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
|
github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I=
|
||||||
|
github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM=
|
||||||
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
|
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
|
||||||
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||||
github.com/urfave/cli/v3 v3.0.0-alpha9.2 h1:CL8llQj3dGRLVQQzHxS+ZYRLanOuhyK1fXgLKD+qV+Y=
|
github.com/urfave/cli/v3 v3.0.0-beta1 h1:6DTaaUarcM0wX7qj5Hcvs+5Dm3dyUTBbEwIWAjcw9Zg=
|
||||||
github.com/urfave/cli/v3 v3.0.0-alpha9.2/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y=
|
github.com/urfave/cli/v3 v3.0.0-beta1/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y=
|
||||||
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
|
go.bytecodealliance.org v0.6.2 h1:Jy4u5DVmSkXgsnwojBhJ+AD/YsJsR3VzVnxF0xRCqTQ=
|
||||||
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
go.bytecodealliance.org v0.6.2/go.mod h1:gqjTJm0y9NSksG4py/lSjIQ/SNuIlOQ+hCIEPQwtJgA=
|
||||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
go.bytecodealliance.org/cm v0.2.2 h1:M9iHS6qs884mbQbIjtLX1OifgyPG9DuMs2iwz8G4WQA=
|
||||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
go.bytecodealliance.org/cm v0.2.2/go.mod h1:JD5vtVNZv7sBoQQkvBvAAVKJPhR/bqBH7yYXTItMfZI=
|
||||||
|
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
|
||||||
|
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||||
|
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
|
||||||
|
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
|
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
|
||||||
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
|
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
package tools
|
package tools
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "github.com/bytecodealliance/wasm-tools-go/cmd/wit-bindgen-go"
|
_ "go.bytecodealliance.org/cm"
|
||||||
|
_ "go.bytecodealliance.org/cmd/wit-bindgen-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go install github.com/bytecodealliance/wasm-tools-go/cmd/wit-bindgen-go
|
//go:generate go install go.bytecodealliance.org/cmd/wit-bindgen-go
|
||||||
|
|||||||
@@ -970,9 +970,9 @@ func (r *runner) runAtRuntime(fn *function, inst instruction, locals []value, me
|
|||||||
case llvm.Call:
|
case llvm.Call:
|
||||||
llvmFn := operands[len(operands)-1]
|
llvmFn := operands[len(operands)-1]
|
||||||
args := operands[:len(operands)-1]
|
args := operands[:len(operands)-1]
|
||||||
for _, arg := range args {
|
for _, op := range operands {
|
||||||
if arg.Type().TypeKind() == llvm.PointerTypeKind {
|
if op.Type().TypeKind() == llvm.PointerTypeKind {
|
||||||
err := mem.markExternalStore(arg)
|
err := mem.markExternalStore(op)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return r.errorAt(inst, err)
|
return r.errorAt(inst, err)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-13
@@ -824,19 +824,6 @@ func (v rawValue) rawLLVMValue(mem *memoryView) (llvm.Value, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return llvm.Value{}, err
|
return llvm.Value{}, err
|
||||||
}
|
}
|
||||||
if !field.IsAGlobalVariable().IsNil() {
|
|
||||||
elementType := field.GlobalValueType()
|
|
||||||
if elementType.TypeKind() == llvm.StructTypeKind {
|
|
||||||
// There are some special pointer types that should be used
|
|
||||||
// as a ptrtoint, so that they can be used in certain
|
|
||||||
// optimizations.
|
|
||||||
name := elementType.StructName()
|
|
||||||
if name == "runtime.funcValueWithSignature" {
|
|
||||||
uintptrType := ctx.IntType(int(mem.r.pointerSize) * 8)
|
|
||||||
field = llvm.ConstPtrToInt(field, uintptrType)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
structFields = append(structFields, field)
|
structFields = append(structFields, field)
|
||||||
i += mem.r.pointerSize
|
i += mem.r.pointerSize
|
||||||
continue
|
continue
|
||||||
@@ -1046,6 +1033,8 @@ func (v *rawValue) set(llvmValue llvm.Value, r *runner) {
|
|||||||
v.buf[i] = ptrValue.pointer
|
v.buf[i] = ptrValue.pointer
|
||||||
}
|
}
|
||||||
case llvm.ICmp:
|
case llvm.ICmp:
|
||||||
|
// Note: constant icmp isn't supported anymore in LLVM 19.
|
||||||
|
// Once we drop support for LLVM 18, this can be removed.
|
||||||
size := r.targetData.TypeAllocSize(llvmValue.Operand(0).Type())
|
size := r.targetData.TypeAllocSize(llvmValue.Operand(0).Type())
|
||||||
lhs := newRawValue(uint32(size))
|
lhs := newRawValue(uint32(size))
|
||||||
rhs := newRawValue(uint32(size))
|
rhs := newRawValue(uint32(size))
|
||||||
|
|||||||
Vendored
-15
@@ -3,7 +3,6 @@ target triple = "x86_64--linux"
|
|||||||
|
|
||||||
@intToPtrResult = global i8 0
|
@intToPtrResult = global i8 0
|
||||||
@ptrToIntResult = global i8 0
|
@ptrToIntResult = global i8 0
|
||||||
@icmpResult = global i8 0
|
|
||||||
@pointerTagResult = global i64 0
|
@pointerTagResult = global i64 0
|
||||||
@someArray = internal global {i16, i8, i8} zeroinitializer
|
@someArray = internal global {i16, i8, i8} zeroinitializer
|
||||||
@someArrayPointer = global ptr zeroinitializer
|
@someArrayPointer = global ptr zeroinitializer
|
||||||
@@ -17,7 +16,6 @@ define internal void @main.init() {
|
|||||||
call void @testIntToPtr()
|
call void @testIntToPtr()
|
||||||
call void @testPtrToInt()
|
call void @testPtrToInt()
|
||||||
call void @testConstGEP()
|
call void @testConstGEP()
|
||||||
call void @testICmp()
|
|
||||||
call void @testPointerTag()
|
call void @testPointerTag()
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
@@ -53,19 +51,6 @@ define internal void @testConstGEP() {
|
|||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
define internal void @testICmp() {
|
|
||||||
br i1 icmp eq (i64 ptrtoint (ptr @ptrToIntResult to i64), i64 0), label %equal, label %unequal
|
|
||||||
equal:
|
|
||||||
; should not be reached
|
|
||||||
store i8 1, ptr @icmpResult
|
|
||||||
ret void
|
|
||||||
unequal:
|
|
||||||
; should be reached
|
|
||||||
store i8 2, ptr @icmpResult
|
|
||||||
ret void
|
|
||||||
ret void
|
|
||||||
}
|
|
||||||
|
|
||||||
define internal void @testPointerTag() {
|
define internal void @testPointerTag() {
|
||||||
%val = and i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @someArray, i32 2) to i64), 3
|
%val = and i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @someArray, i32 2) to i64), 3
|
||||||
store i64 %val, ptr @pointerTagResult
|
store i64 %val, ptr @pointerTagResult
|
||||||
|
|||||||
Vendored
+1
-2
@@ -3,10 +3,9 @@ target triple = "x86_64--linux"
|
|||||||
|
|
||||||
@intToPtrResult = local_unnamed_addr global i8 2
|
@intToPtrResult = local_unnamed_addr global i8 2
|
||||||
@ptrToIntResult = local_unnamed_addr global i8 2
|
@ptrToIntResult = local_unnamed_addr global i8 2
|
||||||
@icmpResult = local_unnamed_addr global i8 2
|
|
||||||
@pointerTagResult = local_unnamed_addr global i64 2
|
@pointerTagResult = local_unnamed_addr global i64 2
|
||||||
@someArray = internal global { i16, i8, i8 } zeroinitializer
|
@someArray = internal global { i16, i8, i8 } zeroinitializer
|
||||||
@someArrayPointer = local_unnamed_addr global ptr getelementptr inbounds ({ i16, i8, i8 }, ptr @someArray, i64 0, i32 1)
|
@someArrayPointer = local_unnamed_addr global ptr getelementptr inbounds (i8, ptr @someArray, i64 2)
|
||||||
|
|
||||||
define void @runtime.initAll() local_unnamed_addr {
|
define void @runtime.initAll() local_unnamed_addr {
|
||||||
ret void
|
ret void
|
||||||
|
|||||||
Submodule
+1
Submodule lib/bdwgc added at d1ff06cc50
@@ -269,6 +269,8 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
|
|||||||
|
|
||||||
if needsSyscallPackage {
|
if needsSyscallPackage {
|
||||||
paths["syscall/"] = true // include syscall/js
|
paths["syscall/"] = true // include syscall/js
|
||||||
|
paths["internal/syscall/"] = true
|
||||||
|
paths["internal/syscall/unix/"] = false
|
||||||
}
|
}
|
||||||
return paths
|
return paths
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1062,9 +1062,8 @@ func findFATMounts(options *compileopts.Options) ([]mountPoint, error) {
|
|||||||
return points, nil
|
return points, nil
|
||||||
case "windows":
|
case "windows":
|
||||||
// Obtain a list of all currently mounted volumes.
|
// Obtain a list of all currently mounted volumes.
|
||||||
cmd := executeCommand(options, "wmic",
|
cmd := executeCommand(options, "powershell", "-c",
|
||||||
"PATH", "Win32_LogicalDisk",
|
"Get-CimInstance -ClassName Win32_LogicalDisk | Select-Object DeviceID, DriveType, FileSystem, VolumeName")
|
||||||
"get", "DeviceID,VolumeName,FileSystem,DriveType")
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
cmd.Stdout = &out
|
cmd.Stdout = &out
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
@@ -1502,7 +1501,7 @@ func main() {
|
|||||||
var tags buildutil.TagsFlag
|
var tags buildutil.TagsFlag
|
||||||
flag.Var(&tags, "tags", "a space-separated list of extra build tags")
|
flag.Var(&tags, "tags", "a space-separated list of extra build tags")
|
||||||
target := flag.String("target", "", "chip/board name or JSON target specification file")
|
target := flag.String("target", "", "chip/board name or JSON target specification file")
|
||||||
buildMode := flag.String("buildmode", "", "build mode to use (default, c-shared)")
|
buildMode := flag.String("buildmode", "", "build mode to use (default, c-shared, wasi-legacy)")
|
||||||
var stackSize uint64
|
var stackSize uint64
|
||||||
flag.Func("stack-size", "goroutine stack size (if unknown at compile time)", func(s string) error {
|
flag.Func("stack-size", "goroutine stack size (if unknown at compile time)", func(s string) error {
|
||||||
size, err := bytesize.Parse(s)
|
size, err := bytesize.Parse(s)
|
||||||
@@ -1685,8 +1684,24 @@ func main() {
|
|||||||
usage(command)
|
usage(command)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if options.Target == "" && filepath.Ext(outpath) == ".wasm" {
|
if options.Target == "" {
|
||||||
options.Target = "wasm"
|
switch {
|
||||||
|
case options.GOARCH == "wasm":
|
||||||
|
switch options.GOOS {
|
||||||
|
case "js":
|
||||||
|
options.Target = "wasm"
|
||||||
|
case "wasip1":
|
||||||
|
options.Target = "wasip1"
|
||||||
|
case "wasip2":
|
||||||
|
options.Target = "wasip2"
|
||||||
|
default:
|
||||||
|
fmt.Fprintln(os.Stderr, "GOARCH=wasm but GOOS is not set correctly. Please set GOOS to wasm, wasip1, or wasip2.")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
case filepath.Ext(outpath) == ".wasm":
|
||||||
|
fmt.Fprintln(os.Stderr, "you appear to want to build a wasm file, but have not specified either a target flag, or the GOARCH/GOOS to use.")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err := Build(pkgName, outpath, options)
|
err := Build(pkgName, outpath, options)
|
||||||
|
|||||||
@@ -594,6 +594,15 @@ func TestWasmExport(t *testing.T) {
|
|||||||
noOutput: true, // wasm-unknown cannot produce output
|
noOutput: true, // wasm-unknown cannot produce output
|
||||||
command: true,
|
command: true,
|
||||||
},
|
},
|
||||||
|
// Test buildmode=wasi-legacy with WASI.
|
||||||
|
{
|
||||||
|
name: "WASIp1-legacy",
|
||||||
|
target: "wasip1",
|
||||||
|
buildMode: "wasi-legacy",
|
||||||
|
scheduler: "none",
|
||||||
|
file: "wasmexport-noscheduler.go",
|
||||||
|
command: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build nrf || (stm32 && !(stm32f103 || stm32l0x1)) || (sam && atsamd51) || (sam && atsame5x) || esp32c3 || tkey
|
//go:build nrf || (stm32 && !(stm32f103 || stm32l0x1)) || (sam && atsamd51) || (sam && atsame5x) || esp32c3 || tkey || (tinygo.riscv32 && virt)
|
||||||
|
|
||||||
// If you update the above build constraint, you'll probably also need to update
|
// If you update the above build constraint, you'll probably also need to update
|
||||||
// src/runtime/rand_hwrng.go.
|
// src/runtime/rand_hwrng.go.
|
||||||
|
|||||||
@@ -17,6 +17,37 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
VersionTLS10 = 0x0301
|
||||||
|
VersionTLS11 = 0x0302
|
||||||
|
VersionTLS12 = 0x0303
|
||||||
|
VersionTLS13 = 0x0304
|
||||||
|
|
||||||
|
// Deprecated: SSLv3 is cryptographically broken, and is no longer
|
||||||
|
// supported by this package. See golang.org/issue/32716.
|
||||||
|
VersionSSL30 = 0x0300
|
||||||
|
)
|
||||||
|
|
||||||
|
// VersionName returns the name for the provided TLS version number
|
||||||
|
// (e.g. "TLS 1.3"), or a fallback representation of the value if the
|
||||||
|
// version is not implemented by this package.
|
||||||
|
func VersionName(version uint16) string {
|
||||||
|
switch version {
|
||||||
|
case VersionSSL30:
|
||||||
|
return "SSLv3"
|
||||||
|
case VersionTLS10:
|
||||||
|
return "TLS 1.0"
|
||||||
|
case VersionTLS11:
|
||||||
|
return "TLS 1.1"
|
||||||
|
case VersionTLS12:
|
||||||
|
return "TLS 1.2"
|
||||||
|
case VersionTLS13:
|
||||||
|
return "TLS 1.3"
|
||||||
|
default:
|
||||||
|
return fmt.Sprintf("0x%04X", version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// CurveID is the type of a TLS identifier for an elliptic curve. See
|
// CurveID is the type of a TLS identifier for an elliptic curve. See
|
||||||
// https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-8.
|
// https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-8.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -101,7 +101,13 @@ type Dialer struct {
|
|||||||
//
|
//
|
||||||
// The returned Conn, if any, will always be of type *Conn.
|
// The returned Conn, if any, will always be of type *Conn.
|
||||||
func (d *Dialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
|
func (d *Dialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||||
return nil, errors.New("tls:DialContext not implemented")
|
switch network {
|
||||||
|
case "tcp", "tcp4":
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("Network %s not supported", network)
|
||||||
|
}
|
||||||
|
|
||||||
|
return net.DialTLS(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadX509KeyPair reads and parses a public/private key pair from a pair
|
// LoadX509KeyPair reads and parses a public/private key pair from a pair
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"machine"
|
||||||
|
"runtime"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const N = 500000
|
||||||
|
const Ngoro = 4
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
start := time.Now()
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
wg.Add(Ngoro)
|
||||||
|
for i := 0; i < Ngoro; i++ {
|
||||||
|
go adder(&wg, N)
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
|
elapsed := time.Since(start)
|
||||||
|
goroutineCtxSwitchOverhead := (elapsed / (Ngoro * N)).String()
|
||||||
|
|
||||||
|
elapsedstr := elapsed.String()
|
||||||
|
machine.LED.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
||||||
|
for {
|
||||||
|
println("bench:", elapsedstr, "goroutine ctx switch:", goroutineCtxSwitchOverhead)
|
||||||
|
machine.LED.High()
|
||||||
|
time.Sleep(elapsed)
|
||||||
|
machine.LED.Low()
|
||||||
|
time.Sleep(elapsed)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func adder(wg *sync.WaitGroup, num int) {
|
||||||
|
for i := 0; i < num; i++ {
|
||||||
|
runtime.Gosched()
|
||||||
|
}
|
||||||
|
wg.Done()
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ package main
|
|||||||
// This example demonstrates how to use pin change interrupts.
|
// This example demonstrates how to use pin change interrupts.
|
||||||
//
|
//
|
||||||
// This is only an example and should not be copied directly in any serious
|
// This is only an example and should not be copied directly in any serious
|
||||||
// circuit, because it lacks an important feature: debouncing.
|
// circuit, because it only naively implements an important feature: debouncing.
|
||||||
// See: https://en.wikipedia.org/wiki/Switch#Contact_bounce
|
// See: https://en.wikipedia.org/wiki/Switch#Contact_bounce
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -15,6 +15,8 @@ const (
|
|||||||
led = machine.LED
|
led = machine.LED
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var lastPress time.Time
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
// Configure the LED, defaulting to on (usually setting the pin to low will
|
// Configure the LED, defaulting to on (usually setting the pin to low will
|
||||||
@@ -29,6 +31,13 @@ func main() {
|
|||||||
|
|
||||||
// Set an interrupt on this pin.
|
// Set an interrupt on this pin.
|
||||||
err := button.SetInterrupt(buttonPinChange, func(machine.Pin) {
|
err := button.SetInterrupt(buttonPinChange, func(machine.Pin) {
|
||||||
|
|
||||||
|
// Ignore events that are too close to the last registered press (debouncing)
|
||||||
|
if time.Since(lastPress) < 100*time.Millisecond {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
lastPress = time.Now()
|
||||||
|
|
||||||
led.Set(!led.Get())
|
led.Set(!led.Get())
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package abi
|
||||||
|
|
||||||
|
type Type struct {
|
||||||
|
// Intentionally left empty. TinyGo uses a different way to represent types,
|
||||||
|
// so this is unimplementable. The type definition here is purely for
|
||||||
|
// compatibility.
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package cm
|
||||||
|
|
||||||
|
// CaseUnmarshaler returns an function that can unmarshal text into
|
||||||
|
// [variant] or [enum] case T.
|
||||||
|
//
|
||||||
|
// [enum]: https://component-model.bytecodealliance.org/design/wit.html#enums
|
||||||
|
// [variant]: https://component-model.bytecodealliance.org/design/wit.html#variants
|
||||||
|
func CaseUnmarshaler[T ~uint8 | ~uint16 | ~uint32](cases []string) func(v *T, text []byte) error {
|
||||||
|
if len(cases) <= linearScanThreshold {
|
||||||
|
return func(v *T, text []byte) error {
|
||||||
|
if len(text) == 0 {
|
||||||
|
return &emptyTextError{}
|
||||||
|
}
|
||||||
|
s := string(text)
|
||||||
|
for i := 0; i < len(cases); i++ {
|
||||||
|
if cases[i] == s {
|
||||||
|
*v = T(i)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &noMatchingCaseError{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m := make(map[string]T, len(cases))
|
||||||
|
for i, v := range cases {
|
||||||
|
m[v] = T(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
return func(v *T, text []byte) error {
|
||||||
|
if len(text) == 0 {
|
||||||
|
return &emptyTextError{}
|
||||||
|
}
|
||||||
|
c, ok := m[string(text)]
|
||||||
|
if !ok {
|
||||||
|
return &noMatchingCaseError{}
|
||||||
|
}
|
||||||
|
*v = c
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const linearScanThreshold = 16
|
||||||
|
|
||||||
|
type emptyTextError struct{}
|
||||||
|
|
||||||
|
func (*emptyTextError) Error() string { return "empty text" }
|
||||||
|
|
||||||
|
type noMatchingCaseError struct{}
|
||||||
|
|
||||||
|
func (*noMatchingCaseError) Error() string { return "no matching case" }
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Package cm contains types and functions for interfacing with the WebAssembly Component Model.
|
// Package cm provides types and functions for interfacing with the WebAssembly Component Model.
|
||||||
//
|
//
|
||||||
// The types in this package (such as [List], [Option], [Result], and [Variant]) are designed to match the memory layout
|
// The types in this package (such as [List], [Option], [Result], and [Variant]) are designed to match the memory layout
|
||||||
// of [Component Model] types as specified in the [Canonical ABI].
|
// of [Component Model] types as specified in the [Canonical ABI].
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
// This file exists for testing this package without WebAssembly,
|
||||||
|
// allowing empty function bodies with a //go:wasmimport directive.
|
||||||
|
// See https://pkg.go.dev/cmd/compile for more information.
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package cm
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// ErrorContext represents the Component Model [error-context] type,
|
||||||
|
// an immutable, non-deterministic, host-defined value meant to aid in debugging.
|
||||||
|
//
|
||||||
|
// [error-context]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#error-context-type
|
||||||
|
type ErrorContext struct {
|
||||||
|
_ HostLayout
|
||||||
|
errorContext
|
||||||
|
}
|
||||||
|
|
||||||
|
type errorContext uint32
|
||||||
|
|
||||||
|
// Error implements the [error] interface. It returns the debug message associated with err.
|
||||||
|
func (err errorContext) Error() string {
|
||||||
|
return err.DebugMessage()
|
||||||
|
}
|
||||||
|
|
||||||
|
// String implements [fmt.Stringer].
|
||||||
|
func (err errorContext) String() string {
|
||||||
|
return err.DebugMessage()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DebugMessage represents the Canonical ABI [error-context.debug-message] function.
|
||||||
|
//
|
||||||
|
// [error-context.debug-message]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#error-contextdebug-message
|
||||||
|
func (err errorContext) DebugMessage() string {
|
||||||
|
var s string
|
||||||
|
wasmimport_errorContextDebugMessage(err, unsafe.Pointer(&s))
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drop represents the Canonical ABI [error-context.drop] function.
|
||||||
|
//
|
||||||
|
// [error-context.drop]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#error-contextdrop
|
||||||
|
func (err errorContext) Drop() {
|
||||||
|
wasmimport_errorContextDrop(err)
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cm
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// msg uses unsafe.Pointer for compatibility with go1.23 and lower.
|
||||||
|
//
|
||||||
|
//go:wasmimport canon error-context.debug-message
|
||||||
|
//go:noescape
|
||||||
|
func wasmimport_errorContextDebugMessage(err errorContext, msg unsafe.Pointer)
|
||||||
|
|
||||||
|
//go:wasmimport canon error-context.drop
|
||||||
|
//go:noescape
|
||||||
|
func wasmimport_errorContextDrop(err errorContext)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package cm
|
||||||
|
|
||||||
|
// Future represents the Component Model [future] type.
|
||||||
|
// A future is a special case of stream. In non-error cases,
|
||||||
|
// a future delivers exactly one value before being automatically closed.
|
||||||
|
//
|
||||||
|
// [future]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#asynchronous-value-types
|
||||||
|
type Future[T any] struct {
|
||||||
|
_ HostLayout
|
||||||
|
future[T]
|
||||||
|
}
|
||||||
|
|
||||||
|
type future[T any] uint32
|
||||||
|
|
||||||
|
// TODO: implement methods on type future
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package cm
|
package cm
|
||||||
|
|
||||||
import "unsafe"
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
// List represents a Component Model list.
|
// List represents a Component Model list.
|
||||||
// The binary representation of list<T> is similar to a Go slice minus the cap field.
|
// The binary representation of list<T> is similar to a Go slice minus the cap field.
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package cm
|
||||||
|
|
||||||
|
// Stream represents the Component Model [stream] type.
|
||||||
|
// A stream is a special case of stream. In non-error cases,
|
||||||
|
// a stream delivers exactly one value before being automatically closed.
|
||||||
|
//
|
||||||
|
// [stream]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#asynchronous-value-types
|
||||||
|
type Stream[T any] struct {
|
||||||
|
_ HostLayout
|
||||||
|
stream[T]
|
||||||
|
}
|
||||||
|
|
||||||
|
type stream[T any] uint32
|
||||||
|
|
||||||
|
// TODO: implement methods on type stream
|
||||||
@@ -3,10 +3,9 @@ package cm
|
|||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
// Discriminant is the set of types that can represent the tag or discriminator of a variant.
|
// Discriminant is the set of types that can represent the tag or discriminator of a variant.
|
||||||
// Use bool for 2-case variant types, result<T>, or option<T> types, uint8 where there are 256 or
|
// Use uint8 where there are 256 or fewer cases, uint16 for up to 65,536 cases, or uint32 for anything greater.
|
||||||
// fewer cases, uint16 for up to 65,536 cases, or uint32 for anything greater.
|
|
||||||
type Discriminant interface {
|
type Discriminant interface {
|
||||||
bool | uint8 | uint16 | uint32
|
uint8 | uint16 | uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variant represents a loosely-typed Component Model variant.
|
// Variant represents a loosely-typed Component Model variant.
|
||||||
|
|||||||
@@ -0,0 +1,196 @@
|
|||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Deep equality test via reflection
|
||||||
|
|
||||||
|
package reflectlite
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// During deepValueEqual, must keep track of checks that are
|
||||||
|
// in progress. The comparison algorithm assumes that all
|
||||||
|
// checks in progress are true when it reencounters them.
|
||||||
|
// Visited comparisons are stored in a map indexed by visit.
|
||||||
|
type visit struct {
|
||||||
|
a1 unsafe.Pointer
|
||||||
|
a2 unsafe.Pointer
|
||||||
|
typ *RawType
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests for deep equality using reflected types. The map argument tracks
|
||||||
|
// comparisons that have already been seen, which allows short circuiting on
|
||||||
|
// recursive types.
|
||||||
|
func deepValueEqual(v1, v2 Value, visited map[visit]struct{}) bool {
|
||||||
|
if !v1.IsValid() || !v2.IsValid() {
|
||||||
|
return v1.IsValid() == v2.IsValid()
|
||||||
|
}
|
||||||
|
if v1.typecode != v2.typecode {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// We want to avoid putting more in the visited map than we need to.
|
||||||
|
// For any possible reference cycle that might be encountered,
|
||||||
|
// hard(v1, v2) needs to return true for at least one of the types in the cycle,
|
||||||
|
// and it's safe and valid to get Value's internal pointer.
|
||||||
|
hard := func(v1, v2 Value) bool {
|
||||||
|
switch v1.Kind() {
|
||||||
|
case Map, Slice, Ptr, Interface:
|
||||||
|
// Nil pointers cannot be cyclic. Avoid putting them in the visited map.
|
||||||
|
return !v1.IsNil() && !v2.IsNil()
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if hard(v1, v2) {
|
||||||
|
addr1 := v1.pointer()
|
||||||
|
addr2 := v2.pointer()
|
||||||
|
if uintptr(addr1) > uintptr(addr2) {
|
||||||
|
// Canonicalize order to reduce number of entries in visited.
|
||||||
|
// Assumes non-moving garbage collector.
|
||||||
|
addr1, addr2 = addr2, addr1
|
||||||
|
}
|
||||||
|
|
||||||
|
// Short circuit if references are already seen.
|
||||||
|
v := visit{addr1, addr2, v1.typecode}
|
||||||
|
if _, ok := visited[v]; ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remember for later.
|
||||||
|
visited[v] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch v1.Kind() {
|
||||||
|
case Array:
|
||||||
|
for i := 0; i < v1.Len(); i++ {
|
||||||
|
if !deepValueEqual(v1.Index(i), v2.Index(i), visited) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
case Slice:
|
||||||
|
if v1.IsNil() != v2.IsNil() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if v1.Len() != v2.Len() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if v1.UnsafePointer() == v2.UnsafePointer() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
for i := 0; i < v1.Len(); i++ {
|
||||||
|
if !deepValueEqual(v1.Index(i), v2.Index(i), visited) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
case Interface:
|
||||||
|
if v1.IsNil() || v2.IsNil() {
|
||||||
|
return v1.IsNil() == v2.IsNil()
|
||||||
|
}
|
||||||
|
return deepValueEqual(v1.Elem(), v2.Elem(), visited)
|
||||||
|
case Ptr:
|
||||||
|
if v1.UnsafePointer() == v2.UnsafePointer() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return deepValueEqual(v1.Elem(), v2.Elem(), visited)
|
||||||
|
case Struct:
|
||||||
|
for i, n := 0, v1.NumField(); i < n; i++ {
|
||||||
|
if !deepValueEqual(v1.Field(i), v2.Field(i), visited) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
case Map:
|
||||||
|
if v1.IsNil() != v2.IsNil() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if v1.Len() != v2.Len() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if v1.UnsafePointer() == v2.UnsafePointer() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
for _, k := range v1.MapKeys() {
|
||||||
|
val1 := v1.MapIndex(k)
|
||||||
|
val2 := v2.MapIndex(k)
|
||||||
|
if !val1.IsValid() || !val2.IsValid() || !deepValueEqual(val1, val2, visited) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
case Func:
|
||||||
|
if v1.IsNil() && v2.IsNil() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// Can't do better than this:
|
||||||
|
return false
|
||||||
|
default:
|
||||||
|
// Normal equality suffices
|
||||||
|
return valueInterfaceUnsafe(v1) == valueInterfaceUnsafe(v2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepEqual reports whether x and y are “deeply equal”, defined as follows.
|
||||||
|
// Two values of identical type are deeply equal if one of the following cases applies.
|
||||||
|
// Values of distinct types are never deeply equal.
|
||||||
|
//
|
||||||
|
// Array values are deeply equal when their corresponding elements are deeply equal.
|
||||||
|
//
|
||||||
|
// Struct values are deeply equal if their corresponding fields,
|
||||||
|
// both exported and unexported, are deeply equal.
|
||||||
|
//
|
||||||
|
// Func values are deeply equal if both are nil; otherwise they are not deeply equal.
|
||||||
|
//
|
||||||
|
// Interface values are deeply equal if they hold deeply equal concrete values.
|
||||||
|
//
|
||||||
|
// Map values are deeply equal when all of the following are true:
|
||||||
|
// they are both nil or both non-nil, they have the same length,
|
||||||
|
// and either they are the same map object or their corresponding keys
|
||||||
|
// (matched using Go equality) map to deeply equal values.
|
||||||
|
//
|
||||||
|
// Pointer values are deeply equal if they are equal using Go's == operator
|
||||||
|
// or if they point to deeply equal values.
|
||||||
|
//
|
||||||
|
// Slice values are deeply equal when all of the following are true:
|
||||||
|
// they are both nil or both non-nil, they have the same length,
|
||||||
|
// and either they point to the same initial entry of the same underlying array
|
||||||
|
// (that is, &x[0] == &y[0]) or their corresponding elements (up to length) are deeply equal.
|
||||||
|
// Note that a non-nil empty slice and a nil slice (for example, []byte{} and []byte(nil))
|
||||||
|
// are not deeply equal.
|
||||||
|
//
|
||||||
|
// Other values - numbers, bools, strings, and channels - are deeply equal
|
||||||
|
// if they are equal using Go's == operator.
|
||||||
|
//
|
||||||
|
// In general DeepEqual is a recursive relaxation of Go's == operator.
|
||||||
|
// However, this idea is impossible to implement without some inconsistency.
|
||||||
|
// Specifically, it is possible for a value to be unequal to itself,
|
||||||
|
// either because it is of func type (uncomparable in general)
|
||||||
|
// or because it is a floating-point NaN value (not equal to itself in floating-point comparison),
|
||||||
|
// or because it is an array, struct, or interface containing
|
||||||
|
// such a value.
|
||||||
|
// On the other hand, pointer values are always equal to themselves,
|
||||||
|
// even if they point at or contain such problematic values,
|
||||||
|
// because they compare equal using Go's == operator, and that
|
||||||
|
// is a sufficient condition to be deeply equal, regardless of content.
|
||||||
|
// DeepEqual has been defined so that the same short-cut applies
|
||||||
|
// to slices and maps: if x and y are the same slice or the same map,
|
||||||
|
// they are deeply equal regardless of content.
|
||||||
|
//
|
||||||
|
// As DeepEqual traverses the data values it may find a cycle. The
|
||||||
|
// second and subsequent times that DeepEqual compares two pointer
|
||||||
|
// values that have been compared before, it treats the values as
|
||||||
|
// equal rather than examining the values to which they point.
|
||||||
|
// This ensures that DeepEqual terminates.
|
||||||
|
func DeepEqual(x, y interface{}) bool {
|
||||||
|
if x == nil || y == nil {
|
||||||
|
return x == y
|
||||||
|
}
|
||||||
|
v1 := ValueOf(x)
|
||||||
|
v2 := ValueOf(y)
|
||||||
|
if v1.typecode != v2.typecode {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return deepValueEqual(v1, v2, make(map[visit]struct{}))
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
//go:build mips
|
//go:build mips
|
||||||
|
|
||||||
package reflect
|
package reflectlite
|
||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
//go:build !mips
|
//go:build !mips
|
||||||
|
|
||||||
package reflect
|
package reflectlite
|
||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package reflectlite
|
|
||||||
|
|
||||||
import "reflect"
|
|
||||||
|
|
||||||
func Swapper(slice interface{}) func(i, j int) {
|
|
||||||
return reflect.Swapper(slice)
|
|
||||||
}
|
|
||||||
|
|
||||||
type Kind = reflect.Kind
|
|
||||||
type Type = reflect.Type
|
|
||||||
type Value = reflect.Value
|
|
||||||
|
|
||||||
const (
|
|
||||||
Invalid Kind = reflect.Invalid
|
|
||||||
Bool Kind = reflect.Bool
|
|
||||||
Int Kind = reflect.Int
|
|
||||||
Int8 Kind = reflect.Int8
|
|
||||||
Int16 Kind = reflect.Int16
|
|
||||||
Int32 Kind = reflect.Int32
|
|
||||||
Int64 Kind = reflect.Int64
|
|
||||||
Uint Kind = reflect.Uint
|
|
||||||
Uint8 Kind = reflect.Uint8
|
|
||||||
Uint16 Kind = reflect.Uint16
|
|
||||||
Uint32 Kind = reflect.Uint32
|
|
||||||
Uint64 Kind = reflect.Uint64
|
|
||||||
Uintptr Kind = reflect.Uintptr
|
|
||||||
Float32 Kind = reflect.Float32
|
|
||||||
Float64 Kind = reflect.Float64
|
|
||||||
Complex64 Kind = reflect.Complex64
|
|
||||||
Complex128 Kind = reflect.Complex128
|
|
||||||
Array Kind = reflect.Array
|
|
||||||
Chan Kind = reflect.Chan
|
|
||||||
Func Kind = reflect.Func
|
|
||||||
Interface Kind = reflect.Interface
|
|
||||||
Map Kind = reflect.Map
|
|
||||||
Ptr Kind = reflect.Ptr
|
|
||||||
Slice Kind = reflect.Slice
|
|
||||||
String Kind = reflect.String
|
|
||||||
Struct Kind = reflect.Struct
|
|
||||||
UnsafePointer Kind = reflect.UnsafePointer
|
|
||||||
)
|
|
||||||
|
|
||||||
func ValueOf(i interface{}) reflect.Value {
|
|
||||||
return reflect.ValueOf(i)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TypeOf(i interface{}) reflect.Type {
|
|
||||||
return reflect.TypeOf(i)
|
|
||||||
}
|
|
||||||
|
|
||||||
type ValueError = reflect.ValueError
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
package reflect
|
package reflectlite
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package reflectlite
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// Some of code here has been copied from the Go sources:
|
||||||
|
// https://github.com/golang/go/blob/go1.15.2/src/reflect/swapper.go
|
||||||
|
// It has the following copyright note:
|
||||||
|
//
|
||||||
|
// Copyright 2016 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
func Swapper(slice interface{}) func(i, j int) {
|
||||||
|
v := ValueOf(slice)
|
||||||
|
if v.Kind() != Slice {
|
||||||
|
panic(&ValueError{Method: "Swapper"})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Just return Nop func if nothing to swap.
|
||||||
|
if v.Len() < 2 {
|
||||||
|
return func(i, j int) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
typ := v.typecode.Elem()
|
||||||
|
size := typ.Size()
|
||||||
|
|
||||||
|
header := (*sliceHeader)(v.value)
|
||||||
|
tmp := unsafe.Pointer(&make([]byte, size)[0])
|
||||||
|
|
||||||
|
return func(i, j int) {
|
||||||
|
if uint(i) >= uint(header.len) || uint(j) >= uint(header.len) {
|
||||||
|
panic("reflect: slice index out of range")
|
||||||
|
}
|
||||||
|
val1 := unsafe.Add(header.data, uintptr(i)*size)
|
||||||
|
val2 := unsafe.Add(header.data, uintptr(j)*size)
|
||||||
|
memcpy(tmp, val1, size)
|
||||||
|
memcpy(val1, val2, size)
|
||||||
|
memcpy(val2, tmp, size)
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,105 @@
|
|||||||
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package reflectlite
|
||||||
|
|
||||||
|
// VisibleFields returns all the visible fields in t, which must be a
|
||||||
|
// struct type. A field is defined as visible if it's accessible
|
||||||
|
// directly with a FieldByName call. The returned fields include fields
|
||||||
|
// inside anonymous struct members and unexported fields. They follow
|
||||||
|
// the same order found in the struct, with anonymous fields followed
|
||||||
|
// immediately by their promoted fields.
|
||||||
|
//
|
||||||
|
// For each element e of the returned slice, the corresponding field
|
||||||
|
// can be retrieved from a value v of type t by calling v.FieldByIndex(e.Index).
|
||||||
|
func VisibleFields(t Type) []StructField {
|
||||||
|
if t == nil {
|
||||||
|
panic("reflect: VisibleFields(nil)")
|
||||||
|
}
|
||||||
|
if t.Kind() != Struct {
|
||||||
|
panic("reflect.VisibleFields of non-struct type")
|
||||||
|
}
|
||||||
|
w := &visibleFieldsWalker{
|
||||||
|
byName: make(map[string]int),
|
||||||
|
visiting: make(map[Type]bool),
|
||||||
|
fields: make([]StructField, 0, t.NumField()),
|
||||||
|
index: make([]int, 0, 2),
|
||||||
|
}
|
||||||
|
w.walk(t)
|
||||||
|
// Remove all the fields that have been hidden.
|
||||||
|
// Use an in-place removal that avoids copying in
|
||||||
|
// the common case that there are no hidden fields.
|
||||||
|
j := 0
|
||||||
|
for i := range w.fields {
|
||||||
|
f := &w.fields[i]
|
||||||
|
if f.Name == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if i != j {
|
||||||
|
// A field has been removed. We need to shuffle
|
||||||
|
// all the subsequent elements up.
|
||||||
|
w.fields[j] = *f
|
||||||
|
}
|
||||||
|
j++
|
||||||
|
}
|
||||||
|
return w.fields[:j]
|
||||||
|
}
|
||||||
|
|
||||||
|
type visibleFieldsWalker struct {
|
||||||
|
byName map[string]int
|
||||||
|
visiting map[Type]bool
|
||||||
|
fields []StructField
|
||||||
|
index []int
|
||||||
|
}
|
||||||
|
|
||||||
|
// walk walks all the fields in the struct type t, visiting
|
||||||
|
// fields in index preorder and appending them to w.fields
|
||||||
|
// (this maintains the required ordering).
|
||||||
|
// Fields that have been overridden have their
|
||||||
|
// Name field cleared.
|
||||||
|
func (w *visibleFieldsWalker) walk(t Type) {
|
||||||
|
if w.visiting[t] {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.visiting[t] = true
|
||||||
|
for i := 0; i < t.NumField(); i++ {
|
||||||
|
f := t.Field(i)
|
||||||
|
w.index = append(w.index, i)
|
||||||
|
add := true
|
||||||
|
if oldIndex, ok := w.byName[f.Name]; ok {
|
||||||
|
old := &w.fields[oldIndex]
|
||||||
|
if len(w.index) == len(old.Index) {
|
||||||
|
// Fields with the same name at the same depth
|
||||||
|
// cancel one another out. Set the field name
|
||||||
|
// to empty to signify that has happened, and
|
||||||
|
// there's no need to add this field.
|
||||||
|
old.Name = ""
|
||||||
|
add = false
|
||||||
|
} else if len(w.index) < len(old.Index) {
|
||||||
|
// The old field loses because it's deeper than the new one.
|
||||||
|
old.Name = ""
|
||||||
|
} else {
|
||||||
|
// The old field wins because it's shallower than the new one.
|
||||||
|
add = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if add {
|
||||||
|
// Copy the index so that it's not overwritten
|
||||||
|
// by the other appends.
|
||||||
|
f.Index = append([]int(nil), w.index...)
|
||||||
|
w.byName[f.Name] = len(w.fields)
|
||||||
|
w.fields = append(w.fields, f)
|
||||||
|
}
|
||||||
|
if f.Anonymous {
|
||||||
|
if f.Type.Kind() == Pointer {
|
||||||
|
f.Type = f.Type.Elem()
|
||||||
|
}
|
||||||
|
if f.Type.Kind() == Struct {
|
||||||
|
w.walk(f.Type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.index = w.index[:len(w.index)-1]
|
||||||
|
}
|
||||||
|
delete(w.visiting, t)
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package unix
|
||||||
|
|
||||||
|
const (
|
||||||
|
R_OK = 0x4
|
||||||
|
W_OK = 0x2
|
||||||
|
X_OK = 0x1
|
||||||
|
)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package unix
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func Eaccess(path string, mode uint32) error {
|
||||||
|
// We don't support this syscall on baremetal or wasm.
|
||||||
|
// Callers are generally able to deal with this since unix.Eaccess also
|
||||||
|
// isn't available on Android.
|
||||||
|
return syscall.ENOSYS
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package unix
|
||||||
|
|
||||||
|
type GetRandomFlag uintptr
|
||||||
|
|
||||||
|
const (
|
||||||
|
GRND_NONBLOCK GetRandomFlag = 0x0001
|
||||||
|
GRND_RANDOM GetRandomFlag = 0x0002
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetRandom(p []byte, flags GetRandomFlag) (n int, err error) {
|
||||||
|
panic("todo: unix.GetRandom")
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package task
|
||||||
|
|
||||||
|
type Mutex struct {
|
||||||
|
locked bool
|
||||||
|
blocked Stack
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mutex) Lock() {
|
||||||
|
if m.locked {
|
||||||
|
// Push self onto stack of blocked tasks, and wait to be resumed.
|
||||||
|
m.blocked.Push(Current())
|
||||||
|
Pause()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
m.locked = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mutex) Unlock() {
|
||||||
|
if !m.locked {
|
||||||
|
panic("sync: unlock of unlocked Mutex")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wake up a blocked task, if applicable.
|
||||||
|
if t := m.blocked.Pop(); t != nil {
|
||||||
|
scheduleTask(t)
|
||||||
|
} else {
|
||||||
|
m.locked = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TryLock tries to lock m and reports whether it succeeded.
|
||||||
|
//
|
||||||
|
// Note that while correct uses of TryLock do exist, they are rare,
|
||||||
|
// and use of TryLock is often a sign of a deeper problem
|
||||||
|
// in a particular use of mutexes.
|
||||||
|
func (m *Mutex) TryLock() bool {
|
||||||
|
if m.locked {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
m.Lock()
|
||||||
|
return true
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user