Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/runtime: implement runtime.Version() function #2676

Merged
merged 3 commits into from
Mar 19, 2022

Commits on Mar 18, 2022

  1. Move gitSha1 build time variable from main to goenv package

    Moving and exporting this variable from the main to the goenv package
    allows us to use it from both the main and the builder package.
    This is done in preparation to include the value in `tinygo build`
    linker flags, so that we can embed the version and git sha into binaries
    built with tinygo.
    ZauberNerd committed Mar 18, 2022
    Configuration menu
    Copy the full SHA
    de6493f View commit details
    Browse the repository at this point in the history
  2. src/runtime: add runtime.Version()

    This adds the `Version()` function of the `runtime` package which embeds
    the go version that was used to build tinygo.
    
    For programs that are compiled with tinygo the version can be overriden
    via the:
    `tinygo build -ldflags="-X 'runtime.buildVersion=abc'"` flag.
    Otherwise it will continue to use the go version with which tinygo was
    compiled.
    ZauberNerd committed Mar 18, 2022
    Configuration menu
    Copy the full SHA
    6c38fab View commit details
    Browse the repository at this point in the history
  3. targets/wasi: remove --export-dynamic linker flag

    Exporting symbols seems to embed them in the WASM exports section which
    causes wasmtime to fail: bytecodealliance/wasmtime#2587
    As a workaround, it is possible to specify the `--allow-unknown-exports`
    flag on wasmtime.
    But as discussed in the above linked issue, this seems to only be a
    workaround. For the Rust compiler the fix was to remove the
    `--export-dynamic` linker flag when targeting `wasm32-wasi`:
    rust-lang/rust#81255
    Which is waht this commit does for Tinygo too.
    ZauberNerd committed Mar 18, 2022
    Configuration menu
    Copy the full SHA
    aab7419 View commit details
    Browse the repository at this point in the history