libc升级到0.2.180版本

Signed-off-by: ljy9810 <longjianyin@h-partners.com>
This commit is contained in:
ljy9810
2026-03-04 12:00:27 +08:00
parent fc423d68a3
commit 0e57942c36
576 changed files with 109283 additions and 92917 deletions
+24 -33
View File
@@ -1,41 +1,32 @@
task:
name: nightly x86_64-unknown-freebsd-13
freebsd_instance:
image_family: freebsd-13-2
only_if: $CIRRUS_BRANCH == 'main' || $CIRRUS_BASE_BRANCH == 'libc-0.2' || $CIRRUS_BASE_BRANCH == 'main'
env:
HOME: /tmp # cargo cache needs it
TARGET: x86_64-unknown-freebsd
matrix:
# FIXME(#4740): FreeBSD 13 tests are extremely flaky and fail most of the time
# - name: nightly freebsd-13 x86_64
# freebsd_instance:
# image_family: freebsd-13-4
- name: nightly freebsd-15 i686
# Test i686 FreeBSD in 32-bit emulation on a 64-bit host.
env:
TARGET: i686-unknown-freebsd
freebsd_instance:
image: freebsd-15-0-release-amd64-ufs
- name: nightly freebsd-14 x86_64
freebsd_instance:
image: freebsd-14-3-release-amd64-ufs
- name: nightly freebsd-15 x86_64
freebsd_instance:
image: freebsd-15-0-release-amd64-ufs
setup_script:
- pkg install -y libnghttp2 curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh -y --default-toolchain nightly --profile=minimal
- . $HOME/.cargo/env
- if [ "$TARGET" = "i686-unknown-freebsd" ]; then rustup target add i686-unknown-freebsd; fi
test_script:
- . $HOME/.cargo/env
- LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
- sh ci/run.sh x86_64-unknown-freebsd
task:
name: nightly x86_64-unknown-freebsd-14
freebsd_instance:
image: freebsd-14-0-release-amd64-ufs
setup_script:
- pkg install -y libnghttp2 curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh -y --default-toolchain nightly --profile=minimal
- . $HOME/.cargo/env
test_script:
- . $HOME/.cargo/env
- LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
- sh ci/run.sh x86_64-unknown-freebsd
task:
name: nightly x86_64-unknown-freebsd-15
freebsd_instance:
image_family: freebsd-15-0-snap
setup_script:
- pkg install -y libnghttp2 curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh -y --default-toolchain nightly --profile=minimal
- . $HOME/.cargo/env
test_script:
- . $HOME/.cargo/env
- LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
- sh ci/run.sh x86_64-unknown-freebsd
- LIBC_CI=1 sh ci/run.sh $TARGET
- sh ci/run.sh $TARGET
+7
View File
@@ -0,0 +1,7 @@
[*.sh]
# See https://github.com/mvdan/sh/blob/master/cmd/shfmt/shfmt.1.scd#examples
indent_style = space
indent_size = 4
switch_case_indent = true
space_redirects = true
+6
View File
@@ -0,0 +1,6 @@
# Format macro bodies
50f26e08e146b7e9c7d1af9614486eba327d1e31
# Automated changes related to the 2021 edition upgrade
643182f7da26cedb09349b8bb3735c2e58ba24e6
108310db03e7db35ef48a902d9ce9a88ab8f9b77
+42 -7
View File
@@ -1,10 +1,45 @@
Thanks for considering submitting a PR!
<!-- Thank you for submitting a PR!
Here's a checklist for things that will be checked during review or continuous integration.
We have the contribution guide, please read it if you are new here!
<https://github.com/rust-lang/libc/blob/main/CONTRIBUTING.md>
- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove item(s)
- \[ ] `rustc ci/style.rs && ./style src`
- \[ ] `cd libc-test && cargo test` (This might fail on your env due to environment difference between your env and CI. Ignore failures if you are not sure.)
- \[ ] Your PR that bumps up the crate version doesn't contain any other changes
Please fill out the below template.
-->
Delete this line and everything above before opening your PR.
# Description
<!-- Add a short description about what this change does -->
# Sources
<!-- All API changes must have permalinks to headers. Common sources:
* Linux uapi https://github.com/torvalds/linux/tree/master/include/uapi
* Glibc https://github.com/bminor/glibc
* Musl https://github.com/bminor/musl
* Apple XNU https://github.com/apple-oss-distributions/xnu
* Android https://cs.android.com/android/platform/superproject/main
After navigating to the relevant file, click the triple dots and select "copy
permalink" if on GitHub, or l-r (links->commit) for the Android source to get a
link to the current version of the header.
If sources are closed, link to documentation or paste relevant C definitions.
-->
# Checklist
<!-- Please make sure the following has been done before submitting a PR,
or mark it as a draft if you are not sure. -->
- [ ] Relevant tests in `libc-test/semver` have been updated
- [ ] No placeholder or unstable values like `*LAST` or `*MAX` are
included (see [#3131](https://github.com/rust-lang/libc/issues/3131))
- [ ] Tested locally (`cd libc-test && cargo test --target mytarget`);
especially relevant for platforms that may not be checked in CI
<!-- labels: is this PR a breaking change? If not, we can probably get it in a
0.2 release. Just uncomment the following:
@rustbot label +stable-nominated
-->
+6
View File
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
-412
View File
@@ -1,412 +0,0 @@
name: CI (bors)
on:
push:
branches:
- auto-libc
- try
permissions: {}
jobs:
docker_linux_tier1:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)
name: Docker Linux Tier1
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
target: [
i686-unknown-linux-gnu,
x86_64-unknown-linux-gnu,
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
- name: Execute run-docker.sh
run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }}
macos:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)
name: macOS
runs-on: macos-12
strategy:
fail-fast: true
matrix:
target: [
x86_64-apple-darwin,
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
- name: Execute run.sh
run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }}
windows:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)
name: Windows
runs-on: windows-2022
env:
OS: windows
strategy:
fail-fast: true
matrix:
include:
- target: x86_64-pc-windows-gnu
env:
ARCH_BITS: 64
ARCH: x86_64
- target: x86_64-pc-windows-msvc
# Disabled because broken:
# https://github.com/rust-lang/libc/issues/1592
#- target: i686-pc-windows-gnu
# env:
# ARCH_BITS: 32
# ARCH: i686
- target: i686-pc-windows-msvc
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Self-update rustup
run: rustup self update
shell: bash
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
shell: bash
- name: Execute run.sh
run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }}
shell: bash
style_check:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)
name: Style check
runs-on: ubuntu-22.04
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: sh ./ci/install-rust.sh
- name: Check style
run: sh ci/style.sh
docker_linux_tier2:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)
name: Docker Linux Tier2
needs: [docker_linux_tier1, style_check]
runs-on: ubuntu-22.04
strategy:
fail-fast: true
max-parallel: 12
matrix:
target: [
# FIXME: Mysterious failures in CI, see
# https://github.com/rust-lang/libc/issues/2081
# aarch64-linux-android,
aarch64-unknown-linux-gnu,
aarch64-unknown-linux-musl,
arm-linux-androideabi,
arm-unknown-linux-gnueabihf,
arm-unknown-linux-musleabihf,
asmjs-unknown-emscripten,
i686-linux-android,
i686-unknown-linux-musl,
mips-unknown-linux-gnu,
mips-unknown-linux-musl,
# FIXME: Somehow failed on CI
# https://github.com/rust-lang/libc/runs/1659882216
# mips64-unknown-linux-gnuabi64,
# mips64el-unknown-linux-gnuabi64,
mipsel-unknown-linux-musl,
powerpc-unknown-linux-gnu,
powerpc64-unknown-linux-gnu,
powerpc64le-unknown-linux-gnu,
s390x-unknown-linux-gnu,
riscv64gc-unknown-linux-gnu,
# FIXME: A recent nightly causes a linker failure:
# https://github.com/rust-lang/rust/issues/76679
# See this comment for more details:
# https://github.com/rust-lang/libc/pull/2225#issuecomment-880696737
#wasm32-wasi,
sparc64-unknown-linux-gnu,
wasm32-unknown-emscripten,
x86_64-linux-android,
x86_64-unknown-linux-gnux32,
x86_64-unknown-linux-musl,
# FIXME: It seems some items in `src/unix/mod.rs`
# aren't defined on redox actually.
# x86_64-unknown-redox,
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
- name: Execute run-docker.sh
run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }}
# These targets are tier 3 or otherwise need to have CI build std via -Zbuild-std.
# Because of this, only the nightly compiler can be used on these targets.
docker_linux_build_std:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)
if: ${{ false }} # This is currently broken
name: Docker Linux Build-Std Targets
needs: [docker_linux_tier1, style_check]
runs-on: ubuntu-22.04
strategy:
fail-fast: true
max-parallel: 12
matrix:
target: [
armv7-unknown-linux-uclibceabihf
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: TOOLCHAIN=nightly INSTALL_RUST_SRC=1 sh ./ci/install-rust.sh
- name: Execute run-docker.sh
run: LIBC_CI=1 TOOLCHAIN=nightly LIBC_CI_ZBUILD_STD=1 sh ./ci/run-docker.sh ${{ matrix.target }}
# devkitpro's pacman needs to be connected from Docker.
docker_switch:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)
name: Docker Switch
needs: [docker_linux_tier1, style_check]
runs-on: ubuntu-22.04
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: sh ./ci/install-rust.sh
- name: Execute run-docker.sh
run: LIBC_CI=1 sh ./ci/run-docker.sh switch
build_channels_linux:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)
name: Build Channels Linux
needs: docker_linux_tier2
runs-on: ubuntu-22.04
env:
OS: linux
strategy:
fail-fast: true
max-parallel: 5
matrix:
toolchain: [
stable,
beta,
nightly,
1.13.0,
1.19.0,
1.24.0,
1.25.0,
1.30.0,
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh
- name: Execute build.sh
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh
build_channels_macos:
permissions:
contents: read # to fetch code (actions/checkout)
name: Build Channels macOS
needs: macos
# FIXME: Use macOS 11 for now as CI failed with a linker error on macOS 12 image:
# ld: in /.../x86_64-apple-darwin/lib/libstd-a4729905.rlib(rust.metadata.bin),
# archive member 'rust.metadata.bin' with length 2958149 is not mach-o or llvm bitcode file '/.../x86_64-apple-darwin/lib/libstd-a4729905.rlib'
# Possibly related: https://github.com/actions/runner-images/issues/6350
runs-on: macos-11
env:
OS: macos
strategy:
fail-fast: true
max-parallel: 4
matrix:
toolchain: [
stable,
beta,
nightly,
1.13.0,
1.19.0,
1.24.0,
1.25.0,
1.30.0,
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh
- name: Execute build.sh
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh
build_channels_windows:
permissions:
contents: read # to fetch code (actions/checkout)
name: Build Channels Windows
runs-on: windows-2022
env:
OS: windows
strategy:
fail-fast: true
matrix:
toolchain: [
1.19.0,
1.24.0,
1.25.0,
1.30.0,
stable,
]
steps:
- uses: actions/checkout@v3
- name: Self-update rustup
run: rustup self update
shell: bash
- name: Execute build.sh
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} WIN_TARGET=${{ matrix.target }} sh ./ci/build.sh
shell: bash
semver_linux:
if: ${{ false }} # This is currently broken
name: Semver Linux
runs-on: ubuntu-22.04
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
# Should update the semverver revision in semver.sh if we touch nightly ver.
run: TOOLCHAIN=nightly-2022-05-23 sh ./ci/install-rust.sh
- name: Check breaking changes
run: sh ci/semver.sh linux
semver_macos:
if: ${{ false }} # This is currently broken
name: Semver macOS
runs-on: macos-12
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
# Pin nightly version to make semverver compilable.
run: TOOLCHAIN=nightly-2022-05-23 sh ./ci/install-rust.sh
- name: Check breaking changes
run: sh ci/semver.sh macos
docs:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)
name: Generate documentation
runs-on: ubuntu-22.04
needs: docker_linux_tier2
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: sh ./ci/install-rust.sh
- name: Generate documentation
run: LIBC_CI=1 sh ci/dox.sh
# These jobs doesn't actually test anything, but they're only used to tell
# bors the build completed, as there is no practical way to detect when a
# workflow is successful listening to webhooks only.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
end_success:
name: bors build finished
if: github.event.pusher.name == 'bors' && success()
runs-on: ubuntu-22.04
needs: [
docker_linux_tier1,
docker_linux_tier2,
#docker_linux_build_std,
macos,
windows,
style_check,
docker_switch,
build_channels_linux,
build_channels_macos,
build_channels_windows,
docs,
]
steps:
- name: Mark the job as successful
run: exit 0
end_failure:
name: bors build finished
if: github.event.pusher.name == 'bors' && (failure() || cancelled())
runs-on: ubuntu-22.04
needs: [
docker_linux_tier1,
docker_linux_tier2,
#docker_linux_build_std,
macos,
windows,
style_check,
docker_switch,
build_channels_linux,
build_channels_macos,
build_channels_windows,
docs,
]
steps:
- name: Mark the job as a failure
run: exit 1
+342
View File
@@ -0,0 +1,342 @@
name: CI
on:
merge_group:
pull_request:
branches:
- libc-0.2
env:
CARGO_TERM_COLOR: always
CARGO_TERM_VERBOSE: true
LIBC_CI: 1
RUSTDOCFLAGS: -Dwarnings
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: full
TARGET_REF: ${{ github.base_ref || github.event.merge_group.base_ref }}
defaults:
run:
shell: bash
jobs:
style_check:
name: Style check
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Setup Rust toolchain
run: ./ci/install-rust.sh && rustup component add rustfmt
- name: Check style
run: ./ci/style.py
clippy:
name: Clippy on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04, macos-15, windows-2025]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- run: rustup update stable --no-self-update
- uses: Swatinem/rust-cache@v2
# Here we use the latest stable Rust toolchain already installed by GitHub
# Ideally we should run it for every target, but we cannot rely on unstable toolchains
# due to Clippy not being consistent between them.
- run: cargo clippy --workspace --exclude libc-test --exclude ctest-test --all-targets -- -D warnings
# This runs `cargo build --target ...` for all T1 and T2 targets`
verify_build:
name: Verify build
strategy:
matrix:
toolchain: [stable, 1.63.0]
include:
# Nightly has a lot of targets, so split it in half
- toolchain: nightly
half: 1
- toolchain: nightly
half: 2
- toolchain: beta
only: '(aarch64|x86_64)' # just a spot check for beta
- toolchain: stable
- toolchain: 1.63.0 # msrv
runs-on: ubuntu-24.04
timeout-minutes: 25
env:
TOOLCHAIN: ${{ matrix.toolchain }}
steps:
- uses: actions/checkout@v6
- name: Setup Rust toolchain
run: ./ci/install-rust.sh
- name: Install semver-checks
uses: taiki-e/install-action@cargo-semver-checks
if: matrix.toolchain == 'stable'
- name: Retrieve semver baseline
if: matrix.toolchain == 'stable'
run: ./ci/prep-semver-baseline.sh
# FIXME(ci): These `du` statements are temporary for debugging cache
- name: Target size before restoring cache
run: du -sh target | sort -k 2 || true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.toolchain }}
- name: Target size after restoring cache
run: du -sh target | sort -k 2 || true
- name: Execute build check
run: |
set -eux
# Remove `-Dwarnings` at the MSRV since lints may be different
[ "${{ matrix.toolchain }}" = "1.63.0" ] && export RUSTFLAGS=""
python3 ci/verify-build.py \
--toolchain "$TOOLCHAIN" \
${BASELINE_CRATE_DIR:+"--baseline-crate-dir" "$BASELINE_CRATE_DIR"} \
${{ matrix.only && format('--only "{0}"', matrix.only) }} \
${{ matrix.half && format('--half "{0}"', matrix.half) }}
- name: Target size after job completion
run: du -sh target | sort -k 2
test_tier1:
name: Test tier1
strategy:
matrix:
include:
- target: aarch64-apple-darwin
os: macos-15
- target: aarch64-pc-windows-msvc
os: windows-11-arm
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
# FIXME: It currently causes segfaults.
#- target: i686-pc-windows-gnu
# env: { ARCH_BITS: 32, ARCH: i686 }
- target: i686-pc-windows-msvc
os: windows-2025
- target: i686-unknown-linux-gnu
- target: x86_64-pc-windows-gnu
os: windows-2025
env: { ARCH_BITS: 64, ARCH: x86_64 }
- target: x86_64-pc-windows-msvc
os: windows-2025
- target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.os && matrix.os || 'ubuntu-24.04' }}
timeout-minutes: 25
env:
TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v6
- name: Setup Rust toolchain
run: ./ci/install-rust.sh
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Add matrix env variables to the environment
if: matrix.env
run: |
echo '${{ toJson(matrix.env) }}' |
jq -r 'to_entries | map("\(.key)=\(.value|tostring)") | .[]' >>$GITHUB_ENV
shell: bash
- name: Run natively
if: runner.os != 'Linux'
run: ./ci/run.sh ${{ matrix.target }}
- name: Run in Docker
if: runner.os == 'Linux'
run: ./ci/run-docker.sh ${{ matrix.target }}
- name: Create CI artifacts
id: create_artifacts
if: always()
run: python3 ci/create-artifacts.py
- uses: actions/upload-artifact@v6
if: always() && steps.create_artifacts.outcome == 'success'
with:
name: ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}${{ matrix.artifact-tag && format('-{0}', matrix.artifact-tag) }}
path: ${{ env.ARCHIVE_PATH }}
retention-days: 5
# Unlike `main` this job doesn't have `needs`, in order to speed up backports a bit
test_tier2:
name: Test tier2
needs: [test_tier1, style_check]
strategy:
fail-fast: true
max-parallel: 16
matrix:
include:
# FIXME(sparc): this takes much longer to run than any other job, put
# it first to make sure it gets a head start.
- target: sparc64-unknown-linux-gnu
- target: aarch64-linux-android
- target: aarch64-unknown-linux-musl
- target: aarch64-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
artifact-tag: new-musl
- target: arm-linux-androideabi
- target: arm-unknown-linux-gnueabihf
- target: arm-unknown-linux-musleabihf
- target: arm-unknown-linux-musleabihf
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
artifact-tag: new-musl
# FIXME(#4297): Disabled due to spurious failue
# - target: i686-linux-android
- target: i686-unknown-linux-musl
- target: i686-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
artifact-tag: new-musl
- target: loongarch64-unknown-linux-gnu
- target: loongarch64-unknown-linux-musl
- target: loongarch64-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
artifact-tag: new-musl
- target: powerpc64-unknown-linux-gnu
- target: powerpc64le-unknown-linux-gnu
- target: powerpc64le-unknown-linux-musl
- target: powerpc64le-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
artifact-tag: new-musl
- target: riscv64gc-unknown-linux-gnu
- target: s390x-unknown-linux-gnu
- target: wasm32-unknown-emscripten
- target: wasm32-wasip1
- target: wasm32-wasip2
- target: x86_64-apple-darwin
os: macos-15-intel
- target: x86_64-linux-android
# FIXME: Exec format error (os error 8)
# - target: x86_64-unknown-linux-gnux32
- target: x86_64-unknown-linux-musl
- target: x86_64-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
artifact-tag: new-musl
# FIXME: It seems some items in `src/unix/mod.rs` aren't defined on redox actually.
# - target: x86_64-unknown-redox
# FIXME(ppc): SIGILL running tests, see
# https://github.com/rust-lang/libc/pull/4254#issuecomment-2636288713
# - target: powerpc-unknown-linux-gnu
runs-on: ${{ matrix.os && matrix.os || 'ubuntu-24.04' }}
timeout-minutes: 25
env:
TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v6
- name: Setup Rust toolchain
run: ./ci/install-rust.sh
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Add matrix env variables to the environment
if: matrix.env
run: |
echo '${{ toJson(matrix.env) }}' |
jq -r 'to_entries | map("\(.key)=\(.value|tostring)") | .[]' >>$GITHUB_ENV
shell: bash
- name: Run natively
if: runner.os != 'Linux'
run: ./ci/run.sh ${{ matrix.target }}
- name: Run in Docker
if: runner.os == 'Linux'
run: ./ci/run-docker.sh ${{ matrix.target }}
- name: Create CI artifacts
id: create_artifacts
if: always()
run: ./ci/create-artifacts.py
- uses: actions/upload-artifact@v6
if: always() && steps.create_artifacts.outcome == 'success'
with:
name: ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}${{ matrix.artifact-tag && format('-{0}', matrix.artifact-tag) }}
path: ${{ env.ARCHIVE_PATH }}
retention-days: 5
test_tier2_vm:
name: Test tier2 VM
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- target: x86_64-pc-solaris
- target: x86_64-unknown-netbsd
timeout-minutes: 25
steps:
- uses: actions/checkout@v6
- name: test on Solaris
uses: vmactions/solaris-vm@v1.2.3
if: contains(matrix.target, 'solaris')
with:
release: "11.4-gcc"
usesh: true
mem: 4096
copyback: false
prepare: |
set -x
source <(curl -s https://raw.githubusercontent.com/psumbera/solaris-rust/refs/heads/main/sh.rust-web-install)
rustc --version
uname -a
run: |
export PATH=$HOME/.rust_solaris/bin:$PATH
./ci/run.sh ${{ matrix.target }}
- name: Test on NetBSD
uses: vmactions/netbsd-vm@v1
if: contains(matrix.target, 'netbsd')
with:
release: "10.1"
usesh: true
mem: 4096
copyback: false
prepare: |
set -x
/usr/sbin/pkg_add curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
--profile minimal --default-toolchain nightly -y
run: |
set -x
. "$HOME/.cargo/env"
which rustc
rustc -Vv
./ci/run.sh ${{ matrix.target }}
docs:
name: Ensure docs build
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update nightly --no-self-update && rustup default nightly
- uses: Swatinem/rust-cache@v2
- run: cargo doc --workspace --no-deps
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
# protection, rather than having to add each job separately.
success:
name: success
runs-on: ubuntu-24.04
needs:
- style_check
- test_tier1
- test_tier2
- test_tier2_vm
- verify_build
- docs
- clippy
# Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
# dependencies fails.
if: always() # make sure this is never "skipped"
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
-35
View File
@@ -1,35 +0,0 @@
name: Upload documentation to GitHub Pages
on:
push:
branches:
- master
# Sets permissions of `GITHUB_TOKEN` to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust toolchain
run: TARGET=x86_64-unknown-linux-gnu sh ./ci/install-rust.sh
- name: Generate documentation
run: LIBC_CI=1 sh ci/dox.sh
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'target/doc'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
-88
View File
@@ -1,88 +0,0 @@
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
docker_linux_tier1:
name: Docker Linux Tier1
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
target: [
i686-unknown-linux-gnu,
x86_64-unknown-linux-gnu,
]
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
- name: Execute run-docker.sh
run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }}
macos:
name: macOS
runs-on: macos-12
strategy:
fail-fast: true
matrix:
target: [
x86_64-apple-darwin,
]
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
- name: Execute run.sh
run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }}
windows:
name: Windows
runs-on: windows-2022
env:
OS: windows
strategy:
fail-fast: true
matrix:
include:
- target: x86_64-pc-windows-gnu
env:
ARCH_BITS: 64
ARCH: x86_64
- target: x86_64-pc-windows-msvc
# Disabled because broken:
# https://github.com/rust-lang/libc/issues/1592
#- target: i686-pc-windows-gnu
# env:
# ARCH_BITS: 32
# ARCH: i686
- target: i686-pc-windows-msvc
steps:
- uses: actions/checkout@v3
- name: Self-update rustup
run: rustup self update
shell: bash
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
shell: bash
- name: Execute run.sh
run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }}
shell: bash
style_check:
name: Style check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
run: sh ./ci/install-rust.sh
- name: Check style
run: sh ci/style.sh
+33
View File
@@ -0,0 +1,33 @@
# release-plz for the stable 0.2 branch
name: Release-plz v0.2
permissions:
pull-requests: write
contents: write
on:
push:
branches:
- libc-0.2
jobs:
release-plz:
name: Release-plz v0.2
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install Rust (rustup)
run: rustup update stable --no-self-update && rustup default stable
- name: Run release-plz
uses: MarcoIeni/release-plz-action@v0.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
# FIXME(release): release-pr is broken since we have two release tracks for
# `libc` :(
command: release
-2
View File
@@ -1,4 +1,2 @@
target
Cargo.lock
*~
style
+49
View File
@@ -0,0 +1,49 @@
[workspace]
git_release_name = "{{ version }}"
git_tag_name = "{{ version }}"
[changelog]
body = """
## [{{ version | trim_start_matches(pat="v") }}]\
{%- if release_link -%}\
({{ release_link }})\
{% endif %} \
- {{ timestamp | date(format="%Y-%m-%d") }}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.scope -%}{{ commit.scope | upper_first }}: {% endif %}
{%- if commit.breaking %}[**breaking**] {% endif %}
{{- commit.message }}
{%- if commit.links %} ([{{ commit.links.1.text }}]({{ commit.links.1.href }})){% endif -%}
{% endfor %}
{% endfor %}
{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
## New Contributors ❤️
{% endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
* @{{ contributor.username }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor -%}
{%- endif %}
"""
commit_parsers = [
{ message = '(?i)^(\w+: )?feat', group = "added" },
{ message = '(?i)^(\w+: )?add', group = "added" },
{ message = '(?i)^(\w+: )?change', group = "changed" },
{ message = '(?i)^(\w+: )?cleanup', group = "cleanup" },
{ message = '(?i)^(\w+: )?deprecate', group = "deprecated" },
{ message = '(?i)^(\w+: )?remove', group = "removed" },
{ message = '(?i)^(\w+: )?fix', group = "fixed" },
{ message = '(?i)^(\w+: )?fix', group = "fixed" },
{ message = '^.*', group = "other" },
]
link_parsers = [
# Extract backport patterns
{ pattern = '\(backport <.*/(\d+)>\)', text = "#$1", href = "https://github.com/rust-lang/libc/pull/$1"}
]
+6
View File
@@ -0,0 +1,6 @@
edition = "2021"
error_on_line_overflow = true
group_imports = "StdExternalCrate"
imports_granularity = "Module"
# This crate gets large lists of reexports. Use vertical to reduce conflicts.
imports_layout = "Vertical"
+2 -2
View File
@@ -20,8 +20,8 @@ ohos_cargo_crate("lib") {
output_name = "liblibc"
sources = [ "src/lib.rs" ]
edition = "2015"
cargo_pkg_version = "0.2.153"
edition = "2021"
cargo_pkg_version = "0.2.180"
cargo_pkg_authors = "The Rust Project Developers"
cargo_pkg_name = "libc"
features = [
+904
View File
@@ -0,0 +1,904 @@
# Changelog
## [0.2.180](https://github.com/rust-lang/libc/compare/0.2.179...0.2.180) - 2026-01-08
### Added
- QNX: Add missing BPF and ifreq structures ([#4769](https://github.com/rust-lang/libc/pull/4769))
### Fixed
- Linux, L4Re: address soundness issues of `CMSG_NXTHDR` ([#4903](https://github.com/rust-lang/libc/pull/4903))
- Linux-like: Handle zero-sized payload differences in `CMSG_NXTHDR` ([#4903](https://github.com/rust-lang/libc/pull/4903))
- Musl: Fix incorrect definitions of struct stat on some 32-bit architectures ([#4914](https://github.com/rust-lang/libc/pull/4914))
- NetBSD: RISC-V 64: Correct `mcontext` type definitions ([#4886](https://github.com/rust-lang/libc/pull/4886))
- uClibc: Re-enable `__SIZEOF_PTHREAD_COND_T` on non-L4Re uclibc ([#4915](https://github.com/rust-lang/libc/pull/4915))
- uClibc: Restructure Linux `netlink` module to resolve build errors ([#4915](https://github.com/rust-lang/libc/pull/4915))
## [0.2.179](https://github.com/rust-lang/libc/compare/0.2.178...0.2.179) - 2025-01-03
With this release, we now have _unstable_ support for 64-bit `time_t` on 32-bit
platforms with both Musl and Glibc. Testing is appreciated!
For now, these can be enabled by setting environment variables during build:
```text
RUST_LIBC_UNSTABLE_MUSL_V1_2_3=1
RUST_LIBC_UNSTABLE_GNU_TIME_BITS=64
```
Note that the exact configuration will change in the future. Setting the
`MUSL_V1_2_3` variable also enables some newer API unrelated to `time_t`.
### Added
- L4Re: Add uclibc aarch64 support ([#4479](https://github.com/rust-lang/libc/pull/4479))
- Linux, Android: Add a generic definition for `XCASE` ([#4847](https://github.com/rust-lang/libc/pull/4847))
- Linux-like: Add `NAME_MAX` ([#4888](https://github.com/rust-lang/libc/pull/4888))
- Linux: Add `AT_EXECVE_CHECK` ([#4422](https://github.com/rust-lang/libc/pull/4422))
- Linux: Add the `SUN_LEN` macro ([#4269](https://github.com/rust-lang/libc/pull/4269))
- Linux: add `getitimer` and `setitimer` ([#4890](https://github.com/rust-lang/libc/pull/4890))
- Linux: add `pthread_tryjoin_n` and `pthread_timedjoin_np` ([#4887](https://github.com/rust-lang/libc/pull/4887))
- Musl: Add unstable support for 64-bit `time_t` on 32-bit platforms ([#4463](https://github.com/rust-lang/libc/pull/4463))
- NetBSD, OpenBSD: Add interface `LINK_STATE_*` definitions from `sys/net/if.h` ([#4751](https://github.com/rust-lang/libc/pull/4751))
- QuRT: Add support for Qualcomm QuRT ([#4845](https://github.com/rust-lang/libc/pull/4845))
- Types: Add Padding<T>::uninit() ([#4862](https://github.com/rust-lang/libc/pull/4862))
### Fixed
- Glibc: Link old version of `cf{g,s}et{i,o}speed` ([#4882](https://github.com/rust-lang/libc/pull/4882))
- L4Re: Fixes for `pthread` ([#4479](https://github.com/rust-lang/libc/pull/4479))
- L4re: Fix a wide variety of incorrect definitions ([#4479](https://github.com/rust-lang/libc/pull/4479))
- Musl: Fix the value of `CPU_SETSIZE` on musl 1.2+ ([#4865](https://github.com/rust-lang/libc/pull/4865))
- Musl: RISC-V: fix public padding fields in `stat/stat64` ([#4463](https://github.com/rust-lang/libc/pull/4463))
- Musl: s390x: Fix definition of `SIGSTKSZ`/`MINSIGSTKSZ` ([#4884](https://github.com/rust-lang/libc/pull/4884))
- NetBSD: Arm: Fix `PT_{GET,SET}FPREGS`, `_REG_TIPDR`, and `_REG_{LR,SP}` ([#4899](https://github.com/rust-lang/libc/pull/4899))
- NetBSD: Fix `if_msghdr` alignment ([#4902](https://github.com/rust-lang/libc/pull/4902))
- NetBSD: Fix `siginfo_t` layout on 32-bit platforms ([#4904](https://github.com/rust-lang/libc/pull/4904))
- NetBSD: change definition of `pthread_spin_t` to allow arch redefinition. ([#4899](https://github.com/rust-lang/libc/pull/4899))
- Newlib: Fix ambiguous glob exports and other warnings for Vita and 3DS ([#4875](https://github.com/rust-lang/libc/pull/4875))
- QNX: Fix build error ([#4879](https://github.com/rust-lang/libc/pull/4879))
### Changed
- CI: Update CI images to FreeBSD 15.0-release ([#4857](https://github.com/rust-lang/libc/pull/4857))
- L4Re: Make `pthread` struct fields private ([#4876](https://github.com/rust-lang/libc/pull/4876))
- Linux, Fuchsia: Mark mq_attr padding area as such ([#4858](https://github.com/rust-lang/libc/pull/4858))
- Types: Wrap a number of private fields in the `Padding` type ([#4862](https://github.com/rust-lang/libc/pull/4862))
### Removed
- Build: Remove `RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64` ([#4865](https://github.com/rust-lang/libc/pull/4865))
- WASI: Remove nonexistent clocks ([#4880](https://github.com/rust-lang/libc/pull/4880))
## [0.2.178](https://github.com/rust-lang/libc/compare/0.2.177...0.2.178) - 2025-12-01
### Added
- BSD: Add `issetugid` ([#4744](https://github.com/rust-lang/libc/pull/4744))
- Cygwin: Add missing utmp/x.h, grp.h, and stdio.h interfaces ([#4827](https://github.com/rust-lang/libc/pull/4827))
- Linux s390x musl: Add `__psw_t`/`fprefset_t`/`*context_t` ([#4726](https://github.com/rust-lang/libc/pull/4726))
- Linux, Android: Add definition for IUCLC ([#4846](https://github.com/rust-lang/libc/pull/4846))
- Linux, FreeBSD: Add `AT_HWCAP{3,4}` ([#4734](https://github.com/rust-lang/libc/pull/4734))
- Linux: Add definitions from linux/can/bcm.h ([#4683](https://github.com/rust-lang/libc/pull/4683))
- Linux: Add syscalls 451-469 for m68k ([#4850](https://github.com/rust-lang/libc/pull/4850))
- Linux: PowerPC: Add 'ucontext.h' definitions ([#4696](https://github.com/rust-lang/libc/pull/4696))
- NetBSD: Define `eventfd` ([#4830](https://github.com/rust-lang/libc/pull/4830))
- Newlib: Add missing constants from `unistd.h` ([#4811](https://github.com/rust-lang/libc/pull/4811))
- QNX NTO: Add `cfmakeraw` ([#4704](https://github.com/rust-lang/libc/pull/4704))
- QNX NTO: Add `cfsetspeed` ([#4704](https://github.com/rust-lang/libc/pull/4704))
- Redox: Add `getresgid` and `getresuid` ([#4752](https://github.com/rust-lang/libc/pull/4752))
- Redox: Add `setresgid` and `setresuid` ([#4752](https://github.com/rust-lang/libc/pull/4752))
- VxWorks: Add definitions from `select.h`, `stat.h`, `poll.h`, `ttycom.h`, `utsname.h`, `resource.h`, `mman.h`, `udp.h`, `in.h`, `in6.h`, `if.h`, `fnmatch.h`, and `sioLibCommon.h` ([#4781](https://github.com/rust-lang/libc/pull/4781))
- VxWorks: Add missing defines/functions needed by rust stdlib ([#4779](https://github.com/rust-lang/libc/pull/4779))
- WASI: Add more definitions for libstd ([#4747](https://github.com/rust-lang/libc/pull/4747))
### Deprecated
- Apple: Deprecate `TIOCREMOTE` ([#4764](https://github.com/rust-lang/libc/pull/4764))
### Fixed
Note that there were a large number of fixes on NetBSD for this `libc` release, some of which include minor breakage.
- AIX: Change errno `EWOULDBLOCK` to make it an alias of `EAGAIN` ([#4790](https://github.com/rust-lang/libc/pull/4790))
- AIX: Resolve function comparison and `unnecessary_transmutes` warnings ([#4780](https://github.com/rust-lang/libc/pull/4780))
- Apple: Correct the value of `SF_SETTABLE` ([#4764](https://github.com/rust-lang/libc/pull/4764))
- DragonflyBSD: Fix the type of `mcontext_t.mc_fpregs` ([#]())
- EspIDF: Fix the duplicate definition of `gethostname` ([#4773](https://github.com/rust-lang/libc/pull/4773))
- L4Re: Update available pthread API ([#4836](https://github.com/rust-lang/libc/pull/4836))
- Linux: Correct the value of `NFT_MSG_MAX` ([#4761](https://github.com/rust-lang/libc/pull/4761))
- Linux: Remove incorrect `repr(align(8))` for `canxl_frame` ([#4760](https://github.com/rust-lang/libc/pull/4760))
- Make `eventfd` argument names match OS docs/headers ([#4830](https://github.com/rust-lang/libc/pull/4830))
- NetBSD: Account for upstream changes to ptrace with LWP ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Correct `ipc_perm`, split from OpenBSD as `ipc.rs` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Correct a number of symbol link names ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Correct the type of `kinfo_vmentry.kve_path` ([#]())
- NetBSD: Fix `uucred.cr_ngroups` from `int` to `short` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Fix the type of `kevent.udata` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Fix the type of `mcontext_t.__fpregs` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Fix the value of `PT_SUSPEND` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Fix the values of FNM_* constants ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Increase the size of `sockaddr_dl.sdl_data` from 12 to 24 ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `if_.rs`, fix the definition of `ifreq` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `time.rs`, fix the values of `CLOCK_*_CPUTIME_ID` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `timex.rs` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `types.rs`, correct the definition of `lwpid_t` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `utmp_.rs`, correct the definition of `lastlog` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `utmpx_.rs`, correct utmpx definitions ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Make `_cpuset` an extern type ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: RISC-V 64: Fix the `mcontext` types ([#4782](https://github.com/rust-lang/libc/pull/4782))
- Nuttx: Resolve warnings ([#4773](https://github.com/rust-lang/libc/pull/4773))
- OHOS: Don't emit duplicate lfs64 definitions ([#4804](https://github.com/rust-lang/libc/pull/4804))
- Redox: Fix the type of `pid_t` ([#4825](https://github.com/rust-lang/libc/pull/4825))
- WASI: Gate `__wasilibc_register_preopened_fd` ([#4837](https://github.com/rust-lang/libc/pull/4837))
- Wali: Fix unknown config ([#4773](https://github.com/rust-lang/libc/pull/4773))
### Changed
- AIX: Declare field 'tv_nsec' of structure 'timespec' as 'i32' in both 32-bit and 64-bit modes ([#4750](https://github.com/rust-lang/libc/pull/4750))
- DragonFly: Avoid usage of `thread_local` ([#3653](https://github.com/rust-lang/libc/pull/3653))
- Linux: Update the definition for `ucontext_t` and unskip its tests ([#4760](https://github.com/rust-lang/libc/pull/4760))
- MinGW: Set `L_tmpnam` and `TMP_MAX` to the UCRT value ([#4566](https://github.com/rust-lang/libc/pull/4566))
- WASI: More closely align pthread type reprs ([#4747](https://github.com/rust-lang/libc/pull/4747))
- Simplify rustc-check-cfg emission in build.rs ([#4724](https://github.com/rust-lang/libc/pull/4724))
- Transition a number of definitions to the new source structure (internal change)
### Removed
- MIPS Musl: Remove rogue definition of `SIGSTKFLT` ([#4749](https://github.com/rust-lang/libc/pull/4749))
- NetBSD: Make `statvfs.f_spare` non-public ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Remove BPF constants ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Remove `*_MAXID` constants and `AT_SUN_LDPGSIZE` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Remove `IFF_NOTRAILERS` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Remove `vm_size_t` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Replace REG_ENOSYS with REG_ILLSEQ ([#4782](https://github.com/rust-lang/libc/pull/4782))
## [0.2.177](https://github.com/rust-lang/libc/compare/0.2.176...0.2.177) - 2025-10-09
### Added
- Apple: Add `TIOCGETA`, `TIOCSETA`, `TIOCSETAW`, `TIOCSETAF` constants ([#4736](https://github.com/rust-lang/libc/pull/4736))
- Apple: Add `pthread_cond_timedwait_relative_np` ([#4719](https://github.com/rust-lang/libc/pull/4719))
- BSDs: Add `_CS_PATH` constant ([#4738](https://github.com/rust-lang/libc/pull/4738))
- Linux-like: Add `SIGEMT` for mips* and sparc* architectures ([#4730](https://github.com/rust-lang/libc/pull/4730))
- OpenBSD: Add `elf_aux_info` ([#4729](https://github.com/rust-lang/libc/pull/4729))
- Redox: Add more sysconf constants ([#4728](https://github.com/rust-lang/libc/pull/4728))
- Windows: Add `wcsnlen` ([#4721](https://github.com/rust-lang/libc/pull/4721))
### Changed
- WASIP2: Invert conditional to include p2 APIs ([#4733](https://github.com/rust-lang/libc/pull/4733))
## [0.2.176](https://github.com/rust-lang/libc/compare/0.2.175...0.2.176) - 2025-09-23
### Support
- The default FreeBSD version has been raised from 11 to 12. This matches `rustc` since 1.78. ([#2406](https://github.com/rust-lang/libc/pull/2406))
- `Debug` is now always implemented, rather than being gated behind the `extra_traits` feature. ([#4624](https://github.com/rust-lang/libc/pull/4624))
### Added
- AIX: Restore some non-POSIX functions guarded by the `_KERNEL` macro. ([#4607](https://github.com/rust-lang/libc/pull/4607))
- FreeBSD 14: Add `st_fileref` to `struct stat` ([#4642](https://github.com/rust-lang/libc/pull/4642))
- Haiku: Add the `accept4` POSIX call ([#4586](https://github.com/rust-lang/libc/pull/4586))
- Introduce a wrapper for representing padding ([#4632](https://github.com/rust-lang/libc/pull/4632))
- Linux: Add `EM_RISCV` ([#4659](https://github.com/rust-lang/libc/pull/4659))
- Linux: Add `MS_NOSYMFOLLOW` ([#4389](https://github.com/rust-lang/libc/pull/4389))
- Linux: Add `backtrace_symbols(_fd)` ([#4668](https://github.com/rust-lang/libc/pull/4668))
- Linux: Add missing `SOL_PACKET` optnames ([#4669](https://github.com/rust-lang/libc/pull/4669))
- Musl s390x: Add `SYS_mseal` ([#4549](https://github.com/rust-lang/libc/pull/4549))
- NuttX: Add `__errno` ([#4687](https://github.com/rust-lang/libc/pull/4687))
- Redox: Add `dirfd`, `VDISABLE`, and resource consts ([#4660](https://github.com/rust-lang/libc/pull/4660))
- Redox: Add more `resource.h`, `fcntl.h` constants ([#4666](https://github.com/rust-lang/libc/pull/4666))
- Redox: Enable `strftime` and `mkostemp[s]` ([#4629](https://github.com/rust-lang/libc/pull/4629))
- Unix, Windows: Add `qsort_r` (Unix), and `qsort(_s)` (Windows) ([#4677](https://github.com/rust-lang/libc/pull/4677))
- Unix: Add `dlvsym` for Linux-gnu, FreeBSD, and NetBSD ([#4671](https://github.com/rust-lang/libc/pull/4671))
- Unix: Add `sigqueue` ([#4620](https://github.com/rust-lang/libc/pull/4620))
### Changed
- FreeBSD 15: Mark `kinfo_proc` as non-exhaustive ([#4553](https://github.com/rust-lang/libc/pull/4553))
- FreeBSD: Set the ELF symbol version for `readdir_r` ([#4694](https://github.com/rust-lang/libc/pull/4694))
- Linux: Correct the config for whether or not `epoll_event` is packed ([#4639](https://github.com/rust-lang/libc/pull/4639))
- Tests: Replace the old `ctest` with the much more reliable new implementation ([#4655](https://github.com/rust-lang/libc/pull/4655) and many related PRs)
### Fixed
- AIX: Fix the type of the 4th arguement of `getgrnam_r` ([#4656](https://github.com/rust-lang/libc/pull/4656
- FreeBSD: Limit `P_IDLEPROC` to FreeBSD 15 ([#4640](https://github.com/rust-lang/libc/pull/4640))
- FreeBSD: Limit `mcontext_t::mc_tlsbase` to FreeBSD 15 ([#4640](https://github.com/rust-lang/libc/pull/464))
- FreeBSD: Update gating of `mcontext_t.mc_tlsbase` ([#4703](https://github.com/rust-lang/libc/pull/4703))
- Musl s390x: Correct the definition of `statfs[64]` ([#4549](https://github.com/rust-lang/libc/pull/4549))
- Musl s390x: Make `fpreg_t` a union ([#4549](https://github.com/rust-lang/libc/pull/4549))
- Redox: Fix the types of `gid_t` and `uid_t` ([#4689](https://github.com/rust-lang/libc/pull/4689))
- Redox: Fix the value of `MAP_FIXED` ([#4684](https://github.com/rust-lang/libc/pull/4684))
### Deprecated
- Apple: Correct the `deprecated` attribute for `iconv` ([`a97a0b53`](https://github.com/rust-lang/libc/commit/a97a0b53fb7faf5f99cd720ab12b1b8a5bf9f950))
- FreeBSD: Deprecate `TIOCMGDTRWAIT` and `TIOCMSDTRWAIT` ([#4685](https://github.com/rust-lang/libc/pull/4685))
### Removed
- FreeBSD: Remove `JAIL_{GET,SET}_MASK`, `_MC_FLAG_MASK` ([#4691](https://github.com/rust-lang/libc/pull/4691))
## [0.2.175](https://github.com/rust-lang/libc/compare/0.2.174...0.2.175) - 2025-08-10
### Added
- AIX: Add `getpeereid` ([#4524](https://github.com/rust-lang/libc/pull/4524))
- AIX: Add `struct ld_info` and friends ([#4578](https://github.com/rust-lang/libc/pull/4578))
- AIX: Retore `struct winsize` ([#4577](https://github.com/rust-lang/libc/pull/4577))
- Android: Add UDP socket option constants ([#4619](https://github.com/rust-lang/libc/pull/4619))
- Android: Add `CLONE_CLEAR_SIGHAND` and `CLONE_INTO_CGROUP` ([#4502](https://github.com/rust-lang/libc/pull/4502))
- Android: Add more `prctl` constants ([#4531](https://github.com/rust-lang/libc/pull/4531))
- FreeBSD Add further TCP stack-related constants ([#4196](https://github.com/rust-lang/libc/pull/4196))
- FreeBSD x86-64: Add `mcontext_t.mc_tlsbase ` ([#4503](https://github.com/rust-lang/libc/pull/4503))
- FreeBSD15: Add `kinfo_proc.ki_uerrmsg` ([#4552](https://github.com/rust-lang/libc/pull/4552))
- FreeBSD: Add `in_conninfo` ([#4482](https://github.com/rust-lang/libc/pull/4482))
- FreeBSD: Add `xinpgen` and related types ([#4482](https://github.com/rust-lang/libc/pull/4482))
- FreeBSD: Add `xktls_session` ([#4482](https://github.com/rust-lang/libc/pull/4482))
- Haiku: Add functionality from `libbsd` ([#4221](https://github.com/rust-lang/libc/pull/4221))
- Linux: Add `SECBIT_*` ([#4480](https://github.com/rust-lang/libc/pull/4480))
- NetBSD, OpenBSD: Export `ioctl` request generator macros ([#4460](https://github.com/rust-lang/libc/pull/4460))
- NetBSD: Add `ptsname_r` ([#4608](https://github.com/rust-lang/libc/pull/4608))
- RISCV32: Add time-related syscalls ([#4612](https://github.com/rust-lang/libc/pull/4612))
- Solarish: Add `strftime*` ([#4453](https://github.com/rust-lang/libc/pull/4453))
- linux: Add `EXEC_RESTRICT_*` and `EXEC_DENY_*` ([#4545](https://github.com/rust-lang/libc/pull/4545))
### Changed
- AIX: Add `const` to signatures to be consistent with other platforms ([#4563](https://github.com/rust-lang/libc/pull/4563))
### Fixed
- AIX: Fix the type of `struct statvfs.f_fsid` ([#4576](https://github.com/rust-lang/libc/pull/4576))
- AIX: Fix the type of constants for the `ioctl` `request` argument ([#4582](https://github.com/rust-lang/libc/pull/4582))
- AIX: Fix the types of `stat{,64}.st_*tim` ([#4597](https://github.com/rust-lang/libc/pull/4597))
- AIX: Use unique `errno` values ([#4507](https://github.com/rust-lang/libc/pull/4507))
- Build: Fix an incorrect `target_os` -> `target_arch` check ([#4550](https://github.com/rust-lang/libc/pull/4550))
- FreeBSD: Fix the type of `xktls_session_onedir.ifnet` ([#4552](https://github.com/rust-lang/libc/pull/4552))
- Mips64 musl: Fix the type of `nlink_t` ([#4509](https://github.com/rust-lang/libc/pull/4509))
- Mips64 musl: Use a special MIPS definition of `stack_t` ([#4528](https://github.com/rust-lang/libc/pull/4528))
- Mips64: Fix `SI_TIMER`, `SI_MESGQ` and `SI_ASYNCIO` definitions ([#4529](https://github.com/rust-lang/libc/pull/4529))
- Musl Mips64: Swap the order of `si_errno` and `si_code` in `siginfo_t` ([#4530](https://github.com/rust-lang/libc/pull/4530))
- Musl Mips64: Use a special MIPS definition of `statfs` ([#4527](https://github.com/rust-lang/libc/pull/4527))
- Musl: Fix the definition of `fanotify_event_metadata` ([#4510](https://github.com/rust-lang/libc/pull/4510))
- NetBSD: Correct `enum fae_action` to be `#[repr(C)]` ([#60a8cfd5](https://github.com/rust-lang/libc/commit/60a8cfd564f83164d45b9533ff7a0d7371878f2a))
- PSP: Correct `char` -> `c_char` ([eaab4fc3](https://github.com/rust-lang/libc/commit/eaab4fc3f05dc646a953d4fd5ba46dfa1f8bd6f6))
- PowerPC musl: Fix `termios` definitions ([#4518](https://github.com/rust-lang/libc/pull/4518))
- PowerPC musl: Fix the definition of `EDEADLK` ([#4517](https://github.com/rust-lang/libc/pull/4517))
- PowerPC musl: Fix the definition of `NCCS` ([#4513](https://github.com/rust-lang/libc/pull/4513))
- PowerPC musl: Fix the definitions of `MAP_LOCKED` and `MAP_NORESERVE` ([#4516](https://github.com/rust-lang/libc/pull/4516))
- PowerPC64 musl: Fix the definition of `shmid_ds` ([#4519](https://github.com/rust-lang/libc/pull/4519))
### Deprecated
- Linux: `MAP_32BIT` is only defined on x86 on non-x86 architectures ([#4511](https://github.com/rust-lang/libc/pull/4511))
### Removed
- AIX: Remove duplicate constant definitions `FIND` and `ENTER` ([#4588](https://github.com/rust-lang/libc/pull/4588))
- s390x musl: Remove `O_FSYNC` ([#4515](https://github.com/rust-lang/libc/pull/4515))
- s390x musl: Remove `RTLD_DEEPBIND` ([#4515](https://github.com/rust-lang/libc/pull/4515))
## [0.2.174](https://github.com/rust-lang/libc/compare/0.2.173...0.2.174) - 2025-06-17
### Added
- Linux: Make `pidfd_info` fields pub ([#4487](https://github.com/rust-lang/libc/pull/4487))
### Fixed
- Gnu x32: Add missing `timespec.tv_nsec` ([#4497](https://github.com/rust-lang/libc/pull/4497))
- NuttX: Use `nlink_t` type for `st_nlink` in `struct stat` definition ([#4483](https://github.com/rust-lang/libc/pull/4483))
### Other
- Allow new `unpredictable_function_pointer_comparisons` lints ([#4489](https://github.com/rust-lang/libc/pull/4489))
- OpenBSD: Fix some clippy warnings to use `pointer::cast`. ([#4490](https://github.com/rust-lang/libc/pull/4490))
- Remove unessecary semicolons from definitions of `CMSG_NXTHDR`. ([#4492](https://github.com/rust-lang/libc/pull/4492))
## [0.2.173](https://github.com/rust-lang/libc/compare/0.2.172...0.2.173) - 2025-06-09
### Added
- AIX: Add an AIX triple to Cargo.toml for doc ([#4475](https://github.com/rust-lang/libc/pull/4475))
- FreeBSD: Add the `SO_SPLICE` socket option support for FreeBSD >= 14.2 ([#4451](https://github.com/rust-lang/libc/pull/4451))
- Linux GNU: Prepare for supporting `_TIME_BITS=64` ([#4433](https://github.com/rust-lang/libc/pull/4433))
- Linux: Add constant PACKET_IGNORE_OUTGOING ([#4319](https://github.com/rust-lang/libc/pull/4319))
- Linux: Add constants and types for `nsfs` ioctls ([#4436](https://github.com/rust-lang/libc/pull/4436))
- Linux: Add constants for Memory-Deny-Write-Execute `prctls` ([#4400](https://github.com/rust-lang/libc/pull/4400))
- Linux: Add constants from `linux/cn_proc.h` and `linux/connector.h` ([#4434](https://github.com/rust-lang/libc/pull/4434))
- Linux: Add new flags for `pwritev2` and `preadv2` ([#4452](https://github.com/rust-lang/libc/pull/4452))
- Linux: Add pid_type enum values ([#4403](https://github.com/rust-lang/libc/pull/4403))
- Linux: Update pidfd constants and types (Linux 6.9-6.15) ([#4402](https://github.com/rust-lang/libc/pull/4402))
- Loongarch64 musl: Define the `MADV_SOFT_OFFLINE` constant ([#4448](https://github.com/rust-lang/libc/pull/4448))
- Musl: Add new fields since 1.2.0/1.2.2 to `struct tcp_info` ([#4443](https://github.com/rust-lang/libc/pull/4443))
- Musl: Prepare for supporting v1.2.3 ([#4443](https://github.com/rust-lang/libc/pull/4443))
- NuttX: Add `arc4random` and `arc4random_buf` ([#4464](https://github.com/rust-lang/libc/pull/4464))
- RISC-V Musl: Add `MADV_SOFT_OFFLINE` definition ([#4447](https://github.com/rust-lang/libc/pull/4447))
- Redox: Define SCM_RIGHTS ([#4440](https://github.com/rust-lang/libc/pull/4440))
- VxWorks: Add missing UTIME defines and TASK_RENAME_LENGTH ([#4407](https://github.com/rust-lang/libc/pull/4407))
- Windows: Add more `time.h` functions ([#4427](https://github.com/rust-lang/libc/pull/4427))
### Changed
- Redox: Update `SA_` constants. ([#4426](https://github.com/rust-lang/libc/pull/4426))
- Redox: make `CMSG_ALIGN`, `CMSG_LEN`, and `CMSG_SPACE` const functions ([#4441](https://github.com/rust-lang/libc/pull/4441))
### Fixed
- AIX: Enable libc-test and fix definitions/declarations. ([#4450](https://github.com/rust-lang/libc/pull/4450))
- Emscripten: Fix querying emcc on windows (use emcc.bat) ([#4248](https://github.com/rust-lang/libc/pull/4248))
- Hurd: Fix build from missing `fpos_t` ([#4472](https://github.com/rust-lang/libc/pull/4472))
- Loongarch64 Musl: Fix the `struct ipc_perm` bindings ([#4384](https://github.com/rust-lang/libc/pull/4384))
- Musl: Fix the `O_LARGEFILE` constant value. ([#4443](https://github.com/rust-lang/libc/pull/4443))
## [0.2.172](https://github.com/rust-lang/libc/compare/0.2.171...0.2.172) - 2025-04-14
### Added
- Android: Add `getauxval` for 32-bit targets ([#4338](https://github.com/rust-lang/libc/pull/4338))
- Android: Add `if_tun.h` ioctls ([#4379](https://github.com/rust-lang/libc/pull/4379))
- Android: Define `SO_BINDTOIFINDEX` ([#4391](https://github.com/rust-lang/libc/pull/4391))
- Cygwin: Add `posix_spawn_file_actions_add[f]chdir[_np]` ([#4387](https://github.com/rust-lang/libc/pull/4387))
- Cygwin: Add new socket options ([#4350](https://github.com/rust-lang/libc/pull/4350))
- Cygwin: Add statfs & fcntl ([#4321](https://github.com/rust-lang/libc/pull/4321))
- FreeBSD: Add `filedesc` and `fdescenttbl` ([#4327](https://github.com/rust-lang/libc/pull/4327))
- Glibc: Add unstable support for _FILE_OFFSET_BITS=64 ([#4345](https://github.com/rust-lang/libc/pull/4345))
- Hermit: Add `AF_UNSPEC` ([#4344](https://github.com/rust-lang/libc/pull/4344))
- Hermit: Add `AF_VSOCK` ([#4344](https://github.com/rust-lang/libc/pull/4344))
- Illumos, NetBSD: Add `timerfd` APIs ([#4333](https://github.com/rust-lang/libc/pull/4333))
- Linux: Add `_IO`, `_IOW`, `_IOR`, `_IOWR` to the exported API ([#4325](https://github.com/rust-lang/libc/pull/4325))
- Linux: Add `tcp_info` to uClibc bindings ([#4347](https://github.com/rust-lang/libc/pull/4347))
- Linux: Add further BPF program flags ([#4356](https://github.com/rust-lang/libc/pull/4356))
- Linux: Add missing INPUT_PROP_XXX flags from `input-event-codes.h` ([#4326](https://github.com/rust-lang/libc/pull/4326))
- Linux: Add missing TLS bindings ([#4296](https://github.com/rust-lang/libc/pull/4296))
- Linux: Add more constants from `seccomp.h` ([#4330](https://github.com/rust-lang/libc/pull/4330))
- Linux: Add more glibc `ptrace_sud_config` and related `PTRACE_*ET_SYSCALL_USER_DISPATCH_CONFIG`. ([#4386](https://github.com/rust-lang/libc/pull/4386))
- Linux: Add new netlink flags ([#4288](https://github.com/rust-lang/libc/pull/4288))
- Linux: Define ioctl codes on more architectures ([#4382](https://github.com/rust-lang/libc/pull/4382))
- Linux: Add missing `pthread_attr_setstack` ([#4349](https://github.com/rust-lang/libc/pull/4349))
- Musl: Add missing `utmpx` API ([#4332](https://github.com/rust-lang/libc/pull/4332))
- Musl: Enable `getrandom` on all platforms ([#4346](https://github.com/rust-lang/libc/pull/4346))
- NuttX: Add more signal constants ([#4353](https://github.com/rust-lang/libc/pull/4353))
- QNX: Add QNX 7.1-iosock and 8.0 to list of additional cfgs ([#4169](https://github.com/rust-lang/libc/pull/4169))
- QNX: Add support for alternative Neutrino network stack `io-sock` ([#4169](https://github.com/rust-lang/libc/pull/4169))
- Redox: Add more `sys/socket.h` and `sys/uio.h` definitions ([#4388](https://github.com/rust-lang/libc/pull/4388))
- Solaris: Temporarily define `O_DIRECT` and `SIGINFO` ([#4348](https://github.com/rust-lang/libc/pull/4348))
- Solarish: Add `secure_getenv` ([#4342](https://github.com/rust-lang/libc/pull/4342))
- VxWorks: Add missing `d_type` member to `dirent` ([#4352](https://github.com/rust-lang/libc/pull/4352))
- VxWorks: Add missing signal-related constsants ([#4352](https://github.com/rust-lang/libc/pull/4352))
- VxWorks: Add more error codes ([#4337](https://github.com/rust-lang/libc/pull/4337))
### Deprecated
- FreeBSD: Deprecate `TCP_PCAP_OUT` and `TCP_PCAP_IN` ([#4381](https://github.com/rust-lang/libc/pull/4381))
### Fixed
- Cygwin: Fix member types of `statfs` ([#4324](https://github.com/rust-lang/libc/pull/4324))
- Cygwin: Fix tests ([#4357](https://github.com/rust-lang/libc/pull/4357))
- Hermit: Make `AF_INET = 3` ([#4344](https://github.com/rust-lang/libc/pull/4344))
- Musl: Fix the syscall table on RISC-V-32 ([#4335](https://github.com/rust-lang/libc/pull/4335))
- Musl: Fix the value of `SA_ONSTACK` on RISC-V-32 ([#4335](https://github.com/rust-lang/libc/pull/4335))
- VxWorks: Fix a typo in the `waitpid` parameter name ([#4334](https://github.com/rust-lang/libc/pull/4334))
### Removed
- Musl: Remove `O_FSYNC` on RISC-V-32 (use `O_SYNC` instead) ([#4335](https://github.com/rust-lang/libc/pull/4335))
- Musl: Remove `RTLD_DEEPBIND` on RISC-V-32 ([#4335](https://github.com/rust-lang/libc/pull/4335))
### Other
- CI: Add matrix env variables to the environment ([#4345](https://github.com/rust-lang/libc/pull/4345))
- CI: Always deny warnings ([#4363](https://github.com/rust-lang/libc/pull/4363))
- CI: Always upload successfully created artifacts ([#4345](https://github.com/rust-lang/libc/pull/4345))
- CI: Install musl from source for loongarch64 ([#4320](https://github.com/rust-lang/libc/pull/4320))
- CI: Revert "Also skip `MFD_EXEC` and `MFD_NOEXEC_SEAL` on sparc64" ([#]())
- CI: Use `$PWD` instead of `$(pwd)` in run-docker ([#4345](https://github.com/rust-lang/libc/pull/4345))
- Solarish: Restrict `openpty` and `forkpty` polyfills to Illumos, replace Solaris implementation with bindings ([#4329](https://github.com/rust-lang/libc/pull/4329))
- Testing: Ensure the makedev test does not emit unused errors ([#4363](https://github.com/rust-lang/libc/pull/4363))
## [0.2.171](https://github.com/rust-lang/libc/compare/0.2.170...0.2.171) - 2025-03-11
### Added
- Android: Add `if_nameindex`/`if_freenameindex` support ([#4247](https://github.com/rust-lang/libc/pull/4247))
- Apple: Add missing proc types and constants ([#4310](https://github.com/rust-lang/libc/pull/4310))
- BSD: Add `devname` ([#4285](https://github.com/rust-lang/libc/pull/4285))
- Cygwin: Add PTY and group API ([#4309](https://github.com/rust-lang/libc/pull/4309))
- Cygwin: Add support ([#4279](https://github.com/rust-lang/libc/pull/4279))
- FreeBSD: Make `spawn.h` interfaces available on all FreeBSD-like systems ([#4294](https://github.com/rust-lang/libc/pull/4294))
- Linux: Add `AF_XDP` structs for all Linux environments ([#4163](https://github.com/rust-lang/libc/pull/4163))
- Linux: Add SysV semaphore constants ([#4286](https://github.com/rust-lang/libc/pull/4286))
- Linux: Add `F_SEAL_EXEC` ([#4316](https://github.com/rust-lang/libc/pull/4316))
- Linux: Add `SO_PREFER_BUSY_POLL` and `SO_BUSY_POLL_BUDGET` ([#3917](https://github.com/rust-lang/libc/pull/3917))
- Linux: Add `devmem` structs ([#4299](https://github.com/rust-lang/libc/pull/4299))
- Linux: Add socket constants up to `SO_DEVMEM_DONTNEED` ([#4299](https://github.com/rust-lang/libc/pull/4299))
- NetBSD, OpenBSD, DragonflyBSD: Add `closefrom` ([#4290](https://github.com/rust-lang/libc/pull/4290))
- NuttX: Add `pw_passwd` field to `passwd` ([#4222](https://github.com/rust-lang/libc/pull/4222))
- Solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF` ([#4287](https://github.com/rust-lang/libc/pull/4287))
- Wali: Add bindings for `wasm32-wali-linux-musl` target ([#4244](https://github.com/rust-lang/libc/pull/4244))
### Changed
- AIX: Use `sa_sigaction` instead of a union ([#4250](https://github.com/rust-lang/libc/pull/4250))
- Make `msqid_ds.__msg_cbytes` public ([#4301](https://github.com/rust-lang/libc/pull/4301))
- Unix: Make all `major`, `minor`, `makedev` into `const fn` ([#4208](https://github.com/rust-lang/libc/pull/4208))
### Deprecated
- Linux: Deprecate obsolete packet filter interfaces ([#4267](https://github.com/rust-lang/libc/pull/4267))
### Fixed
- Cygwin: Fix strerror_r ([#4308](https://github.com/rust-lang/libc/pull/4308))
- Cygwin: Fix usage of f! ([#4308](https://github.com/rust-lang/libc/pull/4308))
- Hermit: Make `stat::st_size` signed ([#4298](https://github.com/rust-lang/libc/pull/4298))
- Linux: Correct values for `SI_TIMER`, `SI_MESGQ`, `SI_ASYNCIO` ([#4292](https://github.com/rust-lang/libc/pull/4292))
- NuttX: Update `tm_zone` and `d_name` fields to use `c_char` type ([#4222](https://github.com/rust-lang/libc/pull/4222))
- Xous: Include the prelude to define `c_int` ([#4304](https://github.com/rust-lang/libc/pull/4304))
### Other
- Add labels to FIXMEs ([#4231](https://github.com/rust-lang/libc/pull/4231), [#4232](https://github.com/rust-lang/libc/pull/4232), [#4234](https://github.com/rust-lang/libc/pull/4234), [#4235](https://github.com/rust-lang/libc/pull/4235), [#4236](https://github.com/rust-lang/libc/pull/4236))
- CI: Fix "cannot find libc" error on Sparc64 ([#4317](https://github.com/rust-lang/libc/pull/4317))
- CI: Fix "cannot find libc" error on s390x ([#4317](https://github.com/rust-lang/libc/pull/4317))
- CI: Pass `--no-self-update` to `rustup update` ([#4306](https://github.com/rust-lang/libc/pull/4306))
- CI: Remove tests for the `i586-pc-windows-msvc` target ([#4311](https://github.com/rust-lang/libc/pull/4311))
- CI: Remove the `check_cfg` job ([#4322](https://github.com/rust-lang/libc/pull/4312))
- Change the range syntax that is giving `ctest` problems ([#4311](https://github.com/rust-lang/libc/pull/4311))
- Linux: Split out the stat struct for gnu/b32/mips ([#4276](https://github.com/rust-lang/libc/pull/4276))
### Removed
- NuttX: Remove `pthread_set_name_np` ([#4251](https://github.com/rust-lang/libc/pull/4251))
## [0.2.170](https://github.com/rust-lang/libc/compare/0.2.169...0.2.170) - 2025-02-23
### Added
- Android: Declare `setdomainname` and `getdomainname` <https://github.com/rust-lang/libc/pull/4212>
- FreeBSD: Add `evdev` structures <https://github.com/rust-lang/libc/pull/3756>
- FreeBSD: Add the new `st_filerev` field to `stat32` ([#4254](https://github.com/rust-lang/libc/pull/4254))
- Linux: Add `SI_*`` and `TRAP_*`` signal codes <https://github.com/rust-lang/libc/pull/4225>
- Linux: Add experimental configuration to enable 64-bit time in kernel APIs, set by `RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64`. <https://github.com/rust-lang/libc/pull/4148>
- Linux: Add recent socket timestamping flags <https://github.com/rust-lang/libc/pull/4273>
- Linux: Added new CANFD_FDF flag for the flags field of canfd_frame <https://github.com/rust-lang/libc/pull/4223>
- Musl: add CLONE_NEWTIME <https://github.com/rust-lang/libc/pull/4226>
- Solarish: add the posix_spawn family of functions <https://github.com/rust-lang/libc/pull/4259>
### Deprecated
- Linux: deprecate kernel modules syscalls <https://github.com/rust-lang/libc/pull/4228>
### Changed
- Emscripten: Assume version is at least 3.1.42 <https://github.com/rust-lang/libc/pull/4243>
### Fixed
- BSD: Correct the definition of `WEXITSTATUS` <https://github.com/rust-lang/libc/pull/4213>
- Hurd: Fix CMSG_DATA on 64bit systems ([#4240](https://github.com/rust-lang/libc/pull/424))
- NetBSD: fix `getmntinfo` ([#4265](https://github.com/rust-lang/libc/pull/4265)
- VxWorks: Fix the size of `time_t` <https://github.com/rust-lang/libc/pull/426>
### Other
- Add labels to FIXMEs <https://github.com/rust-lang/libc/pull/4230>, <https://github.com/rust-lang/libc/pull/4229>, <https://github.com/rust-lang/libc/pull/4237>
- CI: Bump FreeBSD CI to 13.4 and 14.2 <https://github.com/rust-lang/libc/pull/4260>
- Copy definitions from core::ffi and centralize them <https://github.com/rust-lang/libc/pull/4256>
- Define c_char at top-level and remove per-target c_char definitions <https://github.com/rust-lang/libc/pull/4202>
- Port style.rs to syn and add tests for the style checker <https://github.com/rust-lang/libc/pull/4220>
## [0.2.169](https://github.com/rust-lang/libc/compare/0.2.168...0.2.169) - 2024-12-18
### Added
- FreeBSD: add more socket TCP stack constants <https://github.com/rust-lang/libc/pull/4193>
- Fuchsia: add a `sockaddr_vm` definition <https://github.com/rust-lang/libc/pull/4194>
### Fixed
**Breaking**: [rust-lang/rust#132975](https://github.com/rust-lang/rust/pull/132975) corrected the signedness of `core::ffi::c_char` on various Tier 2 and Tier 3 platforms (mostly Arm and RISC-V) to match Clang. This release contains the corresponding changes to `libc`, including the following specific pull requests:
- ESP-IDF: Replace arch-conditional `c_char` with a reexport <https://github.com/rust-lang/libc/pull/4195>
- Fix `c_char` on various targets <https://github.com/rust-lang/libc/pull/4199>
- Mirror `c_char` configuration from `rust-lang/rust` <https://github.com/rust-lang/libc/pull/4198>
### Cleanup
- Do not re-export `c_void` in target-specific code <https://github.com/rust-lang/libc/pull/4200>
## [0.2.168](https://github.com/rust-lang/libc/compare/0.2.167...0.2.168) - 2024-12-09
### Added
- Linux: Add new process flags ([#4174](https://github.com/rust-lang/libc/pull/4174))
- Linux: Make `IFA_*` constants available on all Linux targets <https://github.com/rust-lang/libc/pull/4185>
- Linux: add `MAP_DROPPABLE` <https://github.com/rust-lang/libc/pull/4173>
- Solaris, Illumos: add `SIGRTMIN` and `SIGRTMAX` <https://github.com/rust-lang/libc/pull/4171>
- Unix, Linux: adding POSIX `memccpy` and `mempcpy` GNU extension <https://github.com/rust-lang/libc/pull/4186.
### Deprecated
- FreeBSD: Deprecate the CAP_UNUSED* and CAP_ALL* constants ([#4183](https://github.com/rust-lang/libc/pull/4183))
### Fixed
- Make the `Debug` implementation for unions opaque ([#4176](https://github.com/rust-lang/libc/pull/4176))
### Other
- Allow the `unpredictable_function_pointer_comparisons` lint where needed <https://github.com/rust-lang/libc/pull/4177>
- CI: Upload artifacts created by libc-test <https://github.com/rust-lang/libc/pull/4180>
- CI: Use workflow commands to group output by target <https://github.com/rust-lang/libc/pull/4179>
- CI: add caching <https://github.com/rust-lang/libc/pull/4183>
## [0.2.167](https://github.com/rust-lang/libc/compare/0.2.166...0.2.167) - 2024-11-28
### Added
- Solarish: add `st_fstype` to `stat` <https://github.com/rust-lang/libc/pull/4145>
- Trusty: Add `intptr_t` and `uintptr_t` ([#4161](https://github.com/rust-lang/libc/pull/4161))
### Fixed
- Fix the build with `rustc-dep-of-std` <https://github.com/rust-lang/libc/pull/4158>
- Wasi: Add back unsafe block for `clockid_t` static variables ([#4157](https://github.com/rust-lang/libc/pull/4157))
### Cleanup
- Create an internal prelude <https://github.com/rust-lang/libc/pull/4161>
- Fix `unused_qualifications`<https://github.com/rust-lang/libc/pull/4132>
### Other
- CI: Check various FreeBSD versions ([#4159](https://github.com/rust-lang/libc/pull/4159))
- CI: add a timeout for all jobs <https://github.com/rust-lang/libc/pull/4164>
- CI: verify MSRV for `wasm32-wasi` <https://github.com/rust-lang/libc/pull/4157>
- Migrate to the 2021 edition <https://github.com/rust-lang/libc/pull/4132>
### Removed
- Remove one unused import after the edition 2021 bump
## [0.2.166](https://github.com/rust-lang/libc/compare/0.2.165...0.2.166) - 2024-11-26
### Fixed
This release resolves two cases of unintentional breakage from the previous release:
- Revert removal of array size hacks [#4150](https://github.com/rust-lang/libc/pull/4150)
- Ensure `const extern` functions are always enabled [#4151](https://github.com/rust-lang/libc/pull/4151)
## [0.2.165](https://github.com/rust-lang/libc/compare/0.2.164...0.2.165) - 2024-11-25
### Added
- Android: add `mkostemp`, `mkostemps` <https://github.com/rust-lang/libc/pull/3601>
- Android: add a few API 30 calls <https://github.com/rust-lang/libc/pull/3604>
- Android: add missing syscall constants <https://github.com/rust-lang/libc/pull/3558>
- Apple: add `in6_ifreq` <https://github.com/rust-lang/libc/pull/3617>
- Apple: add missing `sysctl` net types <https://github.com/rust-lang/libc/pull/4022> (before release: remove `if_family_id` ([#4137](https://github.com/rust-lang/libc/pulls/4137)))
- Freebsd: add `kcmp` call support <https://github.com/rust-lang/libc/pull/3746>
- Hurd: add `MAP_32BIT` and `MAP_EXCL` <https://github.com/rust-lang/libc/pull/4127>
- Hurd: add `domainname` field to `utsname` ([#4089](https://github.com/rust-lang/libc/pulls/4089))
- Linux GNU: add `f_flags` to struct `statfs` for arm, mips, powerpc and x86 <https://github.com/rust-lang/libc/pull/3663>
- Linux GNU: add `malloc_stats` <https://github.com/rust-lang/libc/pull/3596>
- Linux: add ELF relocation-related structs <https://github.com/rust-lang/libc/pull/3583>
- Linux: add `ptp_*` structs <https://github.com/rust-lang/libc/pull/4113>
- Linux: add `ptp_clock_caps` <https://github.com/rust-lang/libc/pull/4128>
- Linux: add `ptp_pin_function` and most `PTP_` constants <https://github.com/rust-lang/libc/pull/4114>
- Linux: add missing AF_XDP structs & constants <https://github.com/rust-lang/libc/pull/3956>
- Linux: add missing netfilter consts ([#3734](https://github.com/rust-lang/libc/pulls/3734))
- Linux: add struct and constants for the `mount_setattr` syscall <https://github.com/rust-lang/libc/pull/4046>
- Linux: add wireless API <https://github.com/rust-lang/libc/pull/3441>
- Linux: expose the `len8_dlc` field of `can_frame` <https://github.com/rust-lang/libc/pull/3357>
- Musl: add `utmpx` API <https://github.com/rust-lang/libc/pull/3213>
- Musl: add missing syscall constants <https://github.com/rust-lang/libc/pull/4028>
- NetBSD: add `mcontext`-related data for RISCV64 <https://github.com/rust-lang/libc/pull/3468>
- Redox: add new `netinet` constants <https://github.com/rust-lang/libc/pull/3586>)
- Solarish: add `_POSIX_VDISABLE` ([#4103](https://github.com/rust-lang/libc/pulls/4103))
- Tests: Add a test that the `const extern fn` macro works <https://github.com/rust-lang/libc/pull/4134>
- Tests: Add test of primitive types against `std` <https://github.com/rust-lang/libc/pull/3616>
- Unix: Add `htonl`, `htons`, `ntohl`, `ntohs` <https://github.com/rust-lang/libc/pull/3669>
- Unix: add `aligned_alloc` <https://github.com/rust-lang/libc/pull/3843>
- Windows: add `aligned_realloc` <https://github.com/rust-lang/libc/pull/3592>
### Fixed
- **breaking** Hurd: fix `MAP_HASSEMAPHORE` name ([#4127](https://github.com/rust-lang/libc/pulls/4127))
- **breaking** ulibc Mips: fix `SA_*` mismatched types ([#3211](https://github.com/rust-lang/libc/pulls/3211))
- Aix: fix an enum FFI safety warning <https://github.com/rust-lang/libc/pull/3644>
- Haiku: fix some typos ([#3664](https://github.com/rust-lang/libc/pulls/3664))
- Tests: fix `Elf{32,64}_Relr`-related tests <https://github.com/rust-lang/libc/pull/3647>
- Tests: fix libc-tests for `loongarch64-linux-musl`
- Tests: fix some clippy warnings <https://github.com/rust-lang/libc/pull/3855>
- Tests: fix tests on `riscv64gc-unknown-freebsd` <https://github.com/rust-lang/libc/pull/4129>
### Deprecated
- Apple: deprecate `iconv_open` <https://github.com/rust-lang/libc/commit/25e022a22eca3634166ef472b748c297e60fcf7f>
- Apple: deprecate `mach_task_self` <https://github.com/rust-lang/libc/pull/4095>
- Apple: update `mach` deprecation notices for things that were removed in `main` <https://github.com/rust-lang/libc/pull/4097>
### Cleanup
- Adjust the `f!` macro to be more flexible <https://github.com/rust-lang/libc/pull/4107>
- Aix: remove duplicate constants <https://github.com/rust-lang/libc/pull/3643>
- CI: make scripts more uniform <https://github.com/rust-lang/libc/pull/4042>
- Drop the `libc_align` conditional <https://github.com/rust-lang/libc/commit/b5b553d0ee7de0d4781432a9a9a0a6445dd7f34f>
- Drop the `libc_cfg_target_vendor` conditional <https://github.com/rust-lang/libc/pull/4060>
- Drop the `libc_const_size_of` conditional <https://github.com/rust-lang/libc/commit/5a43dd2754366f99b3a83881b30246ce0e51833c>
- Drop the `libc_core_cvoid` conditional <https://github.com/rust-lang/libc/pull/4060>
- Drop the `libc_int128` conditional <https://github.com/rust-lang/libc/pull/4060>
- Drop the `libc_non_exhaustive` conditional <https://github.com/rust-lang/libc/pull/4060>
- Drop the `libc_packedN` conditional <https://github.com/rust-lang/libc/pull/4060>
- Drop the `libc_priv_mod_use` conditional <https://github.com/rust-lang/libc/commit/19c59376d11b015009fb9b04f233a30a1bf50a91>
- Drop the `libc_union` conditional <https://github.com/rust-lang/libc/commit/b9e4d8012f612dfe24147da3e69522763f92b6e3>
- Drop the `long_array` conditional <https://github.com/rust-lang/libc/pull/4096>
- Drop the `ptr_addr_of` conditional <https://github.com/rust-lang/libc/pull/4065>
- Drop warnings about deprecated cargo features <https://github.com/rust-lang/libc/pull/4060>
- Eliminate uses of `struct_formatter` <https://github.com/rust-lang/libc/pull/4074>
- Fix a few other array size hacks <https://github.com/rust-lang/libc/commit/d63be8b69b0736753213f5d933767866a5801ee7>
- Glibc: remove redundant definitions ([#3261](https://github.com/rust-lang/libc/pulls/3261))
- Musl: remove redundant definitions ([#3261](https://github.com/rust-lang/libc/pulls/3261))
- Musl: unify definitions of `siginfo_t` ([#3261](https://github.com/rust-lang/libc/pulls/3261))
- Musl: unify definitions of statfs and statfs64 ([#3261](https://github.com/rust-lang/libc/pulls/3261))
- Musl: unify definitions of statvfs and statvfs64 ([#3261](https://github.com/rust-lang/libc/pulls/3261))
- Musl: unify statx definitions ([#3978](https://github.com/rust-lang/libc/pulls/3978))
- Remove array size hacks for Rust < 1.47 <https://github.com/rust-lang/libc/commit/27ee6fe02ca0848b2af3cd747536264e4c7b697d>
- Remove repetitive words <https://github.com/rust-lang/libc/commit/77de375891285e18a81616f7dceda6d52732eed6>
- Use #[derive] for Copy/Clone in s! and friends <https://github.com/rust-lang/libc/pull/4038>
- Use some tricks to format macro bodies <https://github.com/rust-lang/libc/pull/4107>
### Other
- Apply formatting to macro bodies <https://github.com/rust-lang/libc/pull/4107>
- Bump libc-test to Rust 2021 Edition <https://github.com/rust-lang/libc/pull/3905>
- CI: Add a check that semver files don't contain duplicate entries <https://github.com/rust-lang/libc/pull/4087>
- CI: Add `fanotify_event_info_fid` to FAM-exempt types <https://github.com/rust-lang/libc/pull/4038>
- CI: Allow rustfmt to organize imports ([#4136](https://github.com/rust-lang/libc/pulls/4136))
- CI: Always run rustfmt <https://github.com/rust-lang/libc/pull/4120>
- CI: Change 32-bit Docker images to use EOL repos <https://github.com/rust-lang/libc/pull/4120>
- CI: Change 64-bit Docker images to ubuntu:24.10 <https://github.com/rust-lang/libc/pull/4120>
- CI: Disable the check for >1 s! invocation <https://github.com/rust-lang/libc/pull/4107>
- CI: Ensure build channels get run even if FILTER is unset <https://github.com/rust-lang/libc/pull/4125>
- CI: Ensure there is a fallback for no_std <https://github.com/rust-lang/libc/pull/4125>
- CI: Fix cases where unset variables cause errors <https://github.com/rust-lang/libc/pull/4108>
- CI: Naming adjustments and cleanup <https://github.com/rust-lang/libc/pull/4124>
- CI: Only invoke rustup if running in CI <https://github.com/rust-lang/libc/pull/4107>
- CI: Remove the logic to handle old rust versions <https://github.com/rust-lang/libc/pull/4068>
- CI: Set -u (error on unset) in all script files <https://github.com/rust-lang/libc/pull/4108>
- CI: add support for `loongarch64-unknown-linux-musl` <https://github.com/rust-lang/libc/pull/4092>
- CI: make `aarch64-apple-darwin` not a nightly-only target <https://github.com/rust-lang/libc/pull/4068>
- CI: run shellcheck on all scripts <https://github.com/rust-lang/libc/pull/4042>
- CI: update musl headers to Linux 6.6 <https://github.com/rust-lang/libc/pull/3921>
- CI: use qemu-sparc64 to run sparc64 tests <https://github.com/rust-lang/libc/pull/4133>
- Drop the `libc_const_extern_fn` conditional <https://github.com/rust-lang/libc/commit/674cc1f47f605038ef1aa2cce8e8bc9dac128276>
- Drop the `libc_underscore_const_names` conditional <https://github.com/rust-lang/libc/commit/f0febd5e2e50b38e05259d3afad3c9783711bcf0>
- Explicitly set the edition to 2015 <https://github.com/rust-lang/libc/pull/4058>
- Introduce a `git-blame-ignore-revs` file <https://github.com/rust-lang/libc/pull/4107>
- Tests: Ignore fields as required on Ubuntu 24.10 <https://github.com/rust-lang/libc/pull/4120>
- Tests: skip `ATF_*` constants for OpenBSD <https://github.com/rust-lang/libc/pull/4088>
- Triagebot: Add an autolabel for CI <https://github.com/rust-lang/libc/pull/4052>
## [0.2.164](https://github.com/rust-lang/libc/compare/0.2.163...0.2.164) - 2024-11-16
### MSRV
This release increases the MSRV of `libc` to 1.63.
### Other
- CI: remove tests with rust < 1.63 <https://github.com/rust-lang/libc/pull/4051>
- MSRV: document the MSRV of the stable channel to be 1.63 <https://github.com/rust-lang/libc/pull/4040>
- MacOS: move ifconf to s_no_extra_traits <https://github.com/rust-lang/libc/pull/4051>
## [0.2.163](https://github.com/rust-lang/libc/compare/0.2.162...0.2.163) - 2024-11-16
### Added
- Aix: add more `dlopen` flags <https://github.com/rust-lang/libc/pull/4044>
- Android: add group calls <https://github.com/rust-lang/libc/pull/3499>
- FreeBSD: add `TCP_FUNCTION_BLK` and `TCP_FUNCTION_ALIAS` <https://github.com/rust-lang/libc/pull/4047>
- Linux: add `confstr` <https://github.com/rust-lang/libc/pull/3612>
- Solarish: add `aio` <https://github.com/rust-lang/libc/pull/4033>
- Solarish: add `arc4random*` <https://github.com/rust-lang/libc/pull/3944>
### Changed
- Emscripten: upgrade emsdk to 3.1.68 <https://github.com/rust-lang/libc/pull/3962>
- Hurd: use more standard types <https://github.com/rust-lang/libc/pull/3733>
- Hurd: use the standard `ssize_t = isize` <https://github.com/rust-lang/libc/pull/4029>
- Solaris: fix `confstr` and `ucontext_t` <https://github.com/rust-lang/libc/pull/4035>
### Other
- CI: add Solaris <https://github.com/rust-lang/libc/pull/4035>
- CI: add `i686-unknown-freebsd` <https://github.com/rust-lang/libc/pull/3997>
- CI: ensure that calls to `sort` do not depend on locale <https://github.com/rust-lang/libc/pull/4026>
- Specify `rust-version` in `Cargo.toml` <https://github.com/rust-lang/libc/pull/4041>
## [0.2.162](https://github.com/rust-lang/libc/compare/0.2.161...0.2.162) - 2024-11-07
### Added
- Android: fix the alignment of `uc_mcontext` on arm64 <https://github.com/rust-lang/libc/pull/3894>
- Apple: add `host_cpu_load_info` <https://github.com/rust-lang/libc/pull/3916>
- ESP-IDF: add a time flag <https://github.com/rust-lang/libc/pull/3993>
- FreeBSD: add the `CLOSE_RANGE_CLOEXEC` flag<https://github.com/rust-lang/libc/pull/3996>
- FreeBSD: fix test errors regarding `__gregset_t` <https://github.com/rust-lang/libc/pull/3995>
- FreeBSD: fix tests on x86 FreeBSD 15 <https://github.com/rust-lang/libc/pull/3948>
- FreeBSD: make `ucontext_t` and `mcontext_t` available on all architectures <https://github.com/rust-lang/libc/pull/3848>
- Haiku: add `getentropy` <https://github.com/rust-lang/libc/pull/3991>
- Illumos: add `syncfs` <https://github.com/rust-lang/libc/pull/3990>
- Illumos: add some recently-added constants <https://github.com/rust-lang/libc/pull/3999>
- Linux: add `ioctl` flags <https://github.com/rust-lang/libc/pull/3960>
- Linux: add epoll busy polling parameters <https://github.com/rust-lang/libc/pull/3922>
- NuttX: add `pthread_[get/set]name_np` <https://github.com/rust-lang/libc/pull/4003>
- RTEMS: add `arc4random_buf` <https://github.com/rust-lang/libc/pull/3989>
- Trusty OS: add initial support <https://github.com/rust-lang/libc/pull/3942>
- WASIp2: expand socket support <https://github.com/rust-lang/libc/pull/3981>
### Fixed
- Emscripten: don't pass `-lc` <https://github.com/rust-lang/libc/pull/4002>
- Hurd: change `st_fsid` field to `st_dev` <https://github.com/rust-lang/libc/pull/3785>
- Hurd: fix the definition of `utsname` <https://github.com/rust-lang/libc/pull/3992>
- Illumos/Solaris: fix `FNM_CASEFOLD` definition <https://github.com/rust-lang/libc/pull/4004>
- Solaris: fix all tests <https://github.com/rust-lang/libc/pull/3864>
### Other
- CI: Add loongarch64 <https://github.com/rust-lang/libc/pull/4000>
- CI: Check that semver files are sorted <https://github.com/rust-lang/libc/pull/4018>
- CI: Re-enable the FreeBSD 15 job <https://github.com/rust-lang/libc/pull/3988>
- Clean up imports and `extern crate` usage <https://github.com/rust-lang/libc/pull/3897>
- Convert `mode_t` constants to octal <https://github.com/rust-lang/libc/pull/3634>
- Remove the `wasm32-wasi` target that has been deleted upstream <https://github.com/rust-lang/libc/pull/4013>
## [0.2.161](https://github.com/rust-lang/libc/compare/0.2.160...0.2.161) - 2024-10-17
### Fixed
- OpenBSD: fix `FNM_PATHNAME` and `FNM_NOESCAPE` values <https://github.com/rust-lang/libc/pull/3983>
## [0.2.160](https://github.com/rust-lang/libc/compare/0.2.159...0.2.160) - 2024-10-17
### Added
- Android: add `PR_GET_NAME` and `PR_SET_NAME` <https://github.com/rust-lang/libc/pull/3941>
- Apple: add `F_TRANSFEREXTENTS` <https://github.com/rust-lang/libc/pull/3925>
- Apple: add `mach_error_string` <https://github.com/rust-lang/libc/pull/3913>
- Apple: add additional `pthread` APIs <https://github.com/rust-lang/libc/pull/3846>
- Apple: add the `LOCAL_PEERTOKEN` socket option <https://github.com/rust-lang/libc/pull/3929>
- BSD: add `RTF_*`, `RTA_*`, `RTAX_*`, and `RTM_*` definitions <https://github.com/rust-lang/libc/pull/3714>
- Emscripten: add `AT_EACCESS` <https://github.com/rust-lang/libc/pull/3911>
- Emscripten: add `getgrgid`, `getgrnam`, `getgrnam_r` and `getgrgid_r` <https://github.com/rust-lang/libc/pull/3912>
- Emscripten: add `getpwnam_r` and `getpwuid_r` <https://github.com/rust-lang/libc/pull/3906>
- FreeBSD: add `POLLRDHUP` <https://github.com/rust-lang/libc/pull/3936>
- Haiku: add `arc4random` <https://github.com/rust-lang/libc/pull/3945>
- Illumos: add `ptsname_r` <https://github.com/rust-lang/libc/pull/3867>
- Linux: add `fanotify` interfaces <https://github.com/rust-lang/libc/pull/3695>
- Linux: add `tcp_info` <https://github.com/rust-lang/libc/pull/3480>
- Linux: add additional AF_PACKET options <https://github.com/rust-lang/libc/pull/3540>
- Linux: make Elf constants always available <https://github.com/rust-lang/libc/pull/3938>
- Musl x86: add `iopl` and `ioperm` <https://github.com/rust-lang/libc/pull/3720>
- Musl: add `posix_spawn` chdir functions <https://github.com/rust-lang/libc/pull/3949>
- Musl: add `utmpx.h` constants <https://github.com/rust-lang/libc/pull/3908>
- NetBSD: add `sysctlnametomib`, `CLOCK_THREAD_CPUTIME_ID` and `CLOCK_PROCESS_CPUTIME_ID` <https://github.com/rust-lang/libc/pull/3927>
- Nuttx: initial support <https://github.com/rust-lang/libc/pull/3909>
- RTEMS: add `getentropy` <https://github.com/rust-lang/libc/pull/3973>
- RTEMS: initial support <https://github.com/rust-lang/libc/pull/3866>
- Solarish: add `POLLRDHUP`, `POSIX_FADV_*`, `O_RSYNC`, and `posix_fallocate` <https://github.com/rust-lang/libc/pull/3936>
- Unix: add `fnmatch.h` <https://github.com/rust-lang/libc/pull/3937>
- VxWorks: add riscv64 support <https://github.com/rust-lang/libc/pull/3935>
- VxWorks: update constants related to the scheduler <https://github.com/rust-lang/libc/pull/3963>
### Changed
- Redox: change `ino_t` to be `c_ulonglong` <https://github.com/rust-lang/libc/pull/3919>
### Fixed
- ESP-IDF: fix mismatched constants and structs <https://github.com/rust-lang/libc/pull/3920>
- FreeBSD: fix `struct stat` on FreeBSD 12+ <https://github.com/rust-lang/libc/pull/3946>
### Other
- CI: Fix CI for FreeBSD 15 <https://github.com/rust-lang/libc/pull/3950>
- Docs: link to `windows-sys` <https://github.com/rust-lang/libc/pull/3915>
## [0.2.159](https://github.com/rust-lang/libc/compare/0.2.158...0.2.159) - 2024-09-24
### Added
- Android: add more `AT_*` constants in <https://github.com/rust-lang/libc/pull/3779>
- Apple: add missing `NOTE_*` constants in <https://github.com/rust-lang/libc/pull/3883>
- Hermit: add missing error numbers in <https://github.com/rust-lang/libc/pull/3858>
- Hurd: add `__timeval` for 64-bit support in <https://github.com/rust-lang/libc/pull/3786>
- Linux: add `epoll_pwait2` in <https://github.com/rust-lang/libc/pull/3868>
- Linux: add `mq_notify` in <https://github.com/rust-lang/libc/pull/3849>
- Linux: add missing `NFT_CT_*` constants in <https://github.com/rust-lang/libc/pull/3844>
- Linux: add the `fchmodat2` syscall in <https://github.com/rust-lang/libc/pull/3588>
- Linux: add the `mseal` syscall in <https://github.com/rust-lang/libc/pull/3798>
- OpenBSD: add `sendmmsg` and `recvmmsg` in <https://github.com/rust-lang/libc/pull/3831>
- Unix: add `IN6ADDR_ANY_INIT` and `IN6ADDR_LOOPBACK_INIT` in <https://github.com/rust-lang/libc/pull/3693>
- VxWorks: add `S_ISVTX` in <https://github.com/rust-lang/libc/pull/3768>
- VxWorks: add `vxCpuLib` and `taskLib` functions <https://github.com/rust-lang/libc/pull/3861>
- WASIp2: add definitions for `std::net` support in <https://github.com/rust-lang/libc/pull/3892>
### Fixed
- Correctly handle version checks when `clippy-driver` is used <https://github.com/rust-lang/libc/pull/3893>
### Changed
- EspIdf: change signal constants to c_int in <https://github.com/rust-lang/libc/pull/3895>
- HorizonOS: update network definitions in <https://github.com/rust-lang/libc/pull/3863>
- Linux: combine `ioctl` APIs in <https://github.com/rust-lang/libc/pull/3722>
- WASI: enable CI testing in <https://github.com/rust-lang/libc/pull/3869>
- WASIp2: enable CI testing in <https://github.com/rust-lang/libc/pull/3870>
## [0.2.158](https://github.com/rust-lang/libc/compare/0.2.157...0.2.158) - 2024-08-19
### Other
- WASI: fix missing `Iterator` with `rustc-dep-of-std` in <https://github.com/rust-lang/libc/pull/3856#event-13924913068>
## [0.2.157](https://github.com/rust-lang/libc/compare/0.2.156...0.2.157) - 2024-08-17
### Added
- Apple: add `_NSGetArgv`, `_NSGetArgc` and `_NSGetProgname` in <https://github.com/rust-lang/libc/pull/3702>
- Build: add `RUSTC_WRAPPER` support in <https://github.com/rust-lang/libc/pull/3845>
- FreeBSD: add `execvpe` support from 14.1 release in <https://github.com/rust-lang/libc/pull/3745>
- Fuchsia: add `SO_BINDTOIFINDEX`
- Linux: add `klogctl` in <https://github.com/rust-lang/libc/pull/3777>
- MacOS: add `fcntl` OFD commands in <https://github.com/rust-lang/libc/pull/3563>
- NetBSD: add `_lwp_park` in <https://github.com/rust-lang/libc/pull/3721>
- Solaris: add missing networking support in <https://github.com/rust-lang/libc/pull/3717>
- Unix: add `pthread_equal` in <https://github.com/rust-lang/libc/pull/3773>
- WASI: add `select`, `FD_SET`, `FD_ZERO`, `FD_ISSET ` in <https://github.com/rust-lang/libc/pull/3681>
### Fixed
- TEEOS: fix octal notation for `O_*` constants in <https://github.com/rust-lang/libc/pull/3841>
### Changed
- FreeBSD: always use freebsd12 when `rustc_dep_of_std` is set in <https://github.com/rust-lang/libc/pull/3723>
## [0.2.156](https://github.com/rust-lang/libc/compare/v0.2.155...v0.2.156) - 2024-08-15
### Added
- Apple: add `F_ALLOCATEPERSIST` in <https://github.com/rust-lang/libc/pull/3712>
- Apple: add `os_sync_wait_on_address` and related definitions in <https://github.com/rust-lang/libc/pull/3769>
- BSD: generalise `IPV6_DONTFRAG` to all BSD targets in <https://github.com/rust-lang/libc/pull/3716>
- FreeBSD/DragonFly: add `IP_RECVTTL`/`IPV6_RECVHOPLIMIT` in <https://github.com/rust-lang/libc/pull/3751>
- Hurd: add `XATTR_CREATE`, `XATTR_REPLACE` in <https://github.com/rust-lang/libc/pull/3739>
- Linux GNU: `confstr` API and `_CS_*` in <https://github.com/rust-lang/libc/pull/3771>
- Linux musl: add `preadv2` and `pwritev2` (1.2.5 min.) in <https://github.com/rust-lang/libc/pull/3762>
- VxWorks: add the constant `SOMAXCONN` in <https://github.com/rust-lang/libc/pull/3761>
- VxWorks: add a few errnoLib related constants in <https://github.com/rust-lang/libc/pull/3780>
### Fixed
- Solaris/illumos: Change `ifa_flags` type to u64 in <https://github.com/rust-lang/libc/pull/3729>
- QNX 7.0: Disable `libregex` in <https://github.com/rust-lang/libc/pull/3775>
### Changed
- QNX NTO: update platform support in <https://github.com/rust-lang/libc/pull/3815>
- `addr_of!(EXTERN_STATIC)` is now considered safe in <https://github.com/rust-lang/libc/pull/3776>
### Removed
- Apple: remove `rmx_state` in <https://github.com/rust-lang/libc/pull/3776>
### Other
- Update or remove CI tests that have been failing
+67 -41
View File
@@ -1,14 +1,45 @@
# Contributing to `libc`
Welcome! If you are reading this document, it means you are interested in contributing
to the `libc` crate.
Welcome! If you are reading this document, it means you are interested in
contributing to the `libc` crate.
## v0.2 changes
## v1.0 Roadmap
If you want to add your changes to v0.2, please submit them to the `libc-0.2` branch.
If you want to add any breaking changes, it should be submitted to the main branch,
which has changes for v0.3.
We will support and make a new release for v0.2 until we make the first release of v0.3.
`libc` has two active branches: `main` and `libc-0.2`. `main` is for active
development of the upcoming v1.0 release, and should be the target of all pull
requests. `libc-0.2` is for updates to the currently released version.
If a pull request to `main` is a good candidate for inclusion in an `0.2.x`
release, include `@rustbot label stable-nominated` in a comment to propose this.
Good candidates will usually meet the following:
1. The included changes are non-breaking.
2. The change applies cleanly to both branches.
3. There is a usecase that justifies inclusion in a stable release (all
additions should always have a usecase, hopefully).
Once a `stable-nominated` PR targeting `main` has merged, it can be cherry
picked to the `libc-0.2` branch. A maintainer will likely do these cherry picks
in a batch.
Alternatively, you can start this process yourself by creating a new branch
based on `libc-0.2` and running `git cherry-pick -xe commit-sha-on-main`
(`git
cherry-pick -xe start-sha^..end-sha` if a range of commits is needed).
`git` will automatically add the "cherry picked from commit" note, but try to
add a backport note so the original PR gets crosslinked:
```
# ... original commit message ...
(backport <https://github.com/rust-lang/libc/pull/1234>) # add manually
(cherry picked from commit 104b6a4ae31c726814c36318dc718470cc96e167) # added by git
```
Once the cherry-pick is complete, open a PR targeting `libc-0.2`.
See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for
details.
## Adding an API
@@ -16,14 +47,14 @@ Want to use an API which currently isn't bound in `libc`? It's quite easy to add
one!
The internal structure of this crate is designed to minimize the number of
`#[cfg]` attributes in order to easily be able to add new items which apply
to all platforms in the future. As a result, the crate is organized
hierarchically based on platform. Each module has a number of `#[cfg]`'d
children, but only one is ever actually compiled. Each module then reexports all
the contents of its children.
`#[cfg]` attributes in order to easily be able to add new items which apply to
all platforms in the future. As a result, the crate is organized hierarchically
based on platform. Each module has a number of `#[cfg]`'d children, but only one
is ever actually compiled. Each module then reexports all the contents of its
children.
This means that for each platform that libc supports, the path from a
leaf module to the root will contain all bindings for the platform in question.
This means that for each platform that libc supports, the path from a leaf
module to the root will contain all bindings for the platform in question.
Consequently, this indicates where an API should be added! Adding an API at a
particular level in the hierarchy means that it is supported on all the child
platforms of that level. For example, when adding a Unix API it should be added
@@ -51,50 +82,45 @@ With that in mind, the steps for adding a new API are:
5. Wait for a merge!
<sup>1</sup>: Note that this list has nothing to do with any Unix or Posix
standard, it's just a list shared between all OSs that declare `#[cfg(unix)]`.
standard, it's just a list shared among all OSs that declare `#[cfg(unix)]`.
## Test before you commit
We have two automated tests running on [GitHub Actions](https://github.com/rust-lang/libc/actions):
We have two automated tests running on
[GitHub Actions](https://github.com/rust-lang/libc/actions):
1. [`libc-test`](https://github.com/gnzlbg/ctest)
1. `libc-test`
- `cd libc-test && cargo test`
- Use the `skip_*()` functions in `build.rs` if you really need a workaround.
2. Style checker
- [`sh ci/style.sh`](https://github.com/rust-lang/libc/blob/main/ci/style.sh)
- [`./ci/style.py`](https://github.com/rust-lang/libc/blob/main/ci/style.py)
## Breaking change policy
Sometimes an upstream adds a breaking change to their API e.g. removing outdated items,
changing the type signature, etc. And we probably should follow that change to build the
`libc` crate successfully. It's annoying to do the equivalent of semver-major versioning
for each such change. Instead, we mark the item as deprecated and do the actual change
after a certain period. The steps are:
Sometimes an upstream adds a breaking change to their API e.g. removing outdated
items, changing the type signature, etc. And we probably should follow that
change to build the `libc` crate successfully. It's annoying to do the
equivalent of semver-major versioning for each such change. Instead, we mark the
item as deprecated and do the actual change after a certain period. The steps
are:
1. Add `#[deprecated(since = "", note="")]` attribute to the item.
- The `since` field should have a next version of `libc`
(e.g., if the current version is `0.2.1`, it should be `0.2.2`).
- The `note` field should have a reason to deprecate and a tracking issue to call for comments
(e.g., "We consider removing this as the upstream removed it.
If you're using it, please comment on #XXX").
- The `since` field should have a next version of `libc` (e.g., if the current
version is `0.2.1`, it should be `0.2.2`).
- The `note` field should have a reason to deprecate and a tracking issue to
call for comments (e.g., "We consider removing this as the upstream removed
it. If you're using it, please comment on #XXX").
2. If we don't see any concerns for a while, do the change actually.
## Supported target policy
When Rust removes a support for a target, the libc crate also may remove the support anytime.
When Rust removes a support for a target, the libc crate also may remove the
support at any time.
## Releasing your change to crates.io
Now that you've done the amazing job of landing your new API or your new
platform in this crate, the next step is to get that sweet, sweet usage from
crates.io! The only next step is to bump the version of libc and then publish
it. If you'd like to get a release out ASAP you can follow these steps:
This repository uses [release-plz] to handle releases. Once your pull request
has been merged, a maintainer just needs to verify the generated changelog, then
merge the bot's release PR. This will automatically publish to crates.io!
1. Increment the patch version number in `Cargo.toml` and `libc-test/Cargo.toml`.
1. Send a PR to this repository. It should [look like this][example-pr], but it'd
also be nice to fill out the description with a small rationale for the
release (any rationale is ok though!).
1. Once merged, the release will be tagged and published by one of the libc crate
maintainers.
[example-pr]: https://github.com/rust-lang/libc/pull/2120
[release-plz]: https://github.com/MarcoIeni/release-plz
+59 -19
View File
@@ -1,22 +1,18 @@
[package]
name = "libc"
version = "0.2.153"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-lang/libc"
homepage = "https://github.com/rust-lang/libc"
documentation = "https://docs.rs/libc/"
version = "0.2.180"
keywords = ["libc", "ffi", "bindings", "operating", "system"]
categories = ["external-ffi-bindings", "no-std", "os"]
build = "build.rs"
exclude = ["/ci/*", "/.github/*", "/.cirrus.yml", "/triagebot.toml"]
description = """
Raw FFI bindings to platform libraries like libc.
"""
exclude = ["/ci/*", "/.github/*", "/.cirrus.yml", "/triagebot.toml", "cherry-pick-stable.sh"]
description = "Raw FFI bindings to platform libraries like libc."
authors = ["The Rust Project Developers"]
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/libc"
rust-version = "1.63"
[package.metadata.docs.rs]
features = ["const-extern-fn", "extra_traits"]
features = ["extra_traits"]
default-target = "x86_64-unknown-linux-gnu"
targets = [
"aarch64-apple-darwin",
@@ -46,8 +42,8 @@ targets = [
"armv7-wrs-vxworks-eabihf",
"armv7r-none-eabi",
"armv7r-none-eabihf",
"hexagon-unknown-linux-musl",
"i586-pc-windows-msvc",
# FIXME(hexagon): excluded due to duplicate symbol errors
# "hexagon-unknown-linux-musl",
"i586-unknown-linux-gnu",
"i586-unknown-linux-musl",
"i686-linux-android",
@@ -76,20 +72,24 @@ targets = [
"powerpc-unknown-netbsd",
"powerpc-wrs-vxworks",
"powerpc-wrs-vxworks-spe",
"powerpc64-ibm-aix",
"powerpc64-unknown-freebsd",
"powerpc64-unknown-linux-gnu",
"powerpc64-wrs-vxworks",
"powerpc64le-unknown-linux-gnu",
"powerpc64le-unknown-linux-musl",
"riscv32gc-unknown-linux-gnu",
"riscv32i-unknown-none-elf",
"riscv32imac-unknown-none-elf",
"riscv32imc-unknown-none-elf",
"riscv32-wrs-vxworks",
"riscv64gc-unknown-freebsd",
"riscv64gc-unknown-hermit",
"riscv64gc-unknown-linux-gnu",
"riscv64gc-unknown-linux-musl",
"riscv64gc-unknown-none-elf",
"riscv64imac-unknown-none-elf",
"riscv64-wrs-vxworks",
"s390x-unknown-linux-gnu",
"s390x-unknown-linux-musl",
"sparc-unknown-linux-gnu",
@@ -104,7 +104,6 @@ targets = [
"thumbv7neon-unknown-linux-gnueabihf",
"wasm32-unknown-emscripten",
"wasm32-unknown-unknown",
"wasm32-wasi",
"x86_64-apple-darwin",
"x86_64-apple-ios",
"x86_64-fortanix-unknown-sgx",
@@ -130,17 +129,58 @@ targets = [
cargo-args = ["-Zbuild-std=core"]
[dependencies]
rustc-std-workspace-core = { version = "1.0.0", optional = true }
rustc-std-workspace-core = { version = "1.0.1", optional = true }
[features]
default = ["std"]
std = []
align = []
rustc-dep-of-std = ['align', 'rustc-std-workspace-core']
extra_traits = []
# `const-extern-function` is deprecated and no longer does anything
const-extern-fn = []
# `align` is deprecated and no longer does anything
align = []
# use_std is deprecated, use `std` instead
use_std = ['std']
[workspace]
members = ["libc-test"]
members = [
"ctest",
"libc-test",
]
# FIXME(msrv): These should be renamed as `[workspace.lints.*]` once MSRV is above 1.64
# This way all crates can use it with `[lints] workspace=true` section
[lints.rust]
# FIXME(cleanup): make ident usage consistent in each file
unused_qualifications = "allow"
[lints.clippy]
# Enable pedantic lints - use this manually once in a while, but don't enable by default
# pedantic = { level = "warn", priority = -1 }
# We are okay with the current state of these lints
explicit_iter_loop = "warn"
identity_op = "allow" # some expressions like `0 | x` are clearer for bit ops
manual_assert = "warn"
map_unwrap_or = "warn"
missing_safety_doc = "allow" # safety? in libc? seriously?
non_minimal_cfg = "allow" # for some reason cfg_if! sometimes trigger this
ptr_as_ptr = "warn"
unnecessary_semicolon = "warn"
# FIXME(clippy): these should be fixed if possible
expl_impl_clone_on_copy = "allow"
uninlined_format_args = "allow"
unnecessary_cast = "allow" # some casts like `as usize` are only needed for some targets
used_underscore_binding = "allow"
[package.metadata.cargo-semver-checks.lints]
# Alignment is an internal detail that users must not rely upon
repr_align_removed = "warn"
# We deprecate things all the time
global_value_marked_deprecated = "warn"
+1 -1
View File
@@ -3,7 +3,7 @@
"Name": "libc",
"License": "Apache License V2.0, MIT",
"License File": "LICENSE-APACHE, LICENSE-MIT",
"Version Number": "0.2.153",
"Version Number": "0.2.180",
"Owner": "fangting12@huawei.com",
"Upstream URL": "https://github.com/rust-lang/libc",
"Description": "A Rust library that provides bindings to the C standard library."
+35 -36
View File
@@ -11,19 +11,26 @@ This crate exports all underlying platform types, functions, and constants under
the crate root, so all items are accessible as `libc::foo`. The types and values
of all the exported APIs match the platform that libc is compiled for.
Windows API bindings are not included in this crate. If you are looking for
WinAPI bindings, consider using crates like [windows-sys].
More detailed information about the design of this library can be found in its
[associated RFC][rfc].
[rfc]: https://github.com/rust-lang/rfcs/blob/HEAD/text/1291-promote-libc.md
[windows-sys]: https://docs.rs/windows-sys
## v0.3 Roadmap
## v1.0 Roadmap
The main branch is now for v0.3 which has some breaking changes.
Currently, `libc` has two active branches: `main` for the upcoming v1.0 release,
and `libc-0.2` for the currently published version. By default all pull requests
should target `main`; once reviewed, they can be cherry picked to the `libc-0.2`
branch if needed.
For v0.2, please submit PRs to the `libc-0.2` branch instead.
We will stop making new v0.2 releases once we release v0.3 on crates.io.
We will stop making new v0.2 releases once v1.0 is released.
See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for details.
See the section in [CONTRIBUTING.md](CONTRIBUTING.md#v10-roadmap) for more
details.
## Usage
@@ -36,46 +43,38 @@ libc = "0.2"
## Features
* `std`: by default `libc` links to the standard library. Disable this
feature to remove this dependency and be able to use `libc` in `#![no_std]`
crates.
* `std`: by default `libc` links to the standard library. Disable this feature
to remove this dependency and be able to use `libc` in `#![no_std]` crates.
* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`.
This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`.
* `const-extern-fn`: Changes some `extern fn`s into `const extern fn`s.
If you use Rust >= 1.62, this feature is implicitly enabled.
Otherwise it requires a nightly rustc.
The following features are deprecated:
* **deprecated**: `use_std` is deprecated, and is equivalent to `std`.
* `use_std`: this is equivalent to `std`
* `const-extern-fn`: this is now enabled by default
* `align`: this is now enabled by default
## Rust version support
The minimum supported Rust toolchain version is currently **Rust 1.13.0**.
(libc does not currently have any policy regarding changes to the minimum
supported Rust version; such policy is a work in progress.) APIs requiring
newer Rust features are only available on newer Rust toolchains:
The minimum supported Rust toolchain version is currently **Rust 1.63**.
| Feature | Version |
|----------------------|---------|
| `union` | 1.19.0 |
| `const mem::size_of` | 1.24.0 |
| `repr(align)` | 1.25.0 |
| `extra_traits` | 1.25.0 |
| `core::ffi::c_void` | 1.30.0 |
| `repr(packed(N))` | 1.33.0 |
| `cfg(target_vendor)` | 1.33.0 |
| `const-extern-fn` | 1.62.0 |
Increases to the MSRV are allowed to change without a major (i.e. semver-
breaking) release in order to avoid a ripple effect in the ecosystem. A policy
for when this may change is a work in progress.
`libc` may continue to compile with Rust versions older than the current MSRV
but this is not guaranteed.
## Platform support
You can see the platform(target)-specific docs on [docs.rs], select a platform you want to see.
You can see the platform(target)-specific docs on [docs.rs], select a platform
you want to see.
See
[`ci/build.sh`](https://github.com/rust-lang/libc/blob/HEAD/ci/build.sh)
for the platforms on which `libc` is guaranteed to build for each Rust
toolchain. The test-matrix at [GitHub Actions] and [Cirrus CI] show the
platforms in which `libc` tests are run.
See [`ci/verify-build.py`](https://github.com/rust-lang/libc/blob/HEAD/ci/verify-build.py) for
the platforms on which `libc` is guaranteed to build for each Rust toolchain.
The test-matrix at [GitHub Actions] and [Cirrus CI] show the platforms in which
`libc` tests are run.
<div class="platform_docs"></div>
@@ -93,13 +92,13 @@ at your option.
## Contributing
We welcome all people who want to contribute. Please see the [contributing
instructions] for more information.
We welcome all people who want to contribute. Please see the
[contributing instructions] for more information.
[contributing instructions]: https://github.com/rust-lang/libc/blob/HEAD/CONTRIBUTING.md
Contributions in any form (issues, pull requests, etc.) to this project
must adhere to Rust's [Code of Conduct].
Contributions in any form (issues, pull requests, etc.) to this project must
adhere to Rust's [Code of Conduct].
[Code of Conduct]: https://www.rust-lang.org/policies/code-of-conduct
+228 -187
View File
@@ -1,84 +1,170 @@
use std::env;
use std::process::Command;
use std::str;
use std::string::String;
use std::env::VarError;
use std::process::{
Command,
Output,
};
use std::{
env,
str,
};
// List of cfgs this build script is allowed to set. The list is needed to support check-cfg, as we
// need to know all the possible cfgs that this script will set. If you need to set another cfg
// make sure to add it to this list as well.
const ALLOWED_CFGS: &'static [&'static str] = &[
"emscripten_new_stat_abi",
const ALLOWED_CFGS: &[&str] = &[
"emscripten_old_stat_abi",
"espidf_time32",
"freebsd10",
"freebsd11",
"freebsd12",
"freebsd13",
"freebsd14",
"freebsd15",
"libc_align",
"libc_cfg_target_vendor",
"libc_const_extern_fn",
"libc_const_extern_fn_unstable",
"libc_const_size_of",
"libc_core_cvoid",
// Corresponds to `_FILE_OFFSET_BITS=64` in glibc
"gnu_file_offset_bits64",
// Corresponds to `_TIME_BITS=64` in glibc
"gnu_time_bits64",
"libc_deny_warnings",
"libc_int128",
"libc_long_array",
"libc_non_exhaustive",
"libc_packedN",
"libc_priv_mod_use",
"libc_ptr_addr_of",
"libc_thread_local",
"libc_underscore_const_names",
"libc_union",
// Corresponds to `__USE_TIME_BITS64` in UAPI
"linux_time_bits64",
"musl_v1_2_3",
// Corresponds to `_REDIR_TIME64` in musl
"musl32_time64",
"vxworks_lt_25_09",
];
// Extra values to allow for check-cfg.
const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[
("target_os", &["switch", "aix", "ohos", "hurd"]),
("target_env", &["illumos", "wasi", "aix", "ohos"]),
const CHECK_CFG_EXTRA: &[(&str, &[&str])] = &[
(
"target_os",
&[
"switch", "aix", "ohos", "hurd", "rtems", "visionos", "nuttx", "cygwin", "qurt",
],
),
(
"target_env",
&["illumos", "wasi", "aix", "ohos", "nto71_iosock", "nto80"],
),
(
"target_arch",
&["loongarch64", "mips32r6", "mips64r6", "csky"],
),
];
/// Musl architectures that set `#define _REDIR_TIME64 1`.
const MUSL_REDIR_TIME64_ARCHES: &[&str] = &["arm", "mips", "powerpc", "x86"];
fn main() {
// Avoid unnecessary re-building.
println!("cargo:rerun-if-changed=build.rs");
let (rustc_minor_ver, is_nightly) = rustc_minor_nightly();
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok();
let const_extern_fn_cargo_feature = env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok();
let libc_ci = env::var("LIBC_CI").is_ok();
let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok();
if env::var("CARGO_FEATURE_USE_STD").is_ok() {
println!(
"cargo:warning=\"libc's use_std cargo feature is deprecated since libc 0.2.55; \
please consider using the `std` cargo feature instead\""
);
}
let (rustc_minor_ver, _is_nightly) = rustc_minor_nightly();
let libc_ci = env_flag("LIBC_CI");
let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default();
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
let target_ptr_width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap_or_default();
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
// The ABI of libc used by std is backward compatible with FreeBSD 12.
// The ABI of libc from crates.io is backward compatible with FreeBSD 11.
// The ABI of libc from crates.io is backward compatible with FreeBSD 12.
//
// On CI, we detect the actual FreeBSD version and match its ABI exactly,
// running tests to ensure that the ABI is correct.
match which_freebsd() {
Some(10) if libc_ci => set_cfg("freebsd10"),
Some(11) if libc_ci => set_cfg("freebsd11"),
Some(12) if libc_ci || rustc_dep_of_std => set_cfg("freebsd12"),
Some(13) if libc_ci => set_cfg("freebsd13"),
Some(14) if libc_ci => set_cfg("freebsd14"),
Some(15) if libc_ci => set_cfg("freebsd15"),
Some(_) | None => set_cfg("freebsd11"),
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_FREEBSD_VERSION");
// Allow overriding the default version for testing
let which_freebsd = if let Ok(version) = env::var("RUST_LIBC_UNSTABLE_FREEBSD_VERSION") {
let vers = version.parse().unwrap();
println!("cargo:warning=setting FreeBSD version to {vers}");
vers
} else if libc_ci {
which_freebsd().unwrap_or(12)
} else {
12
};
match which_freebsd {
x if x < 10 => panic!("FreeBSD older than 10 is not supported"),
10 => set_cfg("freebsd10"),
11 => set_cfg("freebsd11"),
12 => set_cfg("freebsd12"),
13 => set_cfg("freebsd13"),
14 => set_cfg("freebsd14"),
_ => set_cfg("freebsd15"),
}
match emcc_version_code() {
Some(v) if (v >= 30142) => set_cfg("emscripten_new_stat_abi"),
// Non-Emscripten or version < 3.1.42.
Some(_) | None => (),
Some(v) if (v < 30142) => set_cfg("emscripten_old_stat_abi"),
// Non-Emscripten or version >= 3.1.42.
_ => (),
}
match vxworks_version_code() {
Some(v) if (v < (25, 9)) => set_cfg("vxworks_lt_25_09"),
// VxWorks version >= 25.09
_ => (),
}
let mut musl_v1_2_3 = env_flag("RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
// OpenHarmony uses a fork of the musl libc
let musl = target_env == "musl" || target_env == "ohos";
// loongarch64 and ohos only exist with recent musl
if target_arch == "loongarch64" || target_env == "ohos" {
musl_v1_2_3 = true;
}
if musl && musl_v1_2_3 {
set_cfg("musl_v1_2_3");
if MUSL_REDIR_TIME64_ARCHES.contains(&target_arch.as_str()) {
set_cfg("musl32_time64");
set_cfg("linux_time_bits64");
}
}
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64");
if linux_time_bits64 {
set_cfg("linux_time_bits64");
}
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS");
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_TIME_BITS");
if target_env == "gnu"
&& target_os == "linux"
&& target_ptr_width == "32"
&& target_arch != "riscv32"
&& target_arch != "x86_64"
{
let defaultbits = "32".to_string();
let (timebits, filebits) = match (
env::var("RUST_LIBC_UNSTABLE_GNU_TIME_BITS"),
env::var("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS"),
) {
(Ok(_), Ok(_)) => panic!("Do not set both RUST_LIBC_UNSTABLE_GNU_TIME_BITS and RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS"),
(Err(_), Err(_)) => (defaultbits.clone(), defaultbits.clone()),
(Ok(tb), Err(_)) if tb == "64" => (tb.clone(), tb.clone()),
(Ok(tb), Err(_)) if tb == "32" => (tb, defaultbits.clone()),
(Ok(_), Err(_)) => panic!("Invalid value for RUST_LIBC_UNSTABLE_GNU_TIME_BITS, must be 32 or 64"),
(Err(_), Ok(fb)) if fb == "32" || fb == "64" => (defaultbits.clone(), fb),
(Err(_), Ok(_)) => panic!("Invalid value for RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS, must be 32 or 64"),
};
let valid_bits = ["32", "64"];
assert!(
valid_bits.contains(&filebits.as_str()) && valid_bits.contains(&timebits.as_str()),
"Invalid value for RUST_LIBC_UNSTABLE_GNU_TIME_BITS or RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS, must be 32, 64 or unset"
);
assert!(
!(filebits == "32" && timebits == "64"),
"RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS must be 64 or unset if RUST_LIBC_UNSTABLE_GNU_TIME_BITS is 64"
);
if timebits == "64" {
set_cfg("linux_time_bits64");
set_cfg("gnu_time_bits64");
}
if filebits == "64" {
set_cfg("gnu_file_offset_bits64");
}
}
// On CI: deny all warnings
@@ -86,106 +172,53 @@ fn main() {
set_cfg("libc_deny_warnings");
}
// Rust >= 1.15 supports private module use:
if rustc_minor_ver >= 15 || rustc_dep_of_std {
set_cfg("libc_priv_mod_use");
}
// Rust >= 1.19 supports unions:
if rustc_minor_ver >= 19 || rustc_dep_of_std {
set_cfg("libc_union");
}
// Rust >= 1.24 supports const mem::size_of:
if rustc_minor_ver >= 24 || rustc_dep_of_std {
set_cfg("libc_const_size_of");
}
// Rust >= 1.25 supports repr(align):
if rustc_minor_ver >= 25 || rustc_dep_of_std || align_cargo_feature {
set_cfg("libc_align");
}
// Rust >= 1.26 supports i128 and u128:
if rustc_minor_ver >= 26 || rustc_dep_of_std {
set_cfg("libc_int128");
}
// Rust >= 1.30 supports `core::ffi::c_void`, so libc can just re-export it.
// Otherwise, it defines an incompatible type to retaining
// backwards-compatibility.
if rustc_minor_ver >= 30 || rustc_dep_of_std {
set_cfg("libc_core_cvoid");
}
// Rust >= 1.33 supports repr(packed(N)) and cfg(target_vendor).
if rustc_minor_ver >= 33 || rustc_dep_of_std {
set_cfg("libc_packedN");
set_cfg("libc_cfg_target_vendor");
}
// Rust >= 1.40 supports #[non_exhaustive].
if rustc_minor_ver >= 40 || rustc_dep_of_std {
set_cfg("libc_non_exhaustive");
}
// Rust >= 1.47 supports long array:
if rustc_minor_ver >= 47 || rustc_dep_of_std {
set_cfg("libc_long_array");
}
if rustc_minor_ver >= 51 || rustc_dep_of_std {
set_cfg("libc_ptr_addr_of");
}
// Rust >= 1.37.0 allows underscores as anonymous constant names.
if rustc_minor_ver >= 37 || rustc_dep_of_std {
set_cfg("libc_underscore_const_names");
}
// #[thread_local] is currently unstable
if rustc_dep_of_std {
set_cfg("libc_thread_local");
}
// Rust >= 1.62.0 allows to use `const_extern_fn` for "Rust" and "C".
if rustc_minor_ver >= 62 {
set_cfg("libc_const_extern_fn");
} else {
// Rust < 1.62.0 requires a crate feature and feature gate.
if const_extern_fn_cargo_feature {
if !is_nightly || rustc_minor_ver < 40 {
panic!("const-extern-fn requires a nightly compiler >= 1.40");
}
set_cfg("libc_const_extern_fn_unstable");
set_cfg("libc_const_extern_fn");
}
}
// check-cfg is a nightly cargo/rustc feature to warn when unknown cfgs are used across the
// codebase. libc can configure it if the appropriate environment variable is passed. Since
// rust-lang/rust enforces it, this is useful when using a custom libc fork there.
//
// https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg
if libc_check_cfg {
// Since Rust 1.80, configuration that isn't recognized by default needs to be provided to
// avoid warnings.
if rustc_minor_ver >= 80 {
for cfg in ALLOWED_CFGS {
if rustc_minor_ver >= 75 {
println!("cargo:rustc-check-cfg=cfg({})", cfg);
} else {
println!("cargo:rustc-check-cfg=values({})", cfg);
}
println!("cargo:rustc-check-cfg=cfg({cfg})");
}
for &(name, values) in CHECK_CFG_EXTRA {
let values = values.join("\",\"");
if rustc_minor_ver >= 75 {
println!("cargo:rustc-check-cfg=cfg({},values(\"{}\"))", name, values);
} else {
println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
}
println!("cargo:rustc-check-cfg=cfg({name},values(\"{values}\"))");
}
}
}
/// Run `rustc --version` and capture the output, adjusting arguments as needed if `clippy-driver`
/// is used instead.
fn rustc_version_cmd(is_clippy_driver: bool) -> Output {
let rustc = env::var_os("RUSTC").expect("Failed to get rustc version: missing RUSTC env");
let mut cmd = match env::var_os("RUSTC_WRAPPER") {
Some(ref wrapper) if wrapper.is_empty() => Command::new(rustc),
Some(wrapper) => {
let mut cmd = Command::new(wrapper);
cmd.arg(rustc);
if is_clippy_driver {
cmd.arg("--rustc");
}
cmd
}
None => Command::new(rustc),
};
cmd.arg("--version");
let output = cmd.output().expect("Failed to get rustc version");
assert!(
output.status.success(),
"failed to run rustc: {}",
String::from_utf8_lossy(output.stderr.as_slice())
);
output
}
/// Return the minor version of `rustc`, as well as a bool indicating whether or not the version
/// is a nightly.
fn rustc_minor_nightly() -> (u32, bool) {
macro_rules! otry {
($e:expr) => {
@@ -196,25 +229,21 @@ fn rustc_minor_nightly() -> (u32, bool) {
};
}
let rustc = otry!(env::var_os("RUSTC"));
let output = Command::new(rustc)
.arg("--version")
.output()
.ok()
.expect("Failed to get rustc version");
if !output.status.success() {
panic!(
"failed to run rustc: {}",
String::from_utf8_lossy(output.stderr.as_slice())
);
let mut output = rustc_version_cmd(false);
if otry!(str::from_utf8(&output.stdout).ok()).starts_with("clippy") {
output = rustc_version_cmd(true);
}
let version = otry!(str::from_utf8(&output.stdout).ok());
let mut pieces = version.split('.');
if pieces.next() != Some("rustc 1") {
panic!("Failed to get rustc version");
}
assert_eq!(
pieces.next(),
Some("rustc 1"),
"Failed to get rustc version"
);
let minor = pieces.next();
@@ -224,29 +253,21 @@ fn rustc_minor_nightly() -> (u32, bool) {
// since a nightly build should either come from CI
// or a git checkout
let nightly_raw = otry!(pieces.next()).split('-').nth(1);
let nightly = nightly_raw
.map(|raw| raw.starts_with("dev") || raw.starts_with("nightly"))
.unwrap_or(false);
let nightly = nightly_raw.map_or(false, |raw| {
raw.starts_with("dev") || raw.starts_with("nightly")
});
let minor = otry!(otry!(minor).parse().ok());
(minor, nightly)
}
fn which_freebsd() -> Option<i32> {
let output = std::process::Command::new("freebsd-version").output().ok();
if output.is_none() {
return None;
}
let output = output.unwrap();
let output = Command::new("freebsd-version").output().ok()?;
if !output.status.success() {
return None;
}
let stdout = String::from_utf8(output.stdout).ok();
if stdout.is_none() {
return None;
}
let stdout = stdout.unwrap();
let stdout = String::from_utf8(output.stdout).ok()?;
match &stdout {
s if s.starts_with("10") => Some(10),
@@ -260,27 +281,22 @@ fn which_freebsd() -> Option<i32> {
}
fn emcc_version_code() -> Option<u64> {
let output = std::process::Command::new("emcc")
.arg("-dumpversion")
.output()
.ok();
if output.is_none() {
return None;
}
let output = output.unwrap();
let emcc = if cfg!(target_os = "windows") {
"emcc.bat"
} else {
"emcc"
};
let output = Command::new(emcc).arg("-dumpversion").output().ok()?;
if !output.status.success() {
return None;
}
let stdout = String::from_utf8(output.stdout).ok();
if stdout.is_none() {
return None;
}
let version = stdout.unwrap();
let version = String::from_utf8(output.stdout).ok()?;
// Some Emscripten versions come with `-git` attached, so split the
// version string also on the `-` char.
let mut pieces = version.trim().split(|c| c == '.' || c == '-');
let mut pieces = version.trim().split(['.', '-']);
let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
@@ -289,9 +305,34 @@ fn emcc_version_code() -> Option<u64> {
Some(major * 10000 + minor * 100 + patch)
}
fn set_cfg(cfg: &str) {
if !ALLOWED_CFGS.contains(&cfg) {
panic!("trying to set cfg {}, but it is not in ALLOWED_CFGS", cfg);
}
println!("cargo:rustc-cfg={}", cfg);
/// Retrieve the VxWorks release version from the environment variable set by the VxWorks build
/// environment, in `(minor, patch)` form. Currently the only major version supported by Rust
/// is 7.
fn vxworks_version_code() -> Option<(u32, u32)> {
let version = env::var("WIND_RELEASE_ID").ok()?;
let mut pieces = version.trim().split(['.']);
let major: u32 = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
let minor: u32 = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
Some((major, minor))
}
fn set_cfg(cfg: &str) {
assert!(
ALLOWED_CFGS.contains(&cfg),
"trying to set cfg {cfg}, but it is not in ALLOWED_CFGS",
);
println!("cargo:rustc-cfg={cfg}");
}
/// Return true if the env is set to a value other than `0`.
fn env_flag(key: &str) -> bool {
match env::var(key) {
Ok(x) if x == "0" => false,
Err(VarError::NotPresent) => false,
Err(VarError::NotUnicode(_)) => panic!("non-unicode var for `{key}`"),
Ok(_) => true,
}
}
+150
View File
@@ -0,0 +1,150 @@
#!/bin/bash
set -e
# Parse arguments
DRY_RUN=false
while [[ $# -gt 0 ]]; do
case $1 in
--dry-run|-d)
DRY_RUN=true
shift
;;
--help|-h)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Cherry-pick commits from PRs labeled 'stable-nominated' to current branch"
echo ""
echo "Options:"
echo " -d, --dry-run Show what would be done without making changes"
echo " -h, --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
done
if [ "$DRY_RUN" = true ]; then
echo "[DRY RUN MODE - No changes will be made]"
echo ""
fi
current_branch=$(git branch --show-current)
echo "Current branch: $current_branch"
echo "Fetching PRs with 'stable-nominated' label..."
echo ""
# Get PRs with stable-nominated label that are merged
# Sort by merge date (oldest first) to preserve merge order and avoid conflicts
# Format: PR number, title, merge commit SHA
prs=$(gh pr list --state merged --label stable-nominated --json number,title,mergeCommit,mergedAt --jq 'sort_by(.mergedAt) | .[] | "\(.number)|\(.title)|\(.mergeCommit.oid)"')
if [ -z "$prs" ]; then
echo "No PRs found with 'stable-nominated' label."
exit 0
fi
# Arrays to track results
declare -a successful
declare -a failed
declare -a skipped
echo "Found PRs to cherry-pick:"
echo ""
# Process each PR
while IFS='|' read -r pr_number title commit_sha; do
echo "----------------------------------------"
echo "PR #${pr_number}: ${title}"
echo "Commit: ${commit_sha}"
# Check if commit already exists in current branch
if git branch --contains "$commit_sha" 2>/dev/null | grep -q "^\*"; then
echo "⏭ Already cherry-picked, skipping"
skipped+=("PR #${pr_number}: ${title}")
echo ""
continue
fi
# Cherry-pick with -xe flags as specified
if [ "$DRY_RUN" = true ]; then
echo "Would cherry-pick with: git cherry-pick -xe $commit_sha"
echo "Would add backport note: (backport https://github.com/rust-lang/libc/pull/$pr_number)"
successful+=("PR #${pr_number}: ${title} (${commit_sha:0:8})")
else
if git cherry-pick -xe "$commit_sha" 2>&1; then
# Add backport note before the cherry-pick note as per CONTRIBUTING.md
current_msg=$(git log -1 --format=%B)
backport_line="(backport https://github.com/rust-lang/libc/pull/$pr_number)"
# Insert backport line before "(cherry picked from commit" line
new_msg=$(echo "$current_msg" | sed "/^(cherry picked from commit/i\\
$backport_line\\
")
# Amend the commit with the new message
git commit --amend -m "$new_msg"
echo "✓ Successfully cherry-picked with backport note"
successful+=("PR #${pr_number}: ${title} (${commit_sha:0:8})")
else
echo "✗ Failed to cherry-pick"
failed+=("PR #${pr_number}: ${title} (${commit_sha:0:8})")
# Abort the failed cherry-pick
git cherry-pick --abort 2>/dev/null || true
fi
fi
echo ""
done <<< "$prs"
# Print summary
echo "========================================"
if [ "$DRY_RUN" = true ]; then
echo "SUMMARY (DRY RUN)"
else
echo "SUMMARY"
fi
echo "========================================"
echo ""
if [ ${#successful[@]} -gt 0 ]; then
if [ "$DRY_RUN" = true ]; then
echo "Would cherry-pick (${#successful[@]}):"
else
echo "Successfully cherry-picked (${#successful[@]}):"
fi
for item in "${successful[@]}"; do
echo "$item"
done
echo ""
fi
if [ ${#skipped[@]} -gt 0 ]; then
echo "Skipped (${#skipped[@]}):"
for item in "${skipped[@]}"; do
echo "$item"
done
echo ""
fi
if [ ${#failed[@]} -gt 0 ]; then
echo "Failed (${#failed[@]}):"
for item in "${failed[@]}"; do
echo "$item"
done
echo ""
if [ "$DRY_RUN" = false ]; then
echo "Please resolve conflicts manually and re-run if needed."
fi
exit 1
fi
if [ "$DRY_RUN" = true ]; then
echo "Dry run complete! Run without --dry-run to apply changes."
else
echo "All done!"
fi
+15 -12
View File
@@ -4,8 +4,8 @@ result the CI is pretty complicated and also pretty large! Hopefully this can
serve as a guide through the sea of scripts in this directory and elsewhere in
this project.
Note that this documentation is quite outdated. See CI config and scripts
in the `ci` directory how we run CI now.
Note that this documentation is quite outdated. See CI config and scripts in the
`ci` directory how we run CI now.
# Files
@@ -20,8 +20,9 @@ First up, let's talk about the files in this directory:
# CI Systems
Currently this repository leverages a combination of GitHub Actions and Cirrus CI
for running tests. You can find tested triples in [Actions config] or [Cirrus config].
Currently this repository leverages a combination of GitHub Actions and Cirrus
CI for running tests. You can find tested triples in [Actions config] or
[Cirrus config].
The Windows triples are all pretty standard, they just set up their environment
then run tests, no need for downloading any extra target libs (we just download
@@ -101,8 +102,10 @@ about above), and then shut down.
1. [Download the latest stable amd64-bootonly release ISO](https://www.freebsd.org/where.html).
E.g. FreeBSD-11.1-RELEASE-amd64-bootonly.iso
2. Create the disk image: `qemu-img create -f qcow2 FreeBSD-11.1-RELEASE-amd64.qcow2 2G`
3. Boot the machine: `qemu-system-x86_64 -cdrom FreeBSD-11.1-RELEASE-amd64-bootonly.iso -drive if=virtio,file=FreeBSD-11.1-RELEASE-amd64.qcow2 -net nic,model=virtio -net user`
2. Create the disk image:
`qemu-img create -f qcow2 FreeBSD-11.1-RELEASE-amd64.qcow2 2G`
3. Boot the machine:
`qemu-system-x86_64 -cdrom FreeBSD-11.1-RELEASE-amd64-bootonly.iso -drive if=virtio,file=FreeBSD-11.1-RELEASE-amd64.qcow2 -net nic,model=virtio -net user`
4. Run the installer, and install FreeBSD:
1. Install
1. Continue with default keymap
@@ -158,10 +161,10 @@ about above), and then shut down.
poweroff
1. Exit the post install shell: `exit`
1. Back in in the installer choose Reboot
1. If all went well the machine should reboot and show a login prompt.
If you switch to the serial console by choosing View > serial0 in
the qemu menu, you should be logged in as root.
1. Back in the installer choose Reboot
1. If all went well the machine should reboot and show a login prompt. If you
switch to the serial console by choosing View > serial0 in the qemu menu,
you should be logged in as root.
1. Shutdown the machine: `shutdown -p now`
Helpful links
@@ -178,8 +181,8 @@ Helpful links
4. run installer
5. `echo 'set tty com0' >> /etc/boot.conf`
6. `echo 'boot' >> /etc/boot.conf`
7. Modify /etc/ttys, change the `tty00` at the end from 'unknown off' to
'vt220 on secure'
7. Modify /etc/ttys, change the `tty00` at the end from 'unknown off' to 'vt220
on secure'
8. Modify same line in /etc/ttys to have `"/root/foo.sh"` as the shell
9. Add this script to `/root/foo.sh`
+6 -6
View File
@@ -1,11 +1,11 @@
#!/usr/bin/env sh
set -ex
set -eux
NDK=android-ndk-r26b
wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux.zip
unzip -q ${NDK}-linux.zip
ndk=android-ndk-r27
wget --tries=20 -q "https://dl.google.com/android/repository/${ndk}-linux.zip"
unzip -q "${ndk}-linux.zip"
mv ./${NDK}/toolchains/llvm/prebuilt/linux-x86_64 /android
mv "./${ndk}/toolchains/llvm/prebuilt/linux-x86_64" /android
rm -rf ./${NDK}-linux.zip ./${NDK}
rm -rf "./${ndk}-linux.zip" "./${ndk}"
+29 -29
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
set -ex
set -eux
# Prep the SDK and emulator
#
@@ -9,33 +9,33 @@ set -ex
# located in https://github.com/appunite/docker by just wrapping it in a script
# which apparently magically accepts the licenses.
SDK=6609375
sdk=6609375
mkdir -p sdk/cmdline-tools
wget -q --tries=20 https://dl.google.com/android/repository/commandlinetools-linux-${SDK}_latest.zip
unzip -q -d sdk/cmdline-tools commandlinetools-linux-${SDK}_latest.zip
wget -q --tries=20 "https://dl.google.com/android/repository/commandlinetools-linux-${sdk}_latest.zip"
unzip -q -d sdk/cmdline-tools "commandlinetools-linux-${sdk}_latest.zip"
case "$1" in
arm | armv7)
api=24
image="system-images;android-${api};default;armeabi-v7a"
;;
aarch64)
api=24
image="system-images;android-${api};google_apis;arm64-v8a"
;;
i686)
api=28
image="system-images;android-${api};default;x86"
;;
x86_64)
api=28
image="system-images;android-${api};default;x86_64"
;;
*)
echo "invalid arch: $1"
exit 1
;;
esac;
arm | armv7)
api=24
image="system-images;android-${api};default;armeabi-v7a"
;;
aarch64)
api=24
image="system-images;android-${api};google_apis;arm64-v8a"
;;
i686)
api=28
image="system-images;android-${api};default;x86"
;;
x86_64)
api=28
image="system-images;android-${api};default;x86_64"
;;
*)
echo "invalid arch: $1"
exit 1
;;
esac
# Try to fix warning about missing file.
# See https://askubuntu.com/a/1078784
@@ -53,9 +53,9 @@ echo '#Fri Nov 03 10:11:27 CET 2017 count=0' >> /root/.android/repositories.cfg
# which produces an insane amount of output.
yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --licenses --no_https | grep -v = || true
yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --no_https \
"platform-tools" \
"platforms;android-${api}" \
"${image}" | grep -v = || true
"platform-tools" \
"platforms;android-${api}" \
"${image}" | grep -v = || true
# The newer emulator versions (31.3.12 or higher) fail to a valid AVD and the test gets stuck.
# Until we figure out why, we use the older version (31.3.11).
@@ -69,4 +69,4 @@ echo "no" |
--name "${1}" \
--package "${image}" | grep -v = || true
rm -rf commandlinetools-linux-${SDK}_latest.zip emulator-linux_x64-9058569.zip
rm -rf "commandlinetools-linux-${sdk}_latest.zip" emulator-linux_x64-9058569.zip
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -ex
set -eux
URL=https://dl.google.com/android/repository/sys-img/android
-298
View File
@@ -1,298 +0,0 @@
#!/usr/bin/env sh
# Checks that libc builds properly for all supported targets on a particular
# Rust version:
# The FILTER environment variable can be used to select which target(s) to build.
# For example: set FILTER to vxworks to select the targets that has vxworks in name
set -ex
: "${TOOLCHAIN?The TOOLCHAIN environment variable must be set.}"
: "${OS?The OS environment variable must be set.}"
RUST=${TOOLCHAIN}
echo "Testing Rust ${RUST} on ${OS}"
if [ "${TOOLCHAIN}" = "nightly" ] ; then
rustup component add rust-src
fi
test_target() {
BUILD_CMD="${1}"
TARGET="${2}"
NO_STD="${3}"
# If there is a std component, fetch it:
if [ "${NO_STD}" != "1" ]; then
# FIXME: rustup often fails to download some artifacts due to network
# issues, so we retry this N times.
N=5
n=0
until [ $n -ge $N ]
do
if rustup target add "${TARGET}" --toolchain "${RUST}" ; then
break
fi
n=$((n+1))
sleep 1
done
fi
# Test that libc builds without any default features (no std)
if [ "${NO_STD}" != "1" ]; then
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}"
else
# FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings.
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
-Z build-std=core,alloc -vv --no-default-features --target "${TARGET}"
fi
# Test that libc builds with default features (e.g. std)
# if the target supports std
if [ "$NO_STD" != "1" ]; then
cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}"
else
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
-Z build-std=core,alloc -vv --target "${TARGET}"
fi
# Test that libc builds with the `extra_traits` feature
if [ "${NO_STD}" != "1" ]; then
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
--features extra_traits
else
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
-Z build-std=core,alloc -vv --no-default-features \
--target "${TARGET}" --features extra_traits
fi
# Test the 'const-extern-fn' feature on nightly
if [ "${RUST}" = "nightly" ]; then
if [ "${NO_STD}" != "1" ]; then
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
--features const-extern-fn
else
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
-Z build-std=core,alloc -vv --no-default-features \
--target "${TARGET}" --features const-extern-fn
fi
fi
# Also test that it builds with `extra_traits` and default features:
if [ "$NO_STD" != "1" ]; then
cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" \
--features extra_traits
else
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
-Z build-std=core,alloc -vv --target "${TARGET}" \
--features extra_traits
fi
}
RUST_LINUX_TARGETS="\
aarch64-linux-android \
aarch64-unknown-linux-gnu \
arm-linux-androideabi \
arm-unknown-linux-gnueabi \
arm-unknown-linux-gnueabihf \
armv7-linux-androideabi \
armv7-unknown-linux-gnueabihf \
i586-unknown-linux-gnu \
i686-linux-android \
i686-unknown-freebsd \
i686-unknown-linux-gnu \
i686-unknown-linux-musl \
powerpc-unknown-linux-gnu \
powerpc64-unknown-linux-gnu \
powerpc64le-unknown-linux-gnu \
s390x-unknown-linux-gnu \
x86_64-unknown-freebsd \
x86_64-unknown-linux-gnu \
x86_64-unknown-linux-musl \
x86_64-unknown-netbsd \
"
RUST_GT_1_13_LINUX_TARGETS="\
arm-unknown-linux-musleabi \
arm-unknown-linux-musleabihf \
armv7-unknown-linux-musleabihf \
sparc64-unknown-linux-gnu \
wasm32-unknown-emscripten \
x86_64-linux-android \
"
RUST_GT_1_19_LINUX_TARGETS="\
aarch64-unknown-linux-musl \
sparcv9-sun-solaris \
wasm32-unknown-unknown \
"
RUST_GT_1_24_LINUX_TARGETS="\
i586-unknown-linux-musl \
"
RUST_NIGHTLY_LINUX_TARGETS="\
aarch64-unknown-fuchsia \
armv5te-unknown-linux-gnueabi \
armv5te-unknown-linux-musleabi \
i686-pc-windows-gnu \
riscv64gc-unknown-linux-gnu \
wasm32-wasi \
x86_64-fortanix-unknown-sgx \
x86_64-unknown-fuchsia \
x86_64-pc-solaris \
x86_64-pc-windows-gnu \
x86_64-unknown-illumos \
x86_64-unknown-linux-gnux32 \
x86_64-unknown-redox \
"
RUST_APPLE_TARGETS="\
aarch64-apple-ios \
x86_64-apple-darwin \
x86_64-apple-ios \
"
RUST_NIGHTLY_APPLE_TARGETS="\
aarch64-apple-darwin \
"
# Must start with `x86_64-pc-windows-msvc` first.
RUST_NIGHTLY_WINDOWS_TARGETS="\
x86_64-pc-windows-msvc \
x86_64-pc-windows-gnu \
i686-pc-windows-msvc \
"
# The targets are listed here alphabetically
TARGETS=""
case "${OS}" in
linux*)
TARGETS="${RUST_LINUX_TARGETS}"
if [ "${RUST}" != "1.13.0" ]; then
TARGETS="${TARGETS} ${RUST_GT_1_13_LINUX_TARGETS}"
if [ "${RUST}" != "1.19.0" ]; then
TARGETS="${TARGETS} ${RUST_GT_1_19_LINUX_TARGETS}"
if [ "${RUST}" != "1.24.0" ]; then
TARGETS="${TARGETS} ${RUST_GT_1_24_LINUX_TARGETS}"
fi
fi
fi
if [ "${RUST}" = "nightly" ]; then
TARGETS="${TARGETS} ${RUST_NIGHTLY_LINUX_TARGETS}"
fi
;;
macos*)
TARGETS="${RUST_APPLE_TARGETS}"
if [ "${RUST}" = "nightly" ]; then
TARGETS="${TARGETS} ${RUST_NIGHTLY_APPLE_TARGETS}"
fi
;;
windows*)
TARGETS=${RUST_NIGHTLY_WINDOWS_TARGETS}
;;
*)
;;
esac
for TARGET in $TARGETS; do
if echo "$TARGET"|grep -q "$FILTER"; then
if [ "${OS}" = "windows" ]; then
TARGET="$TARGET" sh ./ci/install-rust.sh
test_target build "$TARGET"
else
test_target build "$TARGET"
fi
fi
done
# Targets which are not available via rustup and must be built with -Zbuild-std
RUST_LINUX_NO_CORE_TARGETS="\
aarch64-pc-windows-msvc \
aarch64-unknown-freebsd \
aarch64-unknown-hermit \
aarch64-unknown-netbsd \
aarch64-unknown-openbsd \
aarch64-wrs-vxworks \
armebv7r-none-eabi \
armebv7r-none-eabihf \
armv7-wrs-vxworks-eabihf \
armv7r-none-eabi \
armv7r-none-eabihf \
hexagon-unknown-linux-musl \
i586-pc-windows-msvc \
i686-pc-windows-msvc \
i686-unknown-haiku \
i686-unknown-netbsd \
i686-unknown-openbsd \
i686-wrs-vxworks \
mips-unknown-linux-gnu \
mips-unknown-linux-musl \
mips64-unknown-linux-gnuabi64 \
mips64-unknown-linux-muslabi64 \
mips64el-unknown-linux-gnuabi64 \
mips64el-unknown-linux-muslabi64 \
mipsel-unknown-linux-gnu \
mipsel-unknown-linux-musl \
mipsel-sony-psp \
nvptx64-nvidia-cuda \
powerpc-unknown-linux-gnuspe \
powerpc-unknown-netbsd \
powerpc-wrs-vxworks \
powerpc-wrs-vxworks-spe \
powerpc64-unknown-freebsd \
powerpc64-wrs-vxworks \
riscv32i-unknown-none-elf \
riscv32imac-unknown-none-elf \
riscv32imc-unknown-none-elf \
riscv32gc-unknown-linux-gnu \
riscv64gc-unknown-freebsd \
riscv64gc-unknown-hermit \
riscv64gc-unknown-linux-musl \
riscv64gc-unknown-none-elf \
riscv64imac-unknown-none-elf \
s390x-unknown-linux-musl \
sparc-unknown-linux-gnu \
sparc64-unknown-netbsd \
thumbv6m-none-eabi \
thumbv7em-none-eabi \
thumbv7em-none-eabihf \
thumbv7m-none-eabi \
thumbv7neon-linux-androideabi \
thumbv7neon-unknown-linux-gnueabihf \
thumbv8m.main-none-eabi \
x86_64-pc-windows-msvc \
x86_64-unknown-dragonfly \
x86_64-unknown-haiku \
x86_64-unknown-hermit \
x86_64-unknown-l4re-uclibc \
x86_64-unknown-openbsd \
x86_64-wrs-vxworks \
"
if [ "${RUST}" = "nightly" ] && [ "${OS}" = "linux" ]; then
for TARGET in $RUST_LINUX_NO_CORE_TARGETS; do
if echo "$TARGET"|grep -q "$FILTER"; then
test_target build "$TARGET" 1
fi
done
fi
RUST_APPLE_NO_CORE_TARGETS="\
armv7s-apple-ios \
i686-apple-darwin \
i386-apple-ios \
"
if [ "${RUST}" = "nightly" ] && [ "${OS}" = "macos" ]; then
for TARGET in $RUST_APPLE_NO_CORE_TARGETS; do
if echo "$TARGET" | grep -q "$FILTER"; then
test_target build "$TARGET" 1
fi
done
fi
+76
View File
@@ -0,0 +1,76 @@
#!/usr/bin/env python3
"""Create a tarball of intermediate output for inspection if tests fail.
This is useful for seeing what exactly `ctest` is running.
"""
import os
import subprocess as sp
import sys
from datetime import datetime, timezone
from glob import glob
from pathlib import Path
def main():
# Find the most recently touched file named "ctest_output.c" in the target
# directory. This will be libc-tests's `OUT_DIR`
marker_files = [Path(p) for p in glob("target/**/ctest_output.c", recursive=True)]
marker_files.sort(key=lambda path: path.stat().st_mtime)
build_dir = marker_files[0].parent
print(f"Located build directory '{build_dir}'")
# Collect all relevant Rust and C files
add_files = glob("**/*.rs", recursive=True, root_dir=build_dir)
add_files += glob("**/*.c", recursive=True, root_dir=build_dir)
file_list = "\n".join(add_files).encode()
now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H%MZ")
archive_name = f"archive-{now}"
archive_path = f"{archive_name}.tar.gz"
sp.run(
["tar", "czvf", archive_path, "-C", build_dir, "-T-"],
input=file_list,
check=True,
)
# If we are in GHA, set these env vars for future use
gh_env = os.getenv("GITHUB_ENV")
if gh_env is not None:
print("Updating CI environment")
with open(gh_env, "w+") as f:
f.write(f"ARCHIVE_NAME={archive_name}\n")
f.write(f"ARCHIVE_PATH={archive_path}\n")
if __name__ == "__main__":
print("Starting script...") # For debugging CI failures
print("version: ", sys.version)
# FIXME(ci): If the windows-2025 images update to a minimum python above 3.9,
# this can be removed.
#
# Python <= 3.9 does not support the very helpful `root_dir` argument,
# and that is the version used by the Windows GHA images. Rather than
# using setup-python or doing something in the CI script, just find
# the newer version and relaunch if this happens to be run with an old
# version.
try:
glob("", root_dir="")
except TypeError as e:
if os.environ.get("CI") is None:
raise e # Just fail if we're not in CI
# Find the next 3.1x Python version
dirs = sorted(Path(r"C:\hostedtoolcache\windows\Python").iterdir())
usepy = next(x for x in dirs if r"\3.1" in str(x))
py = usepy.joinpath(r"x64\python.exe")
args = [py, __file__, *sys.argv[1:]]
print(f"relaunching with {args}")
sp.run(args, check=True)
exit()
main()
else:
print("not invoked as main, exiting") # For debugging CI failures
+23 -24
View File
@@ -1,19 +1,18 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install -y --no-install-recommends libc6-dev gcc
RUN apt-get install -y --no-install-recommends \
file \
wget \
ca-certificates \
python3 \
python3-distutils \
unzip \
expect \
openjdk-8-jre \
libstdc++6:i386 \
libpulse0
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
expect \
file \
gcc \
libc6-dev \
libpulse0 \
libstdc++6:i386 \
openjdk-8-jre \
python3 \
unzip \
wget
WORKDIR /android/
COPY android* /android/
@@ -21,8 +20,8 @@ COPY android* /android/
ENV ANDROID_ARCH=aarch64
ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools
RUN sh /android/android-install-ndk.sh
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
RUN /android/android-install-ndk.sh
RUN /android/android-install-sdk.sh $ANDROID_ARCH
RUN mv /root/.android /tmp
RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
@@ -36,12 +35,12 @@ ENV PATH=$PATH:/rust/bin \
ADD runtest-android.rs /tmp/runtest.rs
ENTRYPOINT [ \
"bash", \
"-c", \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash /android/sdk/emulator/emulator @aarch64 -no-window & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
exec \"$@\"", \
"--" \
"bash", \
"-c", \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash /android/sdk/emulator/emulator @aarch64 -no-window & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
exec \"$@\"", \
"--" \
]
@@ -1,7 +1,13 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user
ca-certificates \
gcc \
gcc-aarch64-linux-gnu \
libc6-dev \
libc6-dev-arm64-cross \
qemu-user
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" \
PATH=$PATH:/rust/bin
@@ -1,15 +1,25 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates \
gcc-aarch64-linux-gnu qemu-user
ca-certificates \
curl \
gcc \
gcc-aarch64-linux-gnu \
git \
libc6-dev \
make \
patch \
qemu-user \
rsync \
xz-utils
ARG MUSL_VERSION
COPY install-musl.sh /
RUN sh /install-musl.sh aarch64
RUN /install-musl.sh aarch64 "$MUSL_VERSION"
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std?
ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \
CC_aarch64_unknown_linux_musl=musl-gcc \
RUSTFLAGS='-Clink-args=-lgcc -L /musl-aarch64/lib' \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-aarch64 -L /musl-aarch64"
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-aarch64 -L /musl-aarch64" \
EXTRA_RUSTFLAGS="-Clink-args=-lgcc -L /musl-aarch64/lib"
+23 -24
View File
@@ -1,19 +1,18 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install -y --no-install-recommends libc6-dev gcc
RUN apt-get install -y --no-install-recommends \
file \
wget \
ca-certificates \
python3 \
python3-distutils \
unzip \
expect \
openjdk-8-jre \
libstdc++6:i386 \
libpulse0
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
expect \
file \
gcc \
libc6-dev \
libpulse0 \
libstdc++6:i386 \
openjdk-8-jre \
python3 \
unzip \
wget
WORKDIR /android/
COPY android* /android/
@@ -21,8 +20,8 @@ COPY android* /android/
ENV ANDROID_ARCH=arm
ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools
RUN sh /android/android-install-ndk.sh
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
RUN /android/android-install-ndk.sh
RUN /android/android-install-sdk.sh $ANDROID_ARCH
RUN mv /root/.android /tmp
RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
@@ -36,12 +35,12 @@ ENV PATH=$PATH:/rust/bin \
ADD runtest-android.rs /tmp/runtest.rs
ENTRYPOINT [ \
"bash", \
"-c", \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash /android/sdk/emulator/emulator @arm -no-window & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
exec \"$@\"", \
"--" \
"bash", \
"-c", \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash /android/sdk/emulator/emulator @arm -no-window & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
exec \"$@\"", \
"--" \
]
@@ -1,7 +1,16 @@
FROM ubuntu:23.10
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user
# FIXME(time): we are using an EOL release because 24.04 changes to 64-bit time
RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
/etc/apt/sources.list && \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
gcc-arm-linux-gnueabihf \
libc6-dev \
libc6-dev-armhf-cross \
qemu-user
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf" \
PATH=$PATH:/rust/bin
@@ -1,14 +1,27 @@
FROM ubuntu:23.10
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates \
gcc-arm-linux-gnueabihf qemu-user
# FIXME(time): we are using an EOL release because 24.04 changes to 64-bit time
RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
/etc/apt/sources.list && \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc \
gcc-arm-linux-gnueabihf \
git \
libc6-dev \
make \
patch \
qemu-user \
rsync \
xz-utils
ARG MUSL_VERSION
COPY install-musl.sh /
RUN sh /install-musl.sh arm
RUN /install-musl.sh arm "$MUSL_VERSION"
ENV PATH=$PATH:/musl-arm/bin:/rust/bin \
CC_arm_unknown_linux_musleabihf=musl-gcc \
CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER=musl-gcc \
CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_RUNNER="qemu-arm -L /musl-arm" \
RUSTFLAGS="-L /musl-arm/lib"
EXTRA_RUSTFLAGS="-L /musl-arm/lib"
@@ -1,8 +1,18 @@
FROM ubuntu:23.10
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-arm curl \
xz-utils patch file
# FIXME(time): we are using an EOL release because 24.04 changes to 64-bit time
RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
/etc/apt/sources.list && \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
file \
gcc \
libc6-dev \
patch \
qemu-system-arm \
qemu-user \
xz-utils
RUN mkdir /toolchain
@@ -1,12 +1,11 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
# This is a workaround to avoid the interaction with tzdata.
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=America/New_York
RUN apt-get update
RUN apt-get install -y --no-install-recommends tzdata
RUN apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
curl \
gcc \
@@ -14,12 +13,11 @@ RUN apt-get install -y --no-install-recommends \
libc6-dev \
libxml2 \
python3 \
python3-distutils \
xz-utils \
bzip2
tzdata \
xz-utils
COPY emscripten.sh /
RUN bash /emscripten.sh
RUN /emscripten.sh
ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node
+23 -24
View File
@@ -1,19 +1,18 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install -y --no-install-recommends libc6-dev gcc
RUN apt-get install -y --no-install-recommends \
file \
wget \
ca-certificates \
python3 \
python3-distutils \
unzip \
expect \
openjdk-8-jre \
libstdc++6:i386 \
libpulse0
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
expect \
gcc \
libc6-dev \
libpulse0 \
libstdc++6:i386 \
openjdk-8-jre \
python3 \
unzip \
wget \
file
WORKDIR /android/
COPY android* /android/
@@ -21,8 +20,8 @@ COPY android* /android/
ENV ANDROID_ARCH=i686
ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools
RUN sh /android/android-install-ndk.sh
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
RUN /android/android-install-ndk.sh
RUN /android/android-install-sdk.sh $ANDROID_ARCH
RUN mv /root/.android /tmp
RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
@@ -36,12 +35,12 @@ ENV PATH=$PATH:/rust/bin \
ADD runtest-android.rs /tmp/runtest.rs
ENTRYPOINT [ \
"bash", \
"-c", \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash /android/sdk/emulator/emulator @i686 -no-window -no-accel & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
exec \"$@\"", \
"--" \
"bash", \
"-c", \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash /android/sdk/emulator/emulator @i686 -no-window -no-accel & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
exec \"$@\"", \
"--" \
]
+9 -3
View File
@@ -1,5 +1,11 @@
FROM ubuntu:23.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc-multilib libc6-dev ca-certificates
# FIXME(time): we are using an EOL release because 24.04 changes to 64-bit time
RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
/etc/apt/sources.list && \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gcc-multilib \
libc6-dev
ENV PATH=$PATH:/rust/bin
+18 -6
View File
@@ -1,13 +1,25 @@
FROM ubuntu:23.10
RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc-multilib make libc6-dev git curl ca-certificates libc6-i386
# FIXME(time): we are using an EOL release because 24.04 changes to 64-bit time
RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
/etc/apt/sources.list && \
dpkg --add-architecture i386 && \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc-multilib \
git \
libc6-dev \
libc6-i386 \
make \
patch \
rsync \
xz-utils
ARG MUSL_VERSION
COPY install-musl.sh /
RUN sh /install-musl.sh i686
RUN /install-musl.sh i686 "$MUSL_VERSION"
ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
CC_i686_unknown_linux_musl=musl-gcc \
RUSTFLAGS="-L /musl-i686/lib"
EXTRA_RUSTFLAGS="-L /musl-i686/lib"
@@ -0,0 +1,15 @@
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
gcc-14-loongarch64-linux-gnu \
libc6-dev \
libc6-dev-loong64-cross \
qemu-user
ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=loongarch64-linux-gnu-gcc-14 \
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-loongarch64 -L /usr/loongarch64-linux-gnu" \
CC_loongarch64_unknown_linux_gnu=loongarch64-linux-gnu-gcc-14 \
CFLAGS_loongarch64_unknown_linux_gnu="-mabi=lp64d -fPIC" \
PATH=$PATH:/rust/bin
@@ -0,0 +1,26 @@
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc \
gcc-14-loongarch64-linux-gnu \
git \
libc6-dev \
make \
patch \
qemu-user \
rsync \
xz-utils
ARG MUSL_VERSION
COPY install-musl.sh /
RUN /install-musl.sh loongarch64 "$MUSL_VERSION"
ENV CC_loongarch64_unknown_linux_musl=musl-gcc \
CFLAGS_loongarch64_unknown_linux_musl="-mabi=lp64d -fPIC" \
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-loongarch64" \
EXTRA_RUSTFLAGS="-Ctarget-feature=+crt-static" \
QEMU_LD_PREFIX=/musl-loongarch64 \
PATH=$PATH:/musl-loongarch64/bin:/rust/bin
@@ -1,10 +0,0 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-mips-linux-gnu libc6-dev-mips-cross \
qemu-system-mips linux-headers-generic
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \
PATH=$PATH:/rust/bin
@@ -1,25 +0,0 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
xz-utils patch
RUN mkdir /toolchain
# Linux kernel version: 5.4.154
# See build_dir/target-mips_24kc_musl/linux-ath79_generic/linux-5.4.154
# Musl version: 1.1.24
# See staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/info.mk
RUN curl --retry 5 -L https://downloads.openwrt.org/releases/21.02.1/targets/ath79/generic/openwrt-sdk-21.02.1-ath79-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz | \
tar xJf - -C /toolchain --strip-components=1
# See https://lkml.org/lkml/2014/3/14/269
COPY sysinfo_guard.patch /toolchain
RUN patch /toolchain/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/include/linux/kernel.h </toolchain/sysinfo_guard.patch
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/bin \
STAGING_DIR=/toolchain/staging_dir \
CC_mips_unknown_linux_musl=mips-openwrt-linux-musl-gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-musl-gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl" \
RUSTFLAGS="-L /toolchain/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/lib"
@@ -1,11 +0,0 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
qemu-system-mips64 linux-headers-generic
ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64" \
CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \
PATH=$PATH:/rust/bin
@@ -1,15 +0,0 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates \
gcc-mips64-linux-gnuabi64 qemu-user
COPY install-musl.sh /
RUN sh /install-musl.sh mips64
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd?
ENV PATH=$PATH:/musl-mips64/bin:/rust/bin \
CC_mips64_unknown_linux_muslabi64=musl-gcc \
RUSTFLAGS='-Clink-args=-lgcc -L /musl-mips64/lib' \
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_MUSLABI64_LINKER=musl-gcc \
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_MUSLABI64_RUNNER="qemu-mips64 -L /musl-mips64"
@@ -1,11 +0,0 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \
qemu-system-mips64el linux-headers-generic
ENV CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_LINKER=mips64el-linux-gnuabi64-gcc \
CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64el -L /usr/mips64el-linux-gnuabi64" \
CC_mips64el_unknown_linux_gnuabi64=mips64el-linux-gnuabi64-gcc \
PATH=$PATH:/rust/bin
@@ -1,15 +0,0 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates \
gcc-mips64el-linux-gnuabi64 qemu-user
COPY install-musl.sh /
RUN sh /install-musl.sh mips64el
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd?
ENV PATH=$PATH:/musl-mips64el/bin:/rust/bin \
CC_mips64el_unknown_linux_muslabi64=musl-gcc \
RUSTFLAGS='-Clink-args=-lgcc -L /musl-mips64el/lib' \
CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_MUSLABI64_LINKER=musl-gcc \
CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_MUSLABI64_RUNNER="qemu-mips64el -L /musl-mips64el"
@@ -1,25 +0,0 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-mipsel curl \
xz-utils patch
RUN mkdir /toolchain
# Linux kernel version: 5.4.154
# See build_dir/target-mipsel_mips32_musl/linux-brcm47xx_generic/linux-5.4.154
# Musl version: 1.1.24
# See staging_dir/toolchain-mipsel_mips32_gcc-8.4.0_musl/info.mk
RUN curl --retry 5 -L https://downloads.openwrt.org/releases/21.02.1/targets/bcm47xx/generic/openwrt-sdk-21.02.1-bcm47xx-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz | \
tar xJf - -C /toolchain --strip-components=1
# See https://lkml.org/lkml/2014/3/14/269
COPY sysinfo_guard.patch /toolchain
RUN patch /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-8.4.0_musl/include/linux/kernel.h </toolchain/sysinfo_guard.patch
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mipsel_mips32_gcc-8.4.0_musl/bin \
STAGING_DIR=/toolchain/staging_dir \
CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-musl-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-musl-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-8.4.0_musl" \
RUSTFLAGS="-L /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-8.4.0_musl/lib"
@@ -1,22 +0,0 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-mipsel curl \
xz-utils patch
RUN mkdir /toolchain
# binutils 2.33.1
# gcc 9.3.0
# gdb 8.3.1
# linux-headers 4.9.234
# uclibc 1.0.34
RUN curl --retry 5 -L https://toolchains.bootlin.com/downloads/releases/toolchains/mips32el/tarballs/mips32el--uclibc--stable-2020.08-1.tar.bz2 | \
tar xjf - -C /toolchain --strip-components=1
RUN /toolchain/relocate-sdk.sh
ENV PATH=$PATH:/rust/bin:/toolchain/bin \
STAGING_DIR=/toolchain/mipsel-buildroot-linux-uclibc/sysroot \
CC_mipsel_unknown_linux_uclibc=mipsel-buildroot-linux-uclibc-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_UCLIBC_LINKER=mipsel-buildroot-linux-uclibc-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_UCLIBC_RUNNER="qemu-mipsel -L /toolchain/mipsel-buildroot-linux-uclibc/sysroot/"
+11 -4
View File
@@ -1,9 +1,16 @@
FROM ubuntu:23.10
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \
qemu-system-ppc
# FIXME(time): we are using an EOL release because 24.04 changes to 64-bit time
RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
/etc/apt/sources.list && \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
gcc-powerpc-linux-gnu \
libc6-dev \
libc6-dev-powerpc-cross \
qemu-system-ppc \
qemu-user
ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \
CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc -L /usr/powerpc-linux-gnu" \
@@ -1,9 +1,13 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \
qemu-system-ppc
ca-certificates \
gcc \
gcc-powerpc64-linux-gnu \
libc6-dev \
libc6-dev-ppc64-cross \
qemu-system-ppc \
qemu-user
ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu" \
@@ -1,9 +1,13 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross \
qemu-system-ppc
ca-certificates \
gcc \
gcc-powerpc64le-linux-gnu \
libc6-dev \
libc6-dev-ppc64el-cross \
qemu-system-ppc \
qemu-user
ENV CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc \
CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64le -L /usr/powerpc64le-linux-gnu" \
@@ -0,0 +1,25 @@
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc \
gcc-powerpc64le-linux-gnu \
git \
libc6-dev \
make \
patch \
qemu-user \
rsync \
xz-utils
ARG MUSL_VERSION
COPY install-musl.sh /
RUN /install-musl.sh powerpc64le "$MUSL_VERSION"
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std?
ENV PATH=$PATH:/musl-powerpc64/bin:/rust/bin \
CC_powerpc64le_unknown_linux_musl=musl-gcc \
CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_MUSL_RUNNER="qemu-ppc64le -L /musl-powerpc64" \
EXTRA_RUSTFLAGS="-Clink-args=-lgcc -L /musl-powerpc64/lib"
@@ -1,9 +1,13 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-riscv64-linux-gnu libc6-dev-riscv64-cross \
qemu-system-riscv64 linux-headers-generic
ca-certificates \
gcc \
gcc-riscv64-linux-gnu \
libc6-dev \
libc6-dev-riscv64-cross \
qemu-system-riscv64 \
qemu-user
ENV CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER=riscv64-linux-gnu-gcc \
CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_RUNNER="qemu-riscv64 -L /usr/riscv64-linux-gnu" \
+10 -7
View File
@@ -1,14 +1,17 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates \
gcc libc6-dev \
gcc-s390x-linux-gnu libc6-dev-s390x-cross \
qemu-system-s390x \
cpio
ca-certificates \
cpio \
curl \
gcc \
gcc-s390x-linux-gnu \
libc6-dev \
libc6-dev-s390x-cross \
qemu-system-s390x
COPY linux-s390x.sh /
RUN bash /linux-s390x.sh
RUN /linux-s390x.sh
COPY test-runner-linux /
+14 -9
View File
@@ -1,17 +1,22 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates \
gcc \
gcc-s390x-linux-gnu \
qemu-user
curl \
ca-certificates \
gcc \
gcc-s390x-linux-gnu \
qemu-user \
xz-utils \
patch \
rsync
ARG MUSL_VERSION
COPY install-musl.sh /
RUN sh /install-musl.sh s390x
RUN /install-musl.sh s390x "$MUSL_VERSION"
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std?
ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \
ENV CC_s390x_unknown_linux_gnu=musl-gcc \
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /musl-s390x" \
CC_s390x_unknown_linux_gnu=musl-gcc \
RUSTFLAGS='-Clink-args=-lgcc -L /musl-s390x/lib' \
EXTRA_RUSTFLAGS="-Clink-args=-lgcc -L /musl-s390x/lib" \
PATH=$PATH:/musl-s390x/bin:/rust/bin
+9 -12
View File
@@ -1,18 +1,15 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates \
gcc libc6-dev \
gcc-sparc64-linux-gnu libc6-dev-sparc64-cross \
qemu-system-sparc64 openbios-sparc seabios ipxe-qemu \
p7zip-full cpio linux-libc-dev-sparc64-cross
COPY linux-sparc64.sh /
RUN bash /linux-sparc64.sh
COPY test-runner-linux /
ca-certificates \
gcc \
gcc-sparc64-linux-gnu \
libc6-dev \
libc6-dev-sparc64-cross \
qemu-system-sparc64 \
qemu-user
ENV CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_LINKER=sparc64-linux-gnu-gcc \
CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_RUNNER="/test-runner-linux sparc64" \
CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-sparc64 -L /usr/sparc64-linux-gnu" \
CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \
PATH=$PATH:/rust/bin
+11 -13
View File
@@ -1,33 +1,31 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
# This is a workaround to avoid the interaction with tzdata.
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=America/New_York
RUN apt-get update
RUN apt-get install -y --no-install-recommends tzdata
RUN apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
g++ \
make \
file \
cmake \
curl \
file \
g++ \
gcc \
gdb \
git \
libc6-dev \
libxml2 \
make \
python3 \
python3-distutils \
cmake \
tzdata \
sudo \
gdb \
xz-utils \
bzip2
xz-utils
RUN ln -s /usr/bin/python3 /usr/bin/python & \
ln -s /usr/bin/pip3 /usr/bin/pip
COPY emscripten.sh /
RUN bash /emscripten.sh
RUN /emscripten.sh
ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wrapper.sh
@@ -1,11 +1,11 @@
#!/bin/sh
set -e
set -eux
me=$1
me="$1"
shift
dir=$(dirname $me)
file=$(basename $me)
dir=$(dirname "$me")
file=$(basename "$me")
cd $dir
exec node $file "$@"
cd "$dir"
exec node "$file" "$@"
-40
View File
@@ -1,40 +0,0 @@
FROM ubuntu:23.10
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
clang \
curl \
git \
libc6-dev \
make \
xz-utils
# Note that we're using `git reset --hard` to pin to a specific commit for
# verification for now. The sysroot is currently in somewhat of a state of flux
# and is expected to have breaking changes, so this is an attempt to mitigate
# those breaking changes on `libc`'s own CI
RUN git clone https://github.com/WebAssembly/wasi-libc && \
cd wasi-libc && \
git reset --hard ad5133410f66b93a2381db5b542aad5e0964db96
RUN apt-get install -y --no-install-recommends llvm
RUN make -C wasi-libc install -j $(nproc) INSTALL_DIR=/wasi-libc
RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | \
tar xJf -
ENV PATH=$PATH:/wasmtime-dev-x86_64-linux
COPY docker/wasm32-wasi/clang.sh /wasi-libc/bin/clang
RUN apt-get install -y --no-install-recommends lld
RUN ln -s /usr/bin/wasm-ld-10 /usr/bin/wasm-ld
ENV PATH=$PATH:/usr/lib/llvm-10/bin
# Of note here is our clang wrapper which just executes a normal clang
# executable with the right sysroot, and then we're sure to turn off the
# crt-static feature to ensure that the CRT that we're specifying with `clang`
# is used.
ENV CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime \
CARGO_TARGET_WASM32_WASI_LINKER=/wasi-libc/bin/clang \
CC_wasm32_wasi=/wasi-libc/bin/clang \
PATH=$PATH:/rust/bin \
RUSTFLAGS=-Ctarget-feature=-crt-static
-2
View File
@@ -1,2 +0,0 @@
#!/usr/bin/env sh
exec /usr/bin/clang --target=wasm32-wasi --sysroot /wasi-libc/sysroot "$@"
+16
View File
@@ -0,0 +1,16 @@
FROM ubuntu:25.04
COPY wasi.sh /
RUN /wasi.sh
# Note that `-D_WASI_EMULATED_PROCESS_CLOCKS` is used to enable access to
# clock-related defines even though they're emulated. Also note that the usage
# of `-Ctarget-feature=-crt-static` here forces usage of the external wasi-libc
# installed via `wasi-sdk` instead of the version that comes with the standard
# library.
ENV CARGO_TARGET_WASM32_WASIP1_RUNNER=wasmtime \
CARGO_TARGET_WASM32_WASIP1_LINKER=/opt/wasi-sdk/bin/clang \
EXTRA_RUSTFLAGS="-Clink-self-contained=n -lwasi-emulated-process-clocks" \
CC_wasm32_wasip1=/opt/wasi-sdk/bin/clang \
CFLAGS_wasm32_wasip1=-D_WASI_EMULATED_PROCESS_CLOCKS \
PATH=$PATH:/rust/bin:/wasmtime
+15
View File
@@ -0,0 +1,15 @@
FROM ubuntu:25.04
COPY wasi.sh /
RUN /wasi.sh
# Note that most of these are copied from `wasm32-wasip1/Dockerfile`
#
# FIXME: the `-Clink-arg` to export `cabi_realloc` is a bug in the target
# itself, this should be fixed upstream.
ENV CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime \
CARGO_TARGET_WASM32_WASIP2_LINKER=/opt/wasi-sdk/bin/clang \
EXTRA_RUSTFLAGS="-Clink-self-contained=n -lwasi-emulated-process-clocks -Clink-arg=-Wl,--export,cabi_realloc" \
CC_wasm32_wasip2=/opt/wasi-sdk/bin/clang \
CFLAGS_wasm32_wasip2=-D_WASI_EMULATED_PROCESS_CLOCKS \
PATH=$PATH:/rust/bin:/wasmtime
+10 -12
View File
@@ -1,24 +1,22 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
wget \
gcc \
libc-dev \
python3 \
python3-distutils \
unzip
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc-dev \
python3 \
unzip \
wget
WORKDIR /android/
ENV ANDROID_ARCH=x86_64
COPY android-install-ndk.sh /android/
RUN sh /android/android-install-ndk.sh
RUN /android/android-install-ndk.sh
# We do not run x86_64-linux-android tests on an android emulator.
# See ci/android-sysimage.sh for information about how tests are run.
COPY android-sysimage.sh /android/
RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip
RUN /android/android-sysimage.sh x86_64 x86_64-24_r07.zip
ENV PATH=$PATH:/rust/bin:/android/linux-x86_64/bin \
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android28-clang \
@@ -1,7 +1,9 @@
FROM ubuntu:23.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates linux-headers-generic
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc6-dev
RUN apt search linux-headers
RUN ls /usr/src
@@ -1,5 +1,8 @@
FROM ubuntu:23.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc-multilib libc6-dev ca-certificates
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gcc-multilib \
libc6-dev
ENV PATH=$PATH:/rust/bin
+14 -6
View File
@@ -1,11 +1,19 @@
FROM ubuntu:23.10
FROM ubuntu:25.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc \
git \
libc6-dev \
make \
patch \
rsync \
xz-utils
ARG MUSL_VERSION
COPY install-musl.sh /
RUN sh /install-musl.sh x86_64
RUN /install-musl.sh x86_64 "$MUSL_VERSION"
ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin \
RUSTFLAGS="-L /musl-x86_64/lib"
EXTRA_RUSTFLAGS="-L /musl-x86_64/lib"
-82
View File
@@ -1,82 +0,0 @@
#!/usr/bin/env sh
# Builds documentation for all target triples that we have a registered URL for
# in liblibc. This scrapes the list of triples to document from `src/lib.rs`
# which has a bunch of `html_root_url` directives we pick up.
set -ex
TARGET_DOC_DIR="target/doc"
README="README.md"
PLATFORM_SUPPORT="platform-support.md"
rm -rf "$TARGET_DOC_DIR"
mkdir -p "$TARGET_DOC_DIR"
if ! rustc --version | grep -E "nightly" ; then
echo "Building the documentation requires a nightly Rust toolchain"
exit 1
fi
rustup component add rust-src
# List all targets that do currently build successfully:
# shellcheck disable=SC1003
grep '[\d|\w|-]* \\' ci/build.sh > targets
sed -i.bak 's/ \\//g' targets
grep '^[_a-zA-Z0-9-]*$' targets | sort > tmp && mv tmp targets
# Create a markdown list of supported platforms in $PLATFORM_SUPPORT
rm $PLATFORM_SUPPORT || true
printf '### Platform-specific documentation\n' >> $PLATFORM_SUPPORT
while read -r target; do
echo "documenting ${target}"
case "${target}" in
*apple*)
# FIXME:
# We can't build docs of apple targets from Linux yet.
continue
;;
*)
;;
esac
rustup target add "${target}" || true
# Enable extra configuration flags:
export RUSTDOCFLAGS="--cfg freebsd11"
# If cargo doc fails, then try with unstable feature:
if ! cargo doc --target "${target}" \
--no-default-features --features const-extern-fn,extra_traits ; then
cargo doc --target "${target}" \
-Z build-std=core,alloc \
--no-default-features --features const-extern-fn,extra_traits
fi
mkdir -p "${TARGET_DOC_DIR}/${target}"
cp -r "target/${target}/doc" "${TARGET_DOC_DIR}/${target}"
echo "* [${target}](${target}/doc/libc/index.html)" >> $PLATFORM_SUPPORT
done < targets
# Replace <div class="platform_support"></div> with the contents of $PLATFORM_SUPPORT
cp $README $TARGET_DOC_DIR
line=$(grep -n '<div class="platform_docs"></div>' $README | cut -d ":" -f 1)
{ head -n "$((line-1))" $README; cat $PLATFORM_SUPPORT; tail -n "+$((line+1))" $README; } > $TARGET_DOC_DIR/$README
cp $TARGET_DOC_DIR/$README $TARGET_DOC_DIR/index.md
RUSTDOCFLAGS="--enable-index-page --index-page=${TARGET_DOC_DIR}/index.md -Zunstable-options" cargo doc
# Tweak style
cp ci/rust.css $TARGET_DOC_DIR
sed -ie "8i <link rel=\"stylesheet\" type=\"text/css\" href=\"normalize.css\">" $TARGET_DOC_DIR/index.html
sed -ie "9i <link rel=\"stylesheet\" type=\"text/css\" href=\"rust.css\">" $TARGET_DOC_DIR/index.html
# Copy the licenses
cp LICENSE-* $TARGET_DOC_DIR/
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -ex
set -eux
# shellcheck disable=SC1091
source /emsdk-portable/emsdk_env.sh &> /dev/null
+6 -6
View File
@@ -1,15 +1,15 @@
#!/usr/bin/env bash
set -ex
set -eux
# FIXME: 3.1.21 removed a lot of header files (https://github.com/emscripten-core/emscripten/pull/17704).
# We have to tweak libc-test (and deprecate unsupported items, maybe) when updating emsdk.
EMSDK_VERSION=3.1.20
# Note: keep in sync with:
# https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-unknown-emscripten.md#requirements
emsdk_version=3.1.68
git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable
cd /emsdk-portable
./emsdk install "${EMSDK_VERSION}"
./emsdk activate "${EMSDK_VERSION}"
./emsdk install "$emsdk_version"
./emsdk activate "$emsdk_version"
# Compile and cache libc
# shellcheck disable=SC1091
+108 -21
View File
@@ -1,30 +1,50 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Install musl and musl-sanitized linux kernel headers
# to musl-{$1} directory
set -ex
set -eux
MUSL_VERSION=1.1.24
MUSL="musl-${MUSL_VERSION}"
arch="$1"
version="$2"
old_musl=1.1.24
new_musl=1.2.5
# Download, configure, build, and install musl:
curl --retry 5 https://www.musl-libc.org/releases/${MUSL}.tar.gz | tar xzf -
case "$arch" in
loongarch64) musl_version="$new_musl" ;;
*)
case "$version" in
old) musl_version="$old_musl" ;;
new) musl_version="$new_musl" ;;
*)
echo "musl version must be set to either 'old' or 'new'"
exit 1
;;
esac
;;
esac
cd $MUSL
musl="musl-${musl_version}"
# Note that if a new version of musl is needed, it needs to be added to the mirror
# first. See https://github.com/rust-lang/ci-mirrors/blob/main/files/libc.toml.
curl --retry 5 "https://ci-mirrors.rust-lang.org/libc/${musl}.tar.gz" | tar xzf -
# Configure, build, and install musl:
cd "$musl"
case ${1} in
aarch64)
musl_arch=aarch64
kernel_arch=arm64
CC=aarch64-linux-gnu-gcc \
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
make install -j4
;;
arm)
musl_arch=arm
kernel_arch=arm
CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv6 -marm -mfpu=vfp" \
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
make install -j4
;;
i686)
@@ -35,7 +55,7 @@ case ${1} in
# Specifically pass -m32 in CFLAGS and override CC when running
# ./configure, since otherwise the script will fail to find a compiler.
CC=gcc CFLAGS="-m32" \
./configure --prefix="/musl-${musl_arch}" --disable-shared --target=i686
./configure --prefix="/musl-${musl_arch}" --disable-shared --target=i686
# unset CROSS_COMPILE when running make; otherwise the makefile will
# call the non-existent binary 'i686-ar'.
make CROSS_COMPILE= install -j4
@@ -50,7 +70,21 @@ case ${1} in
musl_arch=s390x
kernel_arch=s390
CC=s390x-linux-gnu-gcc \
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
make install -j4
;;
loongarch64)
musl_arch=loongarch64
kernel_arch=loongarch
CC=loongarch64-linux-gnu-gcc-14 \
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
make install -j4
;;
powerpc64*)
musl_arch=powerpc64
kernel_arch=powerpc
CC="${1}-linux-gnu-gcc" CFLAGS="-mlong-double-64" \
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
make install -j4
;;
*)
@@ -59,18 +93,71 @@ case ${1} in
;;
esac
# shellcheck disable=SC2103
cd ..
rm -rf $MUSL
rm -rf "$musl"
# Download, configure, build, and install musl-sanitized kernel headers:
KERNEL_HEADER_VER="4.19.88"
curl --retry 5 -L \
"https://github.com/sabotage-linux/kernel-headers/archive/v${KERNEL_HEADER_VER}.tar.gz" | \
tar xzf -
# Download, configure, build, and install musl-sanitized kernel headers.
# Alpine follows stable kernel releases, 3.20 uses Linux 6.6 headers.
alpine_version=3.20
alpine_git=https://gitlab.alpinelinux.org/alpine/aports
# This routine piggybacks on: https://git.alpinelinux.org/aports/tree/main/linux-headers?h=3.20-stable
git clone -n --depth=1 --filter=tree:0 -b "${alpine_version}-stable" "$alpine_git"
(
cd kernel-headers-${KERNEL_HEADER_VER}
make ARCH="${kernel_arch}" prefix="/musl-${musl_arch}" install -j4
cd aports
git sparse-checkout set --no-cone main/linux-headers
git checkout
cd main/linux-headers
cp APKBUILD APKBUILD.vars
cat <<- EOF >> APKBUILD.vars
echo "\$source" > alpine-source
echo "\$_kernver" > alpine-kernver
echo "\$pkgver" > alpine-pkgver
echo "\$sha512sums" > alpine-sha512sums
EOF
# Use a mirror since kernel.org can be a bit inconsistent
sed -i 's|https://kernel.org/pub/linux/kernel|https://ci-mirrors.rust-lang.org/linux/kernel|g' \
APKBUILD.vars
cat APKBUILD.vars
# Retrieve all the variables
sh APKBUILD.vars
kernel_version=$(tr -d "[:space:]" < alpine-kernver)
pkg_version=$(tr -d "[:space:]" < alpine-pkgver)
urls=$(grep -o 'https.*' alpine-source)
kernel=""
patch=""
for url in $urls; do
base=$(basename "$url")
curl --retry 5 -L "$url" > "$base"
case $base in
linux-*) kernel=$base ;;
patch-*) patch=$base ;;
esac
# Check if file is known
grep -o "$base" alpine-sha512sums
done
# Double check checksums
sha512sum -c alpine-sha512sums
# Extract, apply patches, compile and install headers
tar -xf "$kernel"
cd "linux-$kernel_version"
if [ "$pkg_version" != "$kernel_version" ]; then
unxz -c < "../$patch" | patch -p1
fi
for p in ../*.patch; do
patch -p1 < "$p"
done
make headers_install ARCH="${kernel_arch}" INSTALL_HDR_PATH="/musl-${musl_arch}"
)
rm -rf kernel-headers-${KERNEL_HEADER_VER}
rm -rf aports
+51 -48
View File
@@ -1,60 +1,63 @@
#!/usr/bin/env sh
# This is intended to be used in CI only.
set -ex
set -eux
echo "Setup toolchain"
toolchain=
if [ -n "$TOOLCHAIN" ]; then
toolchain=$TOOLCHAIN
else
toolchain=nightly
fi
if [ "$OS" = "windows" ]; then
: "${TARGET?The TARGET environment variable must be set.}"
rustup set profile minimal
rustup update --force $toolchain-"$TARGET"
rustup default $toolchain-"$TARGET"
else
rustup set profile minimal
rustup update --force $toolchain
rustup default $toolchain
toolchain="${TOOLCHAIN:-nightly}"
os="${OS:-}"
case "$(uname -s)" in
Linux*) os=linux ;;
Darwin*) os=macos ;;
MINGW*) os=windows ;;
*)
echo "Unknown system $(uname -s)"
exit 1
;;
esac
if [ "$os" = "windows" ] && [ -n "${TARGET:-}" ]; then
toolchain="$toolchain-$TARGET"
rustup set profile minimal
fi
if [ -n "$TARGET" ]; then
echo "Install target"
rustup target add "$TARGET"
rustup set profile minimal
rustup update --force "$toolchain" --no-self-update
rustup default "$toolchain"
if [ -n "${TARGET:-}" ]; then
echo "Install target"
rustup target add "$TARGET"
fi
if [ -n "$INSTALL_RUST_SRC" ]; then
echo "Install rust-src"
rustup component add rust-src
if [ -n "${INSTALL_RUST_SRC:-}" ]; then
echo "Install rust-src"
rustup component add rust-src
fi
if [ "$OS" = "windows" ]; then
if [ "$ARCH_BITS" = "i686" ]; then
echo "Install MinGW32"
choco install mingw --x86 --force
fi
if [ "$os" = "windows" ]; then
if [ "${ARCH_BITS:-}" = "i686" ]; then
echo "Install MinGW32"
choco install mingw --x86 --force
fi
echo "Find GCC libraries"
gcc -print-search-dirs
/usr/bin/find "C:\ProgramData\Chocolatey" -name "crt2*"
/usr/bin/find "C:\ProgramData\Chocolatey" -name "dllcrt2*"
/usr/bin/find "C:\ProgramData\Chocolatey" -name "libmsvcrt*"
echo "Find GCC libraries"
gcc -print-search-dirs
/usr/bin/find "C:\ProgramData\Chocolatey" -name "crt2*"
/usr/bin/find "C:\ProgramData\Chocolatey" -name "dllcrt2*"
/usr/bin/find "C:\ProgramData\Chocolatey" -name "libmsvcrt*"
if [ -n "$ARCH_BITS" ]; then
echo "Fix MinGW"
for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do
cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS/$ARCH-w64-mingw32/lib/$i" "$(rustc --print sysroot)/lib/rustlib/$TARGET/lib"
done
fi
if [ -n "${ARCH_BITS:-}" ]; then
echo "Fix MinGW"
for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a; do
cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS/$ARCH-w64-mingw32/lib/$i" "$(rustc --print sysroot)/lib/rustlib/$TARGET/lib"
done
fi
fi
echo "Query rust and cargo versions"
command -v rustc
command -v cargo
command -v rustup
rustc -Vv
cargo -V
rustup -Vv
@@ -63,11 +66,11 @@ rustup show
echo "Generate lockfile"
N=5
n=0
until [ $n -ge $N ]
do
if cargo generate-lockfile; then
break
fi
n=$((n+1))
sleep 1
until [ $n -ge $N ]; do
if cargo generate-lockfile; then
break
fi
n=$((n + 1))
sleep 1
done
+66 -44
View File
@@ -6,18 +6,25 @@
// (https://github.com/snipsco/dinghy): cargo dinghy install, then cargo dinghy
// test.
use std::env;
use std::fs::{self, File};
use std::fs::{
self,
File,
};
use std::io::Write;
use std::path::Path;
use std::process;
use std::process::Command;
use std::{
env,
process,
};
macro_rules! t {
($e:expr) => (match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with: {}", stringify!($e), e),
})
($e:expr) => {
match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with: {e}", stringify!($e)),
}
};
}
// Step one: Wrap as an app
@@ -25,11 +32,15 @@ fn package_as_simulator_app(crate_name: &str, test_binary_path: &Path) {
println!("Packaging simulator app");
drop(fs::remove_dir_all("ios_simulator_app"));
t!(fs::create_dir("ios_simulator_app"));
t!(fs::copy(test_binary_path,
Path::new("ios_simulator_app").join(crate_name)));
t!(fs::copy(
test_binary_path,
Path::new("ios_simulator_app").join(crate_name)
));
let mut f = t!(File::create("ios_simulator_app/Info.plist"));
t!(f.write_all(format!(r#"
t!(f.write_all(
format!(
r#"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC
"-//Apple//DTD PLIST 1.0//EN"
@@ -42,7 +53,11 @@ fn package_as_simulator_app(crate_name: &str, test_binary_path: &Path) {
<string>com.rust.unittests</string>
</dict>
</plist>
"#, crate_name).as_bytes()));
"#,
crate_name
)
.as_bytes()
));
}
// Step two: Start the iOS simulator
@@ -57,8 +72,10 @@ fn start_simulator() {
for line in stdout.lines() {
if line.contains("rust_ios") {
if found_rust_sim {
panic!("Duplicate rust_ios simulators found. Please \
double-check xcrun simctl list.");
panic!(
"Duplicate rust_ios simulators found. Please \
double-check xcrun simctl list."
);
}
simulator_exists = true;
simulator_booted = line.contains("(Booted)");
@@ -69,62 +86,67 @@ fn start_simulator() {
if simulator_exists == false {
println!("Creating iOS simulator");
Command::new("xcrun")
.arg("simctl")
.arg("create")
.arg("rust_ios")
.arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE")
.arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2")
.check_status();
.arg("simctl")
.arg("create")
.arg("rust_ios")
.arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE")
.arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2")
.check_status();
} else if simulator_booted == true {
println!("Shutting down already-booted simulator");
Command::new("xcrun")
.arg("simctl")
.arg("shutdown")
.arg("rust_ios")
.check_status();
.arg("simctl")
.arg("shutdown")
.arg("rust_ios")
.check_status();
}
println!("Starting iOS simulator");
// We can't uninstall the app (if present) as that will hang if the
// simulator isn't completely booted; just erase the simulator instead.
Command::new("xcrun").arg("simctl").arg("erase").arg("rust_ios").check_status();
Command::new("xcrun").arg("simctl").arg("boot").arg("rust_ios").check_status();
Command::new("xcrun")
.arg("simctl")
.arg("erase")
.arg("rust_ios")
.check_status();
Command::new("xcrun")
.arg("simctl")
.arg("boot")
.arg("rust_ios")
.check_status();
}
// Step three: Install the app
fn install_app_to_simulator() {
println!("Installing app to simulator");
Command::new("xcrun")
.arg("simctl")
.arg("install")
.arg("booted")
.arg("ios_simulator_app/")
.check_status();
.arg("simctl")
.arg("install")
.arg("booted")
.arg("ios_simulator_app/")
.check_status();
}
// Step four: Run the app
fn run_app_on_simulator() {
println!("Running app");
let output = t!(Command::new("xcrun")
.arg("simctl")
.arg("launch")
.arg("--console")
.arg("booted")
.arg("com.rust.unittests")
.output());
.arg("simctl")
.arg("launch")
.arg("--console")
.arg("booted")
.arg("com.rust.unittests")
.output());
println!("status: {}", output.status);
println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout));
println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr));
let stdout = String::from_utf8_lossy(&output.stdout);
let passed = stdout.lines()
.find(|l|
(l.contains("PASSED") &&
l.contains("tests")) ||
l.contains("test result: ok")
)
.unwrap_or(false);
let passed = stdout
.lines()
.find(|l| (l.contains("PASSED") && l.contains("tests")) || l.contains("test result: ok"))
.unwrap_or(false);
println!("Shutting down simulator");
Command::new("xcrun")
@@ -143,7 +165,7 @@ trait CheckStatus {
impl CheckStatus for Command {
fn check_status(&mut self) {
println!("\trunning: {:?}", self);
println!("\trunning: {self:?}");
assert!(t!(self.status()).success());
}
}
+3 -3
View File
@@ -1,13 +1,13 @@
#!/usr/bin/env sh
set -ex
set -eux
mkdir -m 777 /qemu
cd /qemu
curl --retry 5 -LO https://github.com/qemu/qemu/raw/HEAD/pc-bios/s390-ccw.img
curl --retry 5 -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20230607/images/generic/kernel.debian
curl --retry 5 -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20230607/images/generic/initrd.debian
curl --retry 5 -LO https://ftp.debian.org/debian/dists/testing/main/installer-s390x/20250803/images/generic/kernel.debian
curl --retry 5 -LO https://ftp.debian.org/debian/dists/testing/main/installer-s390x/20250803/images/generic/initrd.debian
mv kernel.debian kernel
mv initrd.debian initrd.gz
-19
View File
@@ -1,19 +0,0 @@
#!/usr/bin/env sh
set -ex
mkdir -m 777 /qemu
cd /qemu
curl --retry 5 -LO https://cdimage.debian.org/cdimage/ports/snapshots/2022-12-09/debian-11.0.0-sparc64-NETINST-1.iso
7z e debian-11.0.0-sparc64-NETINST-1.iso install/initrd.gz
7z e debian-11.0.0-sparc64-NETINST-1.iso install/vmlinux
mv vmlinux kernel
rm debian-11.0.0-sparc64-NETINST-1.iso
mkdir init
cd init
gunzip -c ../initrd.gz | cpio -id
rm ../initrd.gz
cp /usr/sparc64-linux-gnu/lib/libgcc_s.so.1 usr/lib/
chmod a+w .
+38
View File
@@ -0,0 +1,38 @@
#!/bin/bash
# Download a baseline crate to run semver checks against
set -euxo pipefail
# Retrieve the index for libc
index=$(curl -L https://index.crates.io/li/bc/libc)
# Regex for versions matching what we want to check against. Note we check only
# a suffix since in the merge queue `base_ref` is set to something like
# `refs/heads/main` rather than only the branch name.
if [[ "${TARGET_REF:-}" = *"libc-0.2" ]]; then
pat="^0.2"
elif [[ "${TARGET_REF:-}" = *"main" ]]; then
pat="^1.0"
else
echo "TARGET_REF must be set and end with either 'libc-0.2' or 'main'"
exit 1
fi
# Find the most recent version matching a pattern.
version=$(
echo "$index" |
jq -er --slurp --arg pat "$pat" '
map(select(.vers | test($pat)))
| last
| debug("version:", .)
| .vers
'
)
libc_cache="${XDG_CACHE_DIR:-$HOME/.cache}/libc-ci/"
mkdir -p "$libc_cache"
curl -L "https://static.crates.io/crates/libc/libc-$version.crate" | tar xzf - -C "$libc_cache"
crate_dir="$libc_cache/libc-$version"
echo "BASELINE_CRATE_DIR=$crate_dir" >> "$GITHUB_ENV"
+77 -51
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/bin/bash
# Disable SC2086 as it confuses the docker command.
# shellcheck disable=SC2086
@@ -6,29 +6,47 @@
# Small script to run tests for a target (or all targets) inside all the
# respective docker images.
set -ex
set -eux
target="$1"
# Default to assuming the CARGO_HOME is one directory up (to account for a `bin`
# subdir) from where the `cargo` binary in `$PATH` lives.
DEFAULT_CARGO_HOME="$(dirname "$(dirname "$(command -v cargo)")")"
default_cargo_home="$(dirname "$(dirname "$(command -v cargo)")")"
# If the CARGO_HOME env var is already set, use that. If it isn't set use the
# default.
CARGO_HOME="${CARGO_HOME:-$DEFAULT_CARGO_HOME}"
export CARGO_HOME="${CARGO_HOME:-$default_cargo_home}"
echo "${HOME}"
pwd
# Avoid "no space left on device" failure.
if [ "${1}" = "aarch64-linux-android" ] ; then
docker system prune -af
docker system df
# Avoid "no space left on device" failure if running in CI
if [ "${CI:-0}" != "0" ] && [ "$target" = "aarch64-linux-android" ]; then
docker system prune -af
docker system df
fi
run() {
echo "Building docker container for target ${1}"
run_target="$1"
echo "Building docker container for target $run_target"
build_args=(
"--tag=libc-$run_target"
"--file=ci/docker/$run_target/Dockerfile"
"ci/"
)
if [[ "$run_target" = *"musl"* ]]; then
if [ -n "${RUST_LIBC_UNSTABLE_MUSL_V1_2_3:-}" ]; then
build_args+=("--build-arg=MUSL_VERSION=new")
else
build_args+=("--build-arg=MUSL_VERSION=old")
fi
fi
# use -f so we can use ci/ as build context
docker build -t "libc-${1}" -f "ci/docker/${1}/Dockerfile" ci/
docker build "${build_args[@]}"
mkdir -p target
if [ -w /dev/kvm ]; then
kvm="--volume /dev/kvm:/dev/kvm"
@@ -37,21 +55,29 @@ run() {
fi
docker run \
--rm \
--user "$(id -u)":"$(id -g)" \
--env LIBC_CI \
--env LIBC_CI_ZBUILD_STD \
--env CARGO_HOME=/cargo \
--env CARGO_TARGET_DIR=/checkout/target \
--volume "$CARGO_HOME":/cargo \
--volume "$(rustc --print sysroot)":/rust:ro \
--volume "$(pwd)":/checkout:ro \
--volume "$(pwd)"/target:/checkout/target \
$kvm \
--init \
--workdir /checkout \
"libc-${1}" \
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/run.sh ${1}"
--rm \
--user "$(id -u)":"$(id -g)" \
--env LIBC_CI \
--env LIBC_CI_ZBUILD_STD \
--env RUSTFLAGS \
--env RUSTDOCFLAGS \
--env RUST_BACKTRACE \
--env RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS \
--env RUST_LIBC_UNSTABLE_GNU_TIME_BITS \
--env RUST_LIBC_UNSTABLE_MUSL_V1_2_3 \
--env CARGO_TERM_COLOR \
--env CARGO_TERM_VERBOSE \
--env CARGO_HOME=/cargo \
--env CARGO_TARGET_DIR=/checkout/target \
--volume "$CARGO_HOME":/cargo:Z \
--volume "$(rustc --print sysroot)":/rust:ro,Z \
--volume "$PWD":/checkout:ro,Z \
--volume "$PWD"/target:/checkout/target \
$kvm \
--init \
--workdir /checkout \
"libc-$target" \
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/run.sh $target"
}
build_switch() {
@@ -69,33 +95,33 @@ build_switch() {
cp "$(command -v rustup)" "$(rustc --print sysroot)/bin"
docker run \
--rm \
--user "$(id -u)":"$(id -g)" \
--env LIBC_CI \
--env CARGO_HOME=/cargo \
--env CARGO_TARGET_DIR=/checkout/target \
--volume "$CARGO_HOME":/cargo \
--volume "$(rustc --print sysroot)":/rust:ro \
--volume "$(pwd)":/checkout:ro \
--volume "$(pwd)"/target:/checkout/target \
--volume ~/.rustup:/.rustup:Z \
$kvm \
--init \
--workdir /checkout \
libc-switch \
sh -c "HOME=/tmp RUSTUP_HOME=/tmp PATH=\$PATH:/rust/bin rustup default nightly \
&& rustup component add rust-src --target ci/switch.json \
&& cargo build -Z build-std=core,alloc --target ci/switch.json"
--rm \
--user "$(id -u)":"$(id -g)" \
--env LIBC_CI \
--env CARGO_HOME=/cargo \
--env CARGO_TARGET_DIR=/checkout/target \
--volume "$CARGO_HOME":/cargo \
--volume "$(rustc --print sysroot)":/rust:ro \
--volume "$(pwd)":/checkout:ro \
--volume "$(pwd)"/target:/checkout/target \
--volume ~/.rustup:/.rustup:Z \
$kvm \
--init \
--workdir /checkout \
libc-switch \
sh -c "HOME=/tmp RUSTUP_HOME=/tmp PATH=\$PATH:/rust/bin rustup default nightly \
&& rustup component add rust-src --target ci/switch.json \
&& cargo build -Z build-std=core,alloc --target ci/switch.json"
}
if [ -z "${1}" ]; then
for d in ci/docker/*; do
run "${d}"
done
if [ -z "$target" ]; then
for d in ci/docker/*; do
run "${d}"
done
else
if [ "${1}" != "switch" ]; then
run "${1}"
else
build_switch
fi
if [ "$target" != "switch" ]; then
run "$target"
else
build_switch
fi
fi
+35 -105
View File
@@ -3,117 +3,47 @@
# Builds and runs tests for a particular target passed as an argument to this
# script.
set -ex
set -eux
MIRRORS_URL="https://ci-mirrors.rust-lang.org/libc"
target="$1"
TARGET="${1}"
export RUST_BACKTRACE="${RUST_BACKTRACE:-1}"
# Add target-specific rustflags set in dockerfiles
export RUSTFLAGS="${EXTRA_RUSTFLAGS:-} ${RUSTFLAGS:-}"
# If we're going to run tests inside of a qemu image, then we don't need any of
# the scripts below. Instead, download the image, prepare a filesystem which has
# the current state of this repository, and then run the image.
#
# It's assume that all images, when run with two disks, will run the `run.sh`
# script from the second which we place inside.
if [ "$QEMU" != "" ]; then
tmpdir=/tmp/qemu-img-creation
mkdir -p "${tmpdir}"
echo "RUSTFLAGS: '$RUSTFLAGS'"
if [ -z "${QEMU#*.gz}" ]; then
# image is .gz : download and uncompress it
qemufile="$(echo "${QEMU%.gz}" | sed 's/\//__/g')"
if [ ! -f "${tmpdir}/${qemufile}" ]; then
curl --retry 5 "${MIRRORS_URL}/${QEMU}" | \
gunzip -d > "${tmpdir}/${qemufile}"
fi
elif [ -z "${QEMU#*.xz}" ]; then
# image is .xz : download and uncompress it
qemufile="$(echo "${QEMU%.xz}" | sed 's/\//__/g')"
if [ ! -f "${tmpdir}/${qemufile}" ]; then
curl --retry 5 "${MIRRORS_URL}/${QEMU}" | \
unxz > "${tmpdir}/${qemufile}"
fi
else
# plain qcow2 image: just download it
qemufile="$(echo "${QEMU}" | sed 's/\//__/g')"
if [ ! -f "${tmpdir}/${qemufile}" ]; then
curl --retry 5 "${MIRRORS_URL}/${QEMU}" \
> "${tmpdir}/${qemufile}"
fi
fi
# For logging
uname -a
# Create a mount a fresh new filesystem image that we'll later pass to QEMU.
# This will have a `run.sh` script will which use the artifacts inside to run
# on the host.
rm -f "${tmpdir}/libc-test.img"
mkdir "${tmpdir}/mount"
cmd="cargo test --target $target ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}"
test_flags="--skip check_style"
# Do the standard rigamarole of cross-compiling an executable and then the
# script to run just executes the binary.
cargo build \
--manifest-path libc-test/Cargo.toml \
--target "${TARGET}" \
--test main ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}
rm "${CARGO_TARGET_DIR}/${TARGET}"/debug/main-*.d
cp "${CARGO_TARGET_DIR}/${TARGET}"/debug/main-* "${tmpdir}"/mount/libc-test
# shellcheck disable=SC2016
echo 'exec $1/libc-test' > "${tmpdir}/mount/run.sh"
# Run tests in the `libc` crate
case "$target" in
# Only run `libc-test`
# FIXME(android): unit tests fail to start on Android
*android*) cmd="$cmd --manifest-path libc-test/Cargo.toml" ;;
*s390x*) cmd="$cmd --manifest-path libc-test/Cargo.toml" ;;
# For all other platforms, test everything in the workspace
*) cmd="$cmd --workspace" ;;
esac
du -sh "${tmpdir}/mount"
genext2fs \
--root "${tmpdir}/mount" \
--size-in-blocks 100000 \
"${tmpdir}/libc-test.img"
env="$(rustc --print cfg --target "$target" | sed -n 's/target_env="\(.*\)"/\1/p')"
bits="$(rustc --print cfg --target "$target" | sed -n 's/target_pointer_width="\(.*\)"/\1/p')"
# Pass -snapshot to prevent tampering with the disk images, this helps when
# running this script in development. The two drives are then passed next,
# first is the OS and second is the one we just made. Next the network is
# configured to work (I'm not entirely sure how), and then finally we turn off
# graphics and redirect the serial console output to out.log.
qemu-system-x86_64 \
-m 1024 \
-snapshot \
-drive if=virtio,file="${tmpdir}/${qemufile}" \
-drive if=virtio,file="${tmpdir}/libc-test.img" \
-net nic,model=virtio \
-net user \
-nographic \
-vga none 2>&1 | tee "${CARGO_TARGET_DIR}/out.log"
exec grep -E "^(PASSED)|(test result: ok)" "${CARGO_TARGET_DIR}/out.log"
fi
if [ "$TARGET" = "s390x-unknown-linux-gnu" ]; then
# FIXME: s390x-unknown-linux-gnu often fails to test due to timeout,
# so we retry this N times.
N=5
n=0
passed=0
until [ $n -ge $N ]
do
if [ "$passed" = "0" ]; then
if cargo test --no-default-features --manifest-path libc-test/Cargo.toml --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"} ; then
passed=$((passed+1))
continue
fi
elif [ "$passed" = "1" ]; then
if cargo test --manifest-path libc-test/Cargo.toml --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"} ; then
passed=$((passed+1))
continue
fi
elif [ "$passed" = "2" ]; then
if cargo test --features extra_traits --manifest-path libc-test/Cargo.toml --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}; then
break
fi
fi
n=$((n+1))
sleep 1
done
else
cargo test --no-default-features --manifest-path libc-test/Cargo.toml \
--target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}
cargo test --manifest-path libc-test/Cargo.toml --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}
RUST_BACKTRACE=1 cargo test --features extra_traits --manifest-path libc-test/Cargo.toml \
--target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}
# shellcheck disable=SC2086
$cmd --no-default-features -- $test_flags
# shellcheck disable=SC2086
$cmd -- $test_flags
# shellcheck disable=SC2086
$cmd --features extra_traits -- $test_flags
# On relevant platforms, also test with our optional settings
if [ "$env" = "gnu" ] && [ "$bits" = "32" ]; then
# shellcheck disable=SC2086
RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS=64 $cmd -- $test_flags
# shellcheck disable=SC2086
RUST_LIBC_UNSTABLE_GNU_TIME_BITS=64 $cmd -- $test_flags
fi
+14 -9
View File
@@ -1,11 +1,14 @@
use std::env;
use std::path::{
Path,
PathBuf,
};
use std::process::Command;
use std::path::{Path, PathBuf};
fn main() {
let args = env::args_os()
.skip(1)
.filter(|arg| arg != "--quiet")
.filter(|arg| arg != "--quiet" && arg != "--skip" && arg != "check_style")
.collect::<Vec<_>>();
assert_eq!(args.len(), 1);
let test = PathBuf::from(&args[0]);
@@ -36,14 +39,16 @@ fn main() {
let stdout = String::from_utf8_lossy(&output.stdout);
let stderr = String::from_utf8_lossy(&output.stderr);
println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
output.status,
stdout,
stderr);
println!(
"status: {}\nstdout ---\n{stdout}\nstderr ---\n{stderr}",
output.status,
);
if !stderr.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
&& !stdout.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
{
if !stderr.lines().any(|l| {
(l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok")
}) && !stdout.lines().any(|l| {
(l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok")
}) {
panic!("failed to find successful test run");
};
}
-75
View File
@@ -1,75 +0,0 @@
#!/usr/bin/env sh
# Checks that libc does not contain breaking changes for the following targets.
set -ex
OS=${1}
echo "Testing Semver on ${OS}"
if ! rustc --version | grep -E "nightly" ; then
echo "Building semverver requires a nightly Rust toolchain"
exit 1
fi
rustup component add rustc-dev llvm-tools-preview
# Should update the nightly version in bors CI config if we touch this.
cargo install semverver --version=0.1.50
TARGETS=
case "${OS}" in
*linux*)
TARGETS="\
aarch64-fuchsia \
aarch64-linux-android \
aarch64-unknown-linux-gnu \
aarch64-unknown-linux-musl \
armv7-linux-androideabi \
armv7-unknown-linux-gnueabihf \
i586-unknown-linux-gnu \
i586-unknown-linux-musl \
i686-linux-android \
i686-unknown-freebsd \
i686-unknown-linux-gnu \
i686-unknown-linux-musl \
i686-pc-windows-gnu \
x86_64-unknown-freebsd \
x86_64-unknown-linux-gnu \
x86_64-unknown-linux-musl \
x86_64-unknown-netbsd \
x86_64-pc-solaris \
x86_64-fuchsia \
x86_64-pc-windows-gnu \
x86_64-unknown-linux-gnux32 \
x86_64-unknown-redox \
x86_64-fortanix-unknown-sgx \
wasm32-unknown-unknown \
"
;;
*macos*)
TARGETS="\
aarch64-apple-ios \
x86_64-apple-darwin \
x86_64-apple-ios \
"
;;
esac
for TARGET in $TARGETS; do
# FIXME: rustup often fails to download some artifacts due to network
# issues, so we retry this N times.
N=5
n=0
until [ $n -ge $N ]
do
if rustup target add "${TARGET}" ; then
break
fi
n=$((n+1))
sleep 1
done
cargo semver --api-guidelines --target="${TARGET}"
done
+182
View File
@@ -0,0 +1,182 @@
#!/usr/bin/env python3
import os
import re
import subprocess as sp
import sys
from difflib import unified_diff
from glob import iglob
from pathlib import Path
FMT_DIRS = ["src", "ci"]
IGNORE_FILES = [
# Too much special syntax that we don't want to format
"src/macros.rs"
]
def main():
# if `CI` is set, do a check rather than overwriting
check_only = os.getenv("CI") is not None
run(["rustfmt", "-V"])
fmt_files = []
for dir in FMT_DIRS:
fmt_files.extend(iglob(f"{dir}/**/*.rs", recursive=True))
for file in fmt_files:
if file in IGNORE_FILES:
continue
fmt_one(Path(file), check_only)
# Run once from workspace root to get everything that wasn't handled as an
# individual file.
if check_only:
run(["cargo", "fmt", "--check"])
else:
run(["cargo", "fmt"])
for file in iglob("libc-test/semver/*.txt"):
check_semver_file(Path(file))
# Style tests
run(
[
"cargo",
"test",
"--manifest-path=libc-test/Cargo.toml",
"--test=style",
"--",
"--nocapture",
]
)
try:
run(["shellcheck", "--version"])
except sp.CalledProcessError:
eprint("ERROR: shellcheck not found")
exit(1)
for file in iglob("**/*.sh", recursive=True):
run(["shellcheck", file])
def fmt_one(fpath: Path, check_only: bool):
eprint(f"Formatting {fpath}")
text = fpath.read_text()
# Rustfmt doesn't format the bodies of `{ ... }` macros, which is most of `libc`. To
# make things usable, we do some hacks to replace macros with some kind of
# alternative syntax that gets formatted about how we want, then reset the changes
# after formatting.
# Turn all braced macro `foo! { /* ... */ }` invocations into
# `fn foo_fmt_tmp() { /* ... */ }`, since our macro bodies are usually valid in
# a function context.
text = re.sub(r"(?!macro_rules)\b(\w+)!\s*\{", r"fn \1_fmt_tmp() {", text)
# Replace `if #[cfg(...)]` within `cfg_if` with `if cfg_tmp!([...])` which
# `rustfmt` will format. We put brackets within the parens so it is easy to
# match (trying to match parentheses would catch the first closing `)` which
# wouldn't be correct for something like `all(any(...), ...)`).
text = re.sub(r"if #\[cfg\((.*?)\)\]", r"if cfg_tmp!([\1])", text, flags=re.DOTALL)
# The `c_enum!` macro allows anonymous enums without names, which isn't valid
# syntax. Replace it with a dummy name.
text = re.sub(r"enum #anon\b", r"enum _fmt_anon", text)
# If enum variants are annotated with `pub`, rustfmt erases the visibility. To get
# around this we first match on all enums to extract their bodies, then look for `pub`
# visibility indicators. If found, these get stashed in a comment on the preceding
# line.
def enum_sub(m: re.Match) -> str:
enum_body = m.group(0)
rep = re.sub(
r"^(.*)\b(pub\s*?(\(.*?\))?)\s*",
r"\1/* FMT-VIS \2 END-FMT-VIS */\n\1",
enum_body,
flags=re.MULTILINE,
)
return rep
text = re.sub(r"\benum.*\{\n?(?:\s*[^}]*\n)+\s*\}", enum_sub, text)
# Invoke rustfmt passing via stdin/stdout so we don't need to write the file. Exits
# on failure.
cmd = ["rustfmt", "--config-path=.rustfmt.toml"]
if check_only:
res = check_output(cmd + ["--check"], input=text)
# Unfortunately rustfmt on stdin always completes with 0 exit code even if
# there are errors, so we need to pick between writing the file to disk or
# relying on empty stdout to indicate success.
# <https://github.com/rust-lang/rustfmt/issues/5376>.
if len(res) == 0:
return
eprint(f"ERROR: File {fpath} is not properly formatted")
print(res)
exit(1)
else:
text = check_output(cmd, input=text)
# Restore all changes in the formatted text
text = re.sub(r"fn (\w+)_fmt_tmp\(\)", r"\1!", text)
text = re.sub(r"cfg_tmp!\(\[(.*?)\]\)", r"#[cfg(\1)]", text, flags=re.DOTALL)
text = re.sub(r"enum _fmt_anon", r"enum #anon", text)
text = re.sub(r"/\* FMT-VIS (.*) END-FMT-VIS \*/\n\s*", r"\1 ", text)
# And write the formatted file back
fpath.write_text(text)
def check_semver_file(fpath: Path):
if "TODO" in str(fpath):
eprint(f"Skipping semver file {fpath}")
return
eprint(f"Checking semver file {fpath}")
text = fpath.read_text()
lines = text.splitlines()
sort = sorted(lines)
if lines != sort:
eprint(f"ERROR: Unsorted semver file {fpath}")
eprint("\n".join(unified_diff(lines, sort, lineterm="")))
exit(1)
duplicates = []
seen = set()
for line in lines:
if line in seen:
duplicates.append(line)
seen.add(line)
if len(duplicates) > 0:
eprint(f"ERROR: Duplicates in semver file {fpath}")
eprint(duplicates)
exit(1)
def check_output(args: list[str], **kw) -> str:
xtrace(args)
return sp.check_output(args, encoding="utf8", text=True, **kw)
def run(args: list[str], **kw) -> sp.CompletedProcess:
xtrace(args)
return sp.run(args, check=True, text=True, **kw)
def xtrace(args: list[str]):
astr = " ".join(args)
eprint(f"+ {astr}")
def eprint(*args, **kw):
print(*args, file=sys.stderr, **kw)
if __name__ == "__main__":
main()
-207
View File
@@ -1,207 +0,0 @@
//! Simple script to verify the coding style of this library
//!
//! ## How to run
//!
//! The first argument to this script is the directory to run on, so running
//! this script should be as simple as:
//!
//! ```notrust
//! rustc ci/style.rs
//! ./style src
//! ```
//!
//! ## Guidelines
//!
//! The current style is:
//!
//! * Specific module layout:
//! 1. use directives
//! 2. typedefs
//! 3. structs
//! 4. constants
//! 5. f! { ... } functions
//! 6. extern functions
//! 7. modules + pub use
//!
//! Things not verified:
//!
//! * alignment
//! * leading colons on paths
use std::env;
use std::fs;
use std::io::prelude::*;
use std::path::Path;
macro_rules! t {
($e:expr) => {
match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with {}", stringify!($e), e),
}
};
}
fn main() {
let arg = env::args().skip(1).next().unwrap_or(".".to_string());
let mut errors = Errors { errs: false };
walk(Path::new(&arg), &mut errors);
if errors.errs {
panic!("found some lint errors");
} else {
println!("good style!");
}
}
fn walk(path: &Path, err: &mut Errors) {
for entry in t!(path.read_dir()).map(|e| t!(e)) {
let path = entry.path();
if t!(entry.file_type()).is_dir() {
walk(&path, err);
continue;
}
let name = entry.file_name().into_string().unwrap();
match &name[..] {
n if !n.ends_with(".rs") => continue,
"lib.rs" | "macros.rs" => continue,
_ => {}
}
let mut contents = String::new();
t!(t!(fs::File::open(&path)).read_to_string(&mut contents));
check_style(&contents, &path, err);
}
}
struct Errors {
errs: bool,
}
#[derive(Clone, Copy, PartialEq)]
enum State {
Start,
Imports,
Typedefs,
Structs,
Constants,
FunctionDefinitions,
Functions,
Modules,
}
fn check_style(file: &str, path: &Path, err: &mut Errors) {
let mut state = State::Start;
let mut s_macros = 0;
let mut f_macros = 0;
let mut in_impl = false;
for (i, line) in file.lines().enumerate() {
if line.contains("#[cfg(")
&& line.contains(']')
&& !line.contains(" if ")
&& !(line.contains("target_endian") || line.contains("target_arch"))
{
if state != State::Structs {
err.error(path, i, "use cfg_if! and submodules instead of #[cfg]");
}
}
if line.contains("#[derive(") && (line.contains("Copy") || line.contains("Clone")) {
err.error(path, i, "impl ::Copy and ::Clone manually");
}
if line.contains("impl") {
in_impl = true;
}
if in_impl && line.starts_with('}') {
in_impl = false;
}
let orig_line = line;
let line = line.trim_start();
let is_pub = line.starts_with("pub ");
let line = if is_pub { &line[4..] } else { line };
let line_state = if line.starts_with("use ") {
if line.contains("c_void") {
continue;
}
if is_pub {
State::Modules
} else {
State::Imports
}
} else if line.starts_with("const ") {
State::Constants
} else if line.starts_with("type ") && !in_impl {
State::Typedefs
} else if line.starts_with("s! {") {
s_macros += 1;
State::Structs
} else if line.starts_with("s_no_extra_traits! {") {
// multiple macros of this type are allowed
State::Structs
} else if line.starts_with("s_paren! {") {
// multiple macros of this type are allowed
State::Structs
} else if line.starts_with("f! {") {
f_macros += 1;
State::FunctionDefinitions
} else if line.starts_with("extern ") && !orig_line.starts_with(" ") {
State::Functions
} else if line.starts_with("mod ") {
State::Modules
} else {
continue;
};
if state as usize > line_state as usize {
err.error(
path,
i,
&format!(
"{} found after {} when it belongs before",
line_state.desc(),
state.desc()
),
);
}
if f_macros == 2 {
f_macros += 1;
err.error(path, i, "multiple f! macros in one module");
}
if s_macros == 2 {
s_macros += 1;
err.error(path, i, "multiple s! macros in one module");
}
state = line_state;
}
}
impl State {
fn desc(&self) -> &str {
match *self {
State::Start => "start",
State::Imports => "import",
State::Typedefs => "typedef",
State::Structs => "struct",
State::Constants => "constant",
State::FunctionDefinitions => "function definition",
State::Functions => "extern function",
State::Modules => "module",
}
}
}
impl Errors {
fn error(&mut self, path: &Path, line: usize, msg: &str) {
self.errs = true;
println!("{}:{}: {}", path.display(), line + 1, msg);
}
}
-20
View File
@@ -1,20 +0,0 @@
#!/usr/bin/env sh
set -ex
rustc ci/style.rs && ./style src
rustup toolchain install nightly -c rustfmt --allow-downgrade
rustup override set nightly
command -v rustfmt
rustfmt -V
cargo fmt --all -- --check
if shellcheck --version ; then
# GHA's shellcheck is too old (0.4.6) and cannot handle SC2153 correctly.
shellcheck -e SC2103 -e SC2153 ci/*.sh
else
echo "shellcheck not found"
exit 1
fi
+2 -12
View File
@@ -1,7 +1,5 @@
{
"family": "unix",
"env": "newlib",
"target-env": "newlib",
"target-family": "unix",
"target-c-int-width": "32",
"target-endian": "little",
@@ -9,14 +7,6 @@
"os": "horizon",
"arch": "aarch64",
"panic-strategy": "unwind",
"abi-blacklist": [
"stdcall",
"fastcall",
"vectorcall",
"thiscall",
"win64",
"sysv64"
],
"dynamic-linking" : false,
"features": "+a53,+strict-align",
"data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
@@ -24,7 +14,7 @@
"position-independent-executables" : true,
"linker-flavor": "gcc",
"llvm-target": "aarch64-unknown-none",
"has-elf-tls" : false,
"has-thread-local": false,
"linker-is-gnu" : true,
"disable-redzone" : true,
"relocation-model" : "pic",
@@ -34,4 +24,4 @@
"trap-unreachable" : true,
"emit-debug-gdb-scripts" : true,
"requires-uwtable" : true
}
}
+8 -8
View File
@@ -1,9 +1,9 @@
#!/bin/sh
set -e
set -eux
arch=$1
prog=$2
arch="$1"
prog="$2"
cd /qemu/init
echo "#!/bin/sh\n/prog --color=never" > run_prog.sh
@@ -13,11 +13,11 @@ find . | cpio --create --format='newc' --quiet | gzip > ../initrd.gz
cd ..
timeout 30s qemu-system-$arch \
-m 1024 \
-nographic \
-kernel kernel \
-initrd initrd.gz \
-append init=/run_prog.sh > output || true
-m 1024 \
-nographic \
-kernel kernel \
-initrd initrd.gz \
-append init=/run_prog.sh > output || true
# remove kernel messages
tr -d '\r' < output | grep -Ev '^\['
+512
View File
@@ -0,0 +1,512 @@
#!/usr/bin/env python3
import argparse
import os
import platform
import re
import subprocess as sp
import sys
import time
from dataclasses import dataclass, field
from enum import Enum, IntEnum
from pathlib import Path
from typing import Optional, Sequence
ESC_YELLOW = "\033[1;33m"
ESC_CYAN = "\033[1;36m"
ESC_END = "\033[0m"
class Os(Enum):
LINUX = "Linux"
WINDOWS = "Windows"
DARWIN = "Darwin"
class Toolchain(IntEnum):
OTHER = 0 # msrv
STABLE = 1
BETA = 2
NIGHTLY = 3
@dataclass
class Cfg:
toolchain_name: str
toolchain: Toolchain = field(init=False)
host_target: str = field(init=False)
os_: Os = field(init=False)
baseline_crate_dir: Optional[Path]
skip_semver: bool
def __post_init__(self):
rustc_output = check_output(["rustc", f"+{self.toolchain_name}", "-vV"])
self.host_target = re.findall(r"host: (.*)", rustc_output)[0]
if "nightly" in self.toolchain_name:
self.toolchain = Toolchain.NIGHTLY
elif "beta" in self.toolchain_name:
self.toolchain = Toolchain.BETA
elif "stable" in self.toolchain_name:
self.toolchain = Toolchain.STABLE
else:
self.toolchain = Toolchain.OTHER
self.os_ = Os(platform.system())
eprint(f"Testing Rust {self.toolchain_name} on {self.os_}")
def nightly(self) -> bool:
return self.toolchain == Toolchain.NIGHTLY
@dataclass
class Target:
name: str
dist: bool = True
min_toolchain: Toolchain = Toolchain.OTHER
def __post_init__(self):
if not self.dist:
# We will need to use build-std
self.min_toolchain = Toolchain.NIGHTLY
@dataclass
class TargetResult:
"""Not all checks exit immediately, so failures are reported here."""
target: Target
semver_ok: bool
FREEBSD_VERSIONS = [11, 12, 13, 14, 15]
TARGETS = [
# Tier 1
Target("aarch64-apple-darwin"),
Target("aarch64-pc-windows-msvc"),
Target("aarch64-unknown-linux-gnu"),
Target("i686-pc-windows-msvc"),
Target("i686-unknown-linux-gnu"),
Target("x86_64-pc-windows-gnu"),
Target("x86_64-pc-windows-msvc"),
Target("x86_64-unknown-linux-gnu"),
#
# Tier 2 with host tools
Target("aarch64-pc-windows-gnullvm", min_toolchain=Toolchain.STABLE),
Target("aarch64-unknown-linux-musl"),
Target("aarch64-unknown-linux-ohos", min_toolchain=Toolchain.STABLE),
Target("arm-unknown-linux-gnueabi"),
Target("arm-unknown-linux-gnueabihf"),
Target("armv7-unknown-linux-gnueabihf"),
Target("armv7-unknown-linux-ohos", min_toolchain=Toolchain.STABLE),
Target("i686-pc-windows-gnu"),
Target("loongarch64-unknown-linux-gnu", min_toolchain=Toolchain.STABLE),
Target("loongarch64-unknown-linux-musl", min_toolchain=Toolchain.STABLE),
Target("powerpc-unknown-linux-gnu"),
Target("powerpc64-unknown-linux-gnu"),
Target("powerpc64le-unknown-linux-gnu"),
Target("powerpc64le-unknown-linux-musl", min_toolchain=Toolchain.STABLE),
Target("riscv64gc-unknown-linux-gnu"),
Target("s390x-unknown-linux-gnu"),
Target("sparcv9-sun-solaris"),
Target("x86_64-apple-darwin"),
Target("x86_64-pc-solaris"),
Target("x86_64-pc-windows-gnullvm", min_toolchain=Toolchain.STABLE),
Target("x86_64-unknown-freebsd"),
Target("x86_64-unknown-illumos"),
Target("x86_64-unknown-linux-musl"),
Target("x86_64-unknown-linux-ohos", min_toolchain=Toolchain.STABLE),
Target("x86_64-unknown-netbsd"),
#
# Tier 2 without host tools
Target("aarch64-apple-ios"),
Target("aarch64-linux-android"),
Target("aarch64-unknown-fuchsia", min_toolchain=Toolchain.STABLE),
Target("arm-linux-androideabi"),
Target("arm-unknown-linux-musleabi"),
Target("arm-unknown-linux-musleabihf"),
Target("armv5te-unknown-linux-gnueabi"),
Target("armv5te-unknown-linux-musleabi"),
Target("armv7-linux-androideabi"),
Target("armv7-unknown-linux-musleabihf"),
Target("i586-unknown-linux-gnu"),
Target("i586-unknown-linux-musl"),
Target("i686-linux-android"),
Target("i686-unknown-freebsd"),
Target("i686-unknown-linux-musl"),
Target("sparc64-unknown-linux-gnu"),
Target("wasm32-unknown-emscripten"),
Target("wasm32-unknown-unknown"),
Target("wasm32-wasip1", min_toolchain=Toolchain.STABLE),
Target("wasm32-wasip2", min_toolchain=Toolchain.STABLE),
Target("x86_64-fortanix-unknown-sgx"),
Target("x86_64-linux-android"),
Target("x86_64-unknown-fuchsia", min_toolchain=Toolchain.STABLE),
Target("x86_64-unknown-linux-gnux32"),
Target("x86_64-unknown-redox"),
#
# Libc has historically checked that a number of tier 3 targets build. Technically
# there is no need to do this given the target tier policy, but the cost is small
# and the saved churn from accidental breakage is significant, so we keep it around.
Target("aarch64-unknown-freebsd", dist=False),
Target("aarch64-unknown-hermit", dist=False),
Target("aarch64-unknown-illumos", dist=False),
Target("aarch64-unknown-netbsd", dist=False),
Target("aarch64-unknown-openbsd", dist=False),
Target("aarch64-wrs-vxworks", dist=False),
Target("armebv7r-none-eabihf", dist=False),
Target("armv7-rtems-eabihf", dist=False),
Target("armv7-wrs-vxworks-eabihf", dist=False),
Target("armv7r-none-eabihf", dist=False),
Target("armv7s-apple-ios", dist=False),
# FIXME(hexagon): hits "error: symbol 'fma' is already defined" error
# Target("hexagon-unknown-linux-musl", dist=False),
Target("i386-apple-ios", dist=False),
Target("i686-apple-darwin", dist=False),
Target("i686-unknown-haiku", dist=False),
Target("i686-unknown-hurd-gnu", dist=False),
Target("i686-unknown-netbsd", dist=False),
Target("i686-unknown-openbsd", dist=False),
Target("i686-wrs-vxworks", dist=False),
Target("mips-unknown-linux-gnu", dist=False),
Target("mips-unknown-linux-musl", dist=False),
Target("mips64-unknown-linux-gnuabi64", dist=False),
Target("mips64-unknown-linux-muslabi64", dist=False),
Target("mips64el-unknown-linux-gnuabi64", dist=False),
Target("mips64el-unknown-linux-muslabi64", dist=False),
Target("mipsel-unknown-linux-gnu", dist=False),
Target("mipsel-unknown-linux-musl", dist=False),
Target("nvptx64-nvidia-cuda", dist=False),
Target("powerpc-unknown-linux-gnuspe", dist=False),
Target("powerpc-unknown-netbsd", dist=False),
Target("powerpc-wrs-vxworks", dist=False),
Target("powerpc-wrs-vxworks-spe", dist=False),
Target("powerpc64-ibm-aix", dist=False),
Target("powerpc64-unknown-freebsd", dist=False),
Target("powerpc64-wrs-vxworks", dist=False),
Target("riscv32-wrs-vxworks", dist=False),
Target("riscv32gc-unknown-linux-gnu", dist=False),
Target("riscv32i-unknown-none-elf", dist=False),
Target("riscv32imac-unknown-none-elf", dist=False),
Target("riscv32imc-unknown-none-elf", dist=False),
Target("riscv64-wrs-vxworks", dist=False),
Target("riscv64a23-unknown-linux-gnu", dist=False),
Target("riscv64gc-unknown-freebsd", dist=False),
Target("riscv64gc-unknown-hermit", dist=False),
Target("riscv64gc-unknown-linux-musl", dist=False),
Target("riscv64gc-unknown-none-elf", dist=False),
Target("riscv64imac-unknown-none-elf", dist=False),
Target("s390x-unknown-linux-musl", dist=False),
Target("sparc-unknown-linux-gnu", dist=False),
Target("sparc64-unknown-netbsd", dist=False),
Target("thumbv7em-none-eabihf", dist=False),
Target("thumbv7m-none-eabi", dist=False),
Target("thumbv7neon-linux-androideabi", dist=False),
Target("thumbv7neon-unknown-linux-gnueabihf", dist=False),
Target("thumbv8m.main-none-eabi", dist=False),
Target("x86_64-unknown-dragonfly", dist=False),
Target("x86_64-unknown-haiku", dist=False),
Target("x86_64-unknown-hermit", dist=False),
Target("x86_64-unknown-l4re-uclibc", dist=False),
Target("x86_64-unknown-openbsd", dist=False),
Target("x86_64-wrs-vxworks", dist=False),
]
def eprint(*args, **kw) -> None:
print(*args, file=sys.stderr, **kw)
def xtrace(args: Sequence[str | Path], *, env: Optional[dict[str, str]]) -> None:
"""Print commands before running them."""
astr = " ".join(str(arg) for arg in args)
if env is None:
eprint(f"+ {astr}")
else:
envdiff = set(env.items()) - set(os.environ.items())
estr = " ".join(f"{k}='{v}'" for (k, v) in envdiff)
eprint(f"+ {estr} {astr}")
def check_output(
args: Sequence[str | Path], *, env: Optional[dict[str, str]] = None
) -> str:
xtrace(args, env=env)
return sp.check_output(args, env=env, encoding="utf8")
def run(
args: Sequence[str | Path],
*,
env: Optional[dict[str, str]] = None,
check: bool = True,
) -> sp.CompletedProcess:
xtrace(args, env=env)
return sp.run(args, env=env, check=check)
def check_dup_targets() -> None:
"""Ensure there are no duplicate targets in the list."""
all = set()
duplicates = set()
for target in TARGETS:
if target.name in all:
duplicates.add(target.name)
all.add(target.name)
assert len(duplicates) == 0, f"duplicate targets: {duplicates}"
def do_semver_checks(cfg: Cfg, target: Target) -> bool:
"""Run cargo semver-checks for a target."""
tname = target.name
if cfg.toolchain != Toolchain.STABLE:
eprint("Skipping semver checks (only supported on stable)")
return True
if not target.dist:
eprint("Skipping semver checks on non-dist target")
return True
if tname == cfg.host_target:
# FIXME(semver): This is what we actually want to be doing on all targets, but
# `--target` doesn't work right with semver-checks.
eprint("Running semver checks on host")
# NOTE: this is the only check which actually fails CI if it doesn't succeed,
# since it is the only check we can control lints for (via the
# package.metadata table).
#
# We may need to play around with this a bit.
run(
[
"cargo",
"semver-checks",
"--only-explicit-features",
"--features=std,extra_traits",
"--release-type=patch",
],
check=True,
)
# Don't return here so we still get the same rustdoc-json-base tests even while
# running on the host.
if cfg.baseline_crate_dir is None:
eprint(
"Non-host target: --baseline-crate-dir must be specified to \
run semver-checks"
)
sys.exit(1)
# Since semver-checks doesn't work with `--target`, we build the json ourself and
# hand it over.
eprint("Running semver checks with cross compilation")
# Set the bootstrap hack (for rustdoc json), allow warnings, and get rid of LIBC_CI
# (which sets `deny(warnings)`).
env = os.environ.copy()
env.setdefault("RUSTFLAGS", "")
env["RUSTFLAGS"] += " -Awarnings"
env["RUSTC_BOOTSTRAP"] = "1"
env.pop("LIBC_CI", None)
cmd = ["cargo", "rustdoc", "--target", tname]
# Take the flags from:
# https://github.com/obi1kenobi/cargo-semver-checks/blob/030af2032e93a64a6a40c4deaa0f57f262042426/src/data_generation/generate.rs#L241-L297
rustdoc_args = [
"--",
"-Zunstable-options",
"--document-private-items",
"--document-hidden-items",
"--output-format=json",
"--cap-lints=allow",
]
# Build the current crate and the baseline crate, which CI should have downloaded
run([*cmd, *rustdoc_args], env=env)
run(
[*cmd, "--manifest-path", cfg.baseline_crate_dir / "Cargo.toml", *rustdoc_args],
env=env,
)
baseline = cfg.baseline_crate_dir / "target" / tname / "doc" / "libc.json"
current = Path("target") / tname / "doc" / "libc.json"
# NOTE: We can't configure lints when using the rustoc input :(. For this reason,
# we don't check for failure output status since there is no way to override false
# positives.
#
# See: https://github.com/obi1kenobi/cargo-semver-checks/issues/827
res = run(
[
"cargo",
"semver-checks",
"--baseline-rustdoc",
baseline,
"--current-rustdoc",
current,
# For now, everything is a patch
"--release-type=patch",
],
check=False,
)
# If this job failed, we can't fail CI because it may have been a false positive.
# But at least we can make an explicit note of it.
return res.returncode == 0
def test_target(cfg: Cfg, target: Target) -> TargetResult:
"""Run tests for a single target."""
start = time.time()
env = os.environ.copy()
env.setdefault("RUSTFLAGS", "")
tname = target.name
target_cfg = check_output(["rustc", "--print=cfg", "--target", tname])
target_env = re.findall(r'target_env="(.*)"', target_cfg)
target_os = re.findall(r'target_os="(.*)"', target_cfg)
target_bits = re.findall(r'target_pointer_width="(.*)"', target_cfg)[0]
assert target_bits in ["32", "64"]
eprint(f"env {target_env}, os {target_os}, bits {target_bits}")
# Usually we do a full build to make sure we don't run into any crashes or link
# problems. If we need to use build-std, though, only do a check to speed
# things up.
if target.dist:
action = "build"
else:
action = "check"
cmd = ["cargo", f"+{cfg.toolchain_name}", action, "--target", tname]
if not target.dist:
# If we can't download a `core`, we need to build it
cmd += ["-Zbuild-std=core"]
# FIXME: With `the build-std` feature, `compiler_builtins` emits a lot of
# lint warnings.
env["RUSTFLAGS"] += " -Aimproper_ctypes_definitions"
else:
run(["rustup", "target", "add", tname, "--toolchain", cfg.toolchain_name])
# Test with expected combinations of features
run(cmd, env=env)
run([*cmd, "--features=extra_traits"], env=env)
if "gnu" in target_env and target_bits == "32":
# Equivalent of _FILE_OFFSET_BITS=64
run(cmd, env=env | {"RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS": "64"})
# Equivalent of _TIME_BITS=64
run(cmd, env=env | {"RUST_LIBC_UNSTABLE_GNU_TIME_BITS": "64"})
if "musl" in target_env:
# Check with breaking changes from musl, including 64-bit time_t on 32-bit
run(cmd, env=env | {"RUST_LIBC_UNSTABLE_MUSL_V1_2_3": "1"})
# Test again without default features, i.e. without `std`
run([*cmd, "--no-default-features"])
run([*cmd, "--no-default-features", "--features=extra_traits"])
# Ensure the crate will build when used as a dependency of `std`
if cfg.nightly():
run([*cmd, "--no-default-features", "--features=rustc-dep-of-std"])
# For freebsd targets, check with the different versions we support
# if on nightly or stable
if "freebsd" in tname and cfg.toolchain >= Toolchain.STABLE:
for version in FREEBSD_VERSIONS:
run(cmd, env=env | {"RUST_LIBC_UNSTABLE_FREEBSD_VERSION": str(version)})
run(
[*cmd, "--no-default-features"],
env=env | {"RUST_LIBC_UNSTABLE_FREEBSD_VERSION": str(version)},
)
if cfg.skip_semver:
eprint("Skipping semver checks")
semver_ok = True
else:
semver_ok = do_semver_checks(cfg, target)
elapsed = round(time.time() - start, 2)
eprint(f"Finished checking target {tname} in {elapsed} seconds")
return TargetResult(target=target, semver_ok=semver_ok)
def main() -> None:
p = argparse.ArgumentParser()
p.add_argument("--toolchain", required=True, help="Rust toolchain")
p.add_argument("--only", help="only targets matching this regex")
p.add_argument("--skip", help="skip targets matching this regex")
p.add_argument("--skip-semver", help="don't run semver checks")
p.add_argument(
"--baseline-crate-dir",
help="specify the directory of the crate to run semver checks against",
)
p.add_argument(
"--half",
type=int,
choices=[1, 2],
help="specify 1 or 2 to run half of the targets",
)
args = p.parse_args()
cfg = Cfg(
toolchain_name=args.toolchain,
baseline_crate_dir=args.baseline_crate_dir and Path(args.baseline_crate_dir),
skip_semver=args.skip_semver,
)
eprint(f"Config: {cfg}")
eprint("Python version: ", sys.version)
check_dup_targets()
start = time.time()
if cfg.nightly():
# Needed for build-std
run(["rustup", "component", "add", "rust-src"])
targets = TARGETS
eprint(f"Total checked targets across platforms: {len(targets)}")
if not cfg.nightly():
# Non-dist targets need nightly for build-std
targets = [t for t in targets if t.dist]
# Filter to targets supported on the current toolchain
targets = [t for t in targets if cfg.toolchain >= t.min_toolchain]
eprint(f"Targets checkable with this toolchain: {len(targets)}")
# Apply filtering
if args.only:
targets = [t for t in targets if re.match(args.only, t.name)]
if args.skip:
targets = [t for t in targets if not re.match(args.skip, t.name)]
# Allow splitting the targets in half for time improvements
if args.half == 1:
targets = targets[0::2]
elif args.half == 2:
targets = targets[1::2]
total = len(targets)
eprint(f"Targets to run: {total}")
assert total > 0, "some tests should be run"
target_results: list[TargetResult] = []
for i, target in enumerate(targets):
at = i + 1
eprint(f"::group::Target: {target.name} ({at}/{total})")
eprint(f"{ESC_CYAN}Checking target {target} ({at}/{total}){ESC_END}")
res = test_target(cfg, target)
target_results.append(res)
eprint("::endgroup::")
elapsed = round(time.time() - start, 2)
semver_failures = [t.target.name for t in target_results if not t.semver_ok]
if len(semver_failures) != 0:
eprint(f"\n{ESC_YELLOW}Some targets had semver failures:{ESC_END}")
for t in semver_failures:
eprint(f"* {t}")
eprint(f"\nChecked {total} targets in {elapsed} seconds")
main()
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -eux
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
clang \
xz-utils
# Wasmtime is used to execute tests and wasi-sdk is used to compile tests.
# Download appropriate versions here and configure various flags below.
wasmtime=38.0.2
wasi_sdk=29
curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v$wasmtime/wasmtime-v$wasmtime-x86_64-linux.tar.xz |
tar xJf -
mv wasmtime-v$wasmtime-x86_64-linux wasmtime
# The pre-built `*.deb` files for wasi-sdk install to `/opt/wasi-sdk`
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$wasi_sdk/wasi-sdk-$wasi_sdk.0-x86_64-linux.deb
dpkg -i ./wasi-sdk-*.deb
+11
View File
@@ -0,0 +1,11 @@
# This is a dummy package so the published stable `libc` can have `ctest` in
# the workspace, which works around <https://github.com/release-plz/release-plz/issues/2163>.
[package]
name = "ctest"
version = "0.1.0"
edition = "2021"
rust-version = "1.77"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/libc"
publish = false
+1
View File
@@ -0,0 +1 @@
+31 -48
View File
@@ -1,24 +1,28 @@
[package]
name = "libc-test"
version = "0.2.153"
version = "0.1.0"
description = "A test crate for the libc crate."
publish = false
authors = ["The Rust Project Developers"]
edition = "2021"
license = "MIT OR Apache-2.0"
build = "build.rs"
repository = "https://github.com/rust-lang/libc"
homepage = "https://github.com/rust-lang/libc"
description = """
A test crate for the libc crate.
"""
[dependencies.libc]
path = ".."
version = "0.2.153"
default-features = false
[dependencies]
cfg-if = "1.0.4"
libc = { path = "..", version = "0.2.177", default-features = false }
[dev-dependencies]
syn = { version = "2.0.108", features = ["full", "visit"] }
proc-macro2 = { version = "1.0.103", features = ["span-locations"] }
glob = "0.3.3"
annotate-snippets = { version = "0.11.5", features = ["testing-colors"] }
[build-dependencies]
cc = "1.0.83"
# FIXME: Use fork ctest until the maintainer gets back.
ctest2 = "0.4.3"
cc = "1.2.43"
# Use the in-tree `ctest` from the `main` branch via crates.io
ctest = "0.5.0-beta.3"
regex = "1.12.2"
[features]
default = ["std"]
@@ -27,61 +31,40 @@ align = ["libc/align"]
extra_traits = ["libc/extra_traits"]
[[test]]
name = "main"
path = "test/main.rs"
name = "ctest"
harness = false
[[test]]
name = "linux-fcntl"
path = "test/linux_fcntl.rs"
name = "linux_fcntl"
harness = false
[[test]]
name = "linux-if-arp"
path = "test/linux_if_arp.rs"
name = "linux_if_arp"
harness = false
[[test]]
name = "linux-ipv6"
path = "test/linux_ipv6.rs"
name = "linux_ipv6"
harness = false
[[test]]
name = "linux-elf"
path = "test/linux_elf.rs"
name = "linux_elf"
harness = false
[[test]]
name = "linux-strerror_r"
path = "test/linux_strerror_r.rs"
name = "linux_strerror_r"
harness = false
[[test]]
name = "linux-termios"
path = "test/linux_termios.rs"
name = "linux_termios"
harness = false
[[test]]
name = "cmsg"
path = "test/cmsg.rs"
harness = true
[[test]]
name = "makedev"
path = "test/makedev.rs"
harness = true
[[test]]
name = "errqueue"
path = "test/errqueue.rs"
harness = true
[[test]]
name = "sigrt"
path = "test/sigrt.rs"
harness = true
[[test]]
name = "semver"
path = "test/semver.rs"
harness = false
# FIXME(msrv): These should be moved to the root Cargo.toml as `[workspace.lints.*]`
# once MSRV is above 1.64 and replaced with `[lints] workspace=true`
[lints.rust]
[lints.clippy]
+3054 -2169
View File
File diff suppressed because it is too large Load Diff
+10 -9
View File
@@ -6,12 +6,13 @@ ensure that APIs aren't removed between libc releases.
## File order
Files are including in the following order:
* Family, e.g. `unix.txt`. NOTE: Windows is skipped here and includes as OS
name below.
* Vendor, e.g. `apple.txt`. This allows us to have a single file with system
calls shared between multiple OSs, e.g. `ios.txt`, `macos.txt` share the same
kernel.
* OS, e.g `linux.txt`, `macos.txt`, `windows.txt`.
* Architecture specific system calls, e.g. `linux-x86_64.txt` or
`linux-aarch64.txt`.
* Target environment, e.g. `windows-mscv.txt` or `windows-gnu.txt`.
* Family, e.g. `unix.txt`. NOTE: Windows is skipped here and includes as OS name
below.
* Vendor, e.g. `apple.txt`. This allows us to have a single file with system
calls shared between multiple OSs, e.g. `ios.txt`, `macos.txt` share the same
kernel.
* OS, e.g `linux.txt`, `macos.txt`, `windows.txt`.
* Architecture specific system calls, e.g. `linux-x86_64.txt` or
`linux-aarch64.txt`.
* Target environment, e.g. `windows-mscv.txt` or `windows-gnu.txt`.
+1 -2
View File
@@ -1,4 +1,4 @@
# The following symbols are not not available in some combinations of
# The following symbols are not available in some combinations of
# musl/gnu/android and/or architecture.
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
@@ -54,7 +54,6 @@ SO_SELECT_ERR_QUEUE
SO_SNDTIMEO_NEW
SO_STYLE
SO_TIMESTAMPING_NEW
SO_TIMESTAMPNS
SO_TIMESTAMPNS_NEW
SO_TIMESTAMP_NEW
SO_TXTIME
+5
View File
@@ -3,3 +3,8 @@
getpwuid_r
pthread_atfork
pthread_sigmask
# * Solaris is missing flock(2)
LOCK_EX
LOCK_NB
LOCK_SH
LOCK_UN
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -1,3 +1,5 @@
AT_SYSINFO_EHDR
AT_VECTOR_SIZE_ARCH
HWCAP2_DCPODP
HWCAP2_FLAGM2
HWCAP2_FRINT
@@ -10,8 +12,11 @@ HWCAP2_SVESM4
PROT_BTI
PROT_MTE
SYS_arch_specific_syscall
SYS_syscalls
SYS_fcntl
SYS_lseek
SYS_memfd_secret
SYS_mmap
SYS_syscalls
__system_property_wait
user_regs_struct
user_fpsimd_struct
user_regs_struct
+1
View File
@@ -1,3 +1,4 @@
AT_SYSINFO_EHDR
NGREG
PTRACE_GETFPREGS
PTRACE_GETREGS
+4
View File
@@ -1,3 +1,7 @@
AT_SYSINFO
AT_SYSINFO_EHDR
AT_VECTOR_SIZE_ARCH
SYS_memfd_secret
__c_anonymous_uc_sigmask
__c_anonymous_uc_sigmask_with_padding
time64_t
+90
View File
@@ -0,0 +1,90 @@
AT_SYSINFO_EHDR
AT_VECTOR_SIZE_ARCH
HWCAP2_AFP
HWCAP2_BF16
HWCAP2_BTI
HWCAP2_DCPODP
HWCAP2_DGH
HWCAP2_EBF16
HWCAP2_ECV
HWCAP2_FLAGM2
HWCAP2_FRINT
HWCAP2_I8MM
HWCAP2_MTE
HWCAP2_MTE3
HWCAP2_RNG
HWCAP2_RPRES
HWCAP2_SME
HWCAP2_SME_B16F32
HWCAP2_SME_F16F32
HWCAP2_SME_F32F32
HWCAP2_SME_F64F64
HWCAP2_SME_FA64
HWCAP2_SME_I16I64
HWCAP2_SME_I8I32
HWCAP2_SVE2
HWCAP2_SVEAES
HWCAP2_SVEBF16
HWCAP2_SVEBITPERM
HWCAP2_SVEF32MM
HWCAP2_SVEF64MM
HWCAP2_SVEI8MM
HWCAP2_SVEPMULL
HWCAP2_SVESHA3
HWCAP2_SVESM4
HWCAP2_SVE_EBF16
HWCAP2_WFXT
HWCAP_AES
HWCAP_ASIMD
HWCAP_ASIMDDP
HWCAP_ASIMDFHM
HWCAP_ASIMDHP
HWCAP_ASIMDRDM
HWCAP_ATOMICS
HWCAP_CPUID
HWCAP_CRC32
HWCAP_DCPOP
HWCAP_DIT
HWCAP_EVTSTRM
HWCAP_FCMA
HWCAP_FLAGM
HWCAP_FP
HWCAP_FPHP
HWCAP_ILRCPC
HWCAP_JSCVT
HWCAP_LRCPC
HWCAP_PACA
HWCAP_PACG
HWCAP_PMULL
HWCAP_SB
HWCAP_SHA1
HWCAP_SHA2
HWCAP_SHA3
HWCAP_SHA512
HWCAP_SM3
HWCAP_SM4
HWCAP_SSBS
HWCAP_SVE
HWCAP_USCAT
PROT_BTI
PROT_MTE
SYS_accept
SYS_arch_specific_syscall
SYS_fcntl
SYS_getrlimit
SYS_memfd_secret
SYS_migrate_pages
SYS_msgctl
SYS_msgget
SYS_msgrcv
SYS_msgsnd
SYS_semctl
SYS_semget
SYS_semop
SYS_semtimedop
SYS_shmat
SYS_shmctl
SYS_shmdt
SYS_shmget
SYS_sync_file_range
SYS_syscalls
+3
View File
@@ -1,3 +1,5 @@
AT_SYSINFO_EHDR
AT_VECTOR_SIZE_ARCH
EFLAGS
FS_BASE
GS_BASE
@@ -44,6 +46,7 @@ SYS_arch_prctl
SYS_epoll_ctl_old
SYS_epoll_wait_old
SYS_kexec_file_load
SYS_memfd_secret
SYS_msgctl
SYS_msgget
SYS_msgrcv
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More