From 49be10a8179165d24bbb8eb3490c4ca6f94b42c4 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Fri, 1 Nov 2019 07:42:33 -0700 Subject: Update libc crate to 0.2.66 This change updates the libc crate to version 0.2.66. Import subrepo libc/:libc at 4f11029a68040c90acf771976b019c1ef273a8cd --- libc/ci/azure-install-rust.yml | 10 +++++--- libc/ci/azure-master.yml | 22 ++++++++++++++++ libc/ci/azure.yml | 30 +++++++++++++--------- libc/ci/build.sh | 25 ++++++++++++++---- libc/ci/docker/asmjs-unknown-emscripten/Dockerfile | 1 + libc/ci/docker/mips-unknown-linux-musl/Dockerfile | 25 +++++++++++------- .../mips64-unknown-linux-muslabi64/Dockerfile | 15 +++++++++++ .../mips64el-unknown-linux-muslabi64/Dockerfile | 15 +++++++++++ .../ci/docker/mipsel-unknown-linux-musl/Dockerfile | 27 +++++++++++-------- .../ci/docker/wasm32-unknown-emscripten/Dockerfile | 1 + libc/ci/dox.sh | 4 +-- libc/ci/emscripten.sh | 14 ++++------ libc/ci/install-musl.sh | 16 +++++++++++- libc/ci/run.sh | 8 +++--- libc/ci/semver.sh | 2 +- libc/ci/style.rs | 4 --- libc/ci/sysinfo_guard.patch | 10 ++++++++ 17 files changed, 170 insertions(+), 59 deletions(-) create mode 100644 libc/ci/azure-master.yml create mode 100644 libc/ci/docker/mips64-unknown-linux-muslabi64/Dockerfile create mode 100644 libc/ci/docker/mips64el-unknown-linux-muslabi64/Dockerfile create mode 100644 libc/ci/sysinfo_guard.patch (limited to 'libc/ci') diff --git a/libc/ci/azure-install-rust.yml b/libc/ci/azure-install-rust.yml index eba0669..31b0714 100644 --- a/libc/ci/azure-install-rust.yml +++ b/libc/ci/azure-install-rust.yml @@ -6,10 +6,12 @@ steps: toolchain=nightly fi if command -v rustup; then - rustup update $toolchain + # Uncomment when rustup on Azure is updated + #rustup set profile minimal + rustup update --force $toolchain rustup default $toolchain else - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $toolchain + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $toolchain --profile=minimal echo "##vso[task.prependpath]$HOME/.cargo/bin" fi displayName: Install rust (unix) @@ -17,7 +19,9 @@ steps: - script: | @echo on if not defined TOOLCHAIN set TOOLCHAIN=nightly - rustup update %TOOLCHAIN%-%TARGET% + :: Uncomment when rustup on Azure is updated + ::rustup set profile minimal + rustup update --no-self-update %TOOLCHAIN%-%TARGET% rustup default %TOOLCHAIN%-%TARGET% displayName: Install rust (windows) condition: eq( variables['Agent.OS'], 'Windows_NT' ) diff --git a/libc/ci/azure-master.yml b/libc/ci/azure-master.yml new file mode 100644 index 0000000..d7bcb7c --- /dev/null +++ b/libc/ci/azure-master.yml @@ -0,0 +1,22 @@ +variables: + - group: secrets +resources: + repositories: + - repository: rustinfra + type: github + name: rust-lang/simpleinfra + endpoint: gnzlbg +trigger: ["master"] +pr: ["master"] + +jobs: + - job: StyleAndDocs + pool: + vmImage: ubuntu-16.04 + steps: + - template: azure-install-rust.yml + - script: LIBC_CI=1 sh ci/dox.sh + displayName: Generate documentation + - template: azure-configs/static-websites.yml@rustinfra + parameters: + deploy_dir: target/doc diff --git a/libc/ci/azure.yml b/libc/ci/azure.yml index 4526361..da25a26 100644 --- a/libc/ci/azure.yml +++ b/libc/ci/azure.yml @@ -25,7 +25,7 @@ jobs: TARGET: x86_64-unknown-linux-gnu - job: DockerLinuxTier2 - dependsOn: DockerLinuxTier1 + #dependsOn: DockerLinuxTier1 pool: vmImage: ubuntu-16.04 steps: @@ -46,8 +46,10 @@ jobs: TARGET: arm-unknown-linux-gnueabihf arm-unknown-linux-musleabihf: TARGET: arm-unknown-linux-musleabihf - asmjs-unknown-emscripten: - TARGET: asmjs-unknown-emscripten + # Disabled because currently broken, see: + # https://github.com/rust-lang/libc/issues/1591 + # asmjs-unknown-emscripten: + # TARGET: asmjs-unknown-emscripten i686-linux-android: TARGET: i686-linux-android i686-unknown-linux-musl: @@ -74,8 +76,10 @@ jobs: # TARGET: wasm32-wasi sparc64-unknown-linux-gnu: TARGET: sparc64-unknown-linux-gnu - wasm32-unknown-emscripten: - TARGET: wasm32-unknown-emscripten + # Disabled because currently broken, see: + # https://github.com/rust-lang/libc/issues/1591 + # wasm32-unknown-emscripten: + # TARGET: wasm32-unknown-emscripten x86_64-linux-android: TARGET: x86_64-linux-android x86_64-unknown-linux-gnux32: @@ -122,10 +126,12 @@ jobs: ARCH: x86_64 x86_64-pc-windows-msvc: TARGET: x86_64-pc-windows-msvc - i686-pc-windows-gnu: - TARGET: i686-pc-windows-gnu - ARCH_BITS: 32 - ARCH: i686 + # Disabled because broken: + # https://github.com/rust-lang/libc/issues/1592 + #i686-pc-windows-gnu: + # TARGET: i686-pc-windows-gnu + # ARCH_BITS: 32 + # ARCH: i686 i686-pc-windows-msvc: TARGET: i686-pc-windows-msvc @@ -136,7 +142,7 @@ jobs: - template: azure-install-rust.yml - script: sh ci/style.sh displayName: Check style - - script: sh ci/dox.sh + - script: LIBC_CI=1 sh ci/dox.sh displayName: Generate documentation - template: azure-configs/static-websites.yml@rustinfra parameters: @@ -169,7 +175,7 @@ jobs: vmImage: ubuntu-16.04 steps: - template: azure-install-rust.yml - - script: sh ./ci/build.sh + - script: LIBC_CI=1 sh ./ci/build.sh displayName: Execute build.sh strategy: matrix: @@ -198,7 +204,7 @@ jobs: vmImage: macos-10.13 steps: - template: azure-install-rust.yml - - script: sh ./ci/build.sh + - script: LIBC_CI=1 sh ./ci/build.sh displayName: Execute build.sh strategy: matrix: diff --git a/libc/ci/build.sh b/libc/ci/build.sh index e63b4f7..082f0dc 100644 --- a/libc/ci/build.sh +++ b/libc/ci/build.sh @@ -2,6 +2,8 @@ # 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 @@ -13,7 +15,7 @@ RUST=${TOOLCHAIN} echo "Testing Rust ${RUST} on ${OS}" if [ "${TOOLCHAIN}" = "nightly" ] ; then - cargo +nightly install cargo-xbuild -Z install-upgrade + cargo +nightly install cargo-xbuild rustup component add rust-src fi @@ -65,6 +67,13 @@ test_target() { cargo "+${RUST}" "${BUILD_CMD}" -vv $opt --no-default-features --target "${TARGET}" \ --features extra_traits + # Test the 'const-extern-fn' feature on nightly + if [ "${RUST}" = "nightly" ]; then + cargo "+${RUST}" "${BUILD_CMD}" -vv $opt --no-default-features --target "${TARGET}" \ + --features const-extern-fn + fi + + # Also test that it builds with `extra_traits` and default features: if [ "$NO_STD" != "1" ]; then cargo "+${RUST}" "${BUILD_CMD}" -vv $opt --target "${TARGET}" \ @@ -90,7 +99,6 @@ mips-unknown-linux-musl \ mips64-unknown-linux-gnuabi64 \ mips64el-unknown-linux-gnuabi64 \ mipsel-unknown-linux-gnu \ -mipsel-unknown-linux-gnu \ mipsel-unknown-linux-musl \ powerpc-unknown-linux-gnu \ powerpc64-unknown-linux-gnu \ @@ -176,7 +184,9 @@ case "${OS}" in esac for TARGET in $TARGETS; do - test_target build "$TARGET" + if echo "$TARGET"|grep -q "$FILTER";then + test_target build "$TARGET" + fi done # FIXME: https://github.com/rust-lang/rust/issues/58564 @@ -204,10 +214,13 @@ i686-unknown-netbsd \ i686-unknown-openbsd \ mips-unknown-linux-uclibc \ mipsel-unknown-linux-uclibc \ +mips64-unknown-linux-muslabi64 \ +mips64el-unknown-linux-muslabi64 \ nvptx64-nvidia-cuda \ powerpc-unknown-linux-gnuspe \ powerpc-unknown-netbsd \ powerpc64-unknown-freebsd \ +riscv64gc-unknown-linux-gnu \ riscv32imac-unknown-none-elf \ riscv32imc-unknown-none-elf \ sparc64-unknown-netbsd \ @@ -224,7 +237,7 @@ x86_64-unknown-haiku \ x86_64-unknown-hermit \ x86_64-unknown-l4re-uclibc \ x86_64-unknown-openbsd \ -armv7-wrs-vxworks \ +armv7-wrs-vxworks-eabihf \ aarch64-wrs-vxworks \ i686-wrs-vxworks \ x86_64-wrs-vxworks \ @@ -235,7 +248,9 @@ powerpc64-wrs-vxworks \ if [ "${RUST}" = "nightly" ] && [ "${OS}" = "linux" ]; then for TARGET in $RUST_LINUX_NO_CORE_TARGETS; do - test_target xbuild "$TARGET" 1 + if echo "$TARGET"|grep -q "$FILTER";then + test_target xbuild "$TARGET" 1 + fi done # Nintendo switch diff --git a/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile b/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile index 6c08340..64f73aa 100644 --- a/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile +++ b/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get update && \ gcc \ git \ libc6-dev \ + libxml2 \ python \ xz-utils diff --git a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile index aee73be..a1ec7ff 100644 --- a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile @@ -2,16 +2,23 @@ FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ - bzip2 + xz-utils patch RUN mkdir /toolchain -# Note that this originally came from: -# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 -RUN curl --retry 5 -L https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \ - tar xjf - -C /toolchain --strip-components=1 +# Linux kernel version: 4.14.151 +# See build_dir/target-mips_24kc_musl/linux-ar71xx_generic/linux-4.14.151 +# Musl version: 1.1.24 +# See staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/info.mk +RUN curl --retry 5 -L https://downloads.openwrt.org/releases/19.07.0-rc1/targets/ar71xx/generic/openwrt-sdk-19.07.0-rc1-ar71xx-generic_gcc-7.4.0_musl.Linux-x86_64.tar.xz | \ + tar xJf - -C /toolchain --strip-components=1 -ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \ - CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \ - CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \ - CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15" +# See https://lkml.org/lkml/2014/3/14/269 +COPY sysinfo_guard.patch /toolchain +RUN patch /toolchain/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/include/linux/kernel.h targets sed -i.bak 's/ \\//g' targets -grep '^[_a-zA-Z0-9-]*$' targets > tmp && mv tmp 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 diff --git a/libc/ci/emscripten.sh b/libc/ci/emscripten.sh index db31323..acec4ca 100644 --- a/libc/ci/emscripten.sh +++ b/libc/ci/emscripten.sh @@ -28,21 +28,18 @@ exit 1 set -x } -cd / -curl --retry 5 -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \ - tar -xz - +git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable cd /emsdk-portable -./emsdk update -hide_output ./emsdk install sdk-1.38.15-64bit -./emsdk activate sdk-1.38.15-64bit +# TODO: switch to an upstream install once +# https://github.com/rust-lang/rust/pull/63649 lands +hide_output ./emsdk install 1.38.42 +./emsdk activate 1.38.42 # Compile and cache libc # shellcheck disable=SC1091 source ./emsdk_env.sh echo "main(){}" > a.c HOME=/emsdk-portable/ emcc a.c -HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c rm -f a.* # Make emsdk usable by any user @@ -53,4 +50,3 @@ chmod a+rxw -R /emsdk-portable cd / curl --retry 5 -L https://nodejs.org/dist/v12.3.1/node-v12.3.1-linux-x64.tar.xz | \ tar -xJ - diff --git a/libc/ci/install-musl.sh b/libc/ci/install-musl.sh index ab98c4f..88cb4f0 100644 --- a/libc/ci/install-musl.sh +++ b/libc/ci/install-musl.sh @@ -5,7 +5,7 @@ set -ex -MUSL_VERSION=1.1.22 +MUSL_VERSION=1.1.24 MUSL="musl-${MUSL_VERSION}" # Download, configure, build, and install musl: @@ -46,6 +46,20 @@ case ${1} in ./configure --prefix="/musl-${musl_arch}" make install -j4 ;; + mips64) + musl_arch=mips64 + kernel_arch=mips + CC=mips64-linux-gnuabi64-gcc CFLAGS="-march=mips64r2 -mabi=64" \ + ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes + make install -j4 + ;; + mips64el) + musl_arch=mips64el + kernel_arch=mips + CC=mips64el-linux-gnuabi64-gcc CFLAGS="-march=mips64r2 -mabi=64" \ + ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes + make install -j4 + ;; *) echo "Unknown target arch: \"${1}\"" exit 1 diff --git a/libc/ci/run.sh b/libc/ci/run.sh index 6f2ca11..b435122 100755 --- a/libc/ci/run.sh +++ b/libc/ci/run.sh @@ -5,6 +5,8 @@ set -ex +MIRRORS_URL="https://ci-mirrors.rust-lang.org/libc" + TARGET="${1}" # If we're going to run tests inside of a qemu image, then we don't need any of @@ -21,21 +23,21 @@ if [ "$QEMU" != "" ]; then # image is .gz : download and uncompress it qemufile="$(echo "${QEMU%.gz}" | sed 's/\//__/g')" if [ ! -f "${tmpdir}/${qemufile}" ]; then - curl --retry 5 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" | \ + 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 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" | \ + 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 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" \ + curl --retry 5 "${MIRRORS_URL}/${QEMU}" | \ > "${tmpdir}/${qemufile}" fi fi diff --git a/libc/ci/semver.sh b/libc/ci/semver.sh index 3412501..7e6ea66 100644 --- a/libc/ci/semver.sh +++ b/libc/ci/semver.sh @@ -13,7 +13,7 @@ if ! rustc --version | grep -E "nightly" ; then exit 1 fi -cargo +nightly install semverver -Z install-upgrade +cargo +nightly install semverver TARGETS= case "${OS}" in diff --git a/libc/ci/style.rs b/libc/ci/style.rs index 70fc0a0..dcb3536 100644 --- a/libc/ci/style.rs +++ b/libc/ci/style.rs @@ -17,7 +17,6 @@ //! * No trailing whitespace //! * No tabs //! * 80-character lines -//! * `extern` instead of `extern "C"` //! * Specific module layout: //! 1. use directives //! 2. typedefs @@ -126,9 +125,6 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) { if line.len() > 80 { err.error(path, i, "line longer than 80 chars"); } - if line.contains("extern \"C\"") { - err.error(path, i, "use `extern` instead of `extern \"C\""); - } if line.contains("#[cfg(") && !line.contains(" if ") && !(line.contains("target_endian") || line.contains("target_arch")) diff --git a/libc/ci/sysinfo_guard.patch b/libc/ci/sysinfo_guard.patch new file mode 100644 index 0000000..69fb795 --- /dev/null +++ b/libc/ci/sysinfo_guard.patch @@ -0,0 +1,10 @@ +@@ -2,7 +2,9 @@ + #ifndef _LINUX_KERNEL_H + #define _LINUX_KERNEL_H + ++#ifdef __GLIBC__ + #include ++#endif + + /* + * 'kernel.h' contains some often-used function prototypes etc -- cgit v1.2.1