Skip to content

Commit 019f429

Browse files
committed
Merge branch 'master' into exchangedata
2 parents 41475bd + e1ebfaf commit 019f429

File tree

42 files changed

+1248
-571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1248
-571
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ appveyor = { repository = "rust-lang/libc", project_name = "rust-lang-libs/libc"
2020
[features]
2121
default = ["use_std"]
2222
use_std = []
23+
align = []
2324

2425
[workspace]
2526
members = ["libc-test"]

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ this via:
3535
libc = { version = "0.2", default-features = false }
3636
```
3737

38+
By default libc uses private fields in structs in order to enforce a certain
39+
memory alignment on them. These structs can be hard to instantiate outside of
40+
libc. To make libc use `#[repr(align(x))]`, instead of the private fields,
41+
activate the *align* feature. This requires Rust 1.25 or newer:
42+
43+
```toml
44+
[dependencies]
45+
libc = { version = "0.2", features = ["align"] }
46+
```
47+
3848
## What is libc?
3949

4050
The primary purpose of this crate is to provide all of the definitions necessary

ci/docker/aarch64-unknown-linux-musl/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ FROM ubuntu:17.10
33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc make libc6-dev git curl ca-certificates \
55
gcc-aarch64-linux-gnu qemu-user
6-
RUN curl https://www.musl-libc.org/releases/musl-1.1.16.tar.gz | \
6+
RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \
77
tar xzf - && \
8-
cd musl-1.1.16 && \
8+
cd musl-1.1.19 && \
99
CC=aarch64-linux-gnu-gcc \
1010
./configure --prefix=/musl-aarch64 --enable-wrapper=yes && \
1111
make install -j4 && \
1212
cd .. && \
13-
rm -rf musl-1.1.16 && \
13+
rm -rf musl-1.1.19
1414
# Install linux kernel headers sanitized for use with musl
15-
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
15+
RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
1616
tar xzf - && \
17-
cd kernel-headers-3.12.6-5 && \
17+
cd kernel-headers-3.12.6-6 && \
1818
make ARCH=arm64 prefix=/musl-aarch64 install -j4 && \
1919
cd .. && \
20-
rm -rf kernel-headers-3.12.6-5
20+
rm -rf kernel-headers-3.12.6-6
2121

2222
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd?
2323
ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \

ci/docker/arm-unknown-linux-musleabihf/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc make libc6-dev git curl ca-certificates \
55
gcc-arm-linux-gnueabihf qemu-user
66

7-
RUN curl https://www.musl-libc.org/releases/musl-1.1.16.tar.gz | tar xzf -
8-
WORKDIR /musl-1.1.16
7+
RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | tar xzf -
8+
WORKDIR /musl-1.1.19
99
RUN CC=arm-linux-gnueabihf-gcc \
1010
CFLAGS="-march=armv6 -marm" \
1111
./configure --prefix=/musl-arm --enable-wrapper=yes
1212
RUN make install -j4
1313

1414
# Install linux kernel headers sanitized for use with musl
15-
RUN \
16-
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
15+
RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
1716
tar xzf - && \
18-
cd kernel-headers-3.12.6-5 && \
17+
cd kernel-headers-3.12.6-6 && \
1918
make ARCH=arm prefix=/musl-arm install -j4 && \
2019
cd .. && \
21-
rm -rf kernel-headers-3.12.6-5
20+
rm -rf kernel-headers-3.12.6-6
21+
2222
ENV PATH=$PATH:/musl-arm/bin:/rust/bin \
2323
CC_arm_unknown_linux_musleabihf=musl-gcc \
2424
CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER=musl-gcc \

ci/docker/i686-unknown-linux-musl/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ RUN apt-get install -y --no-install-recommends \
1212
# since otherwise the script will fail to find a compiler.
1313
# * We manually unset CROSS_COMPILE when running make; otherwise the makefile
1414
# will call the non-existent binary 'i686-ar'.
15-
RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
15+
RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \
1616
tar xzf - && \
17-
cd musl-1.1.15 && \
17+
cd musl-1.1.19 && \
1818
CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
1919
make CROSS_COMPILE= install -j4 && \
2020
cd .. && \
21-
rm -rf musl-1.1.15 && \
21+
rm -rf musl-1.1.19
2222
# Install linux kernel headers sanitized for use with musl
23-
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
23+
RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
2424
tar xzf - && \
25-
cd kernel-headers-3.12.6-5 && \
25+
cd kernel-headers-3.12.6-6 && \
2626
make ARCH=i386 prefix=/musl-i686 install -j4 && \
2727
cd .. && \
28-
rm -rf kernel-headers-3.12.6-5
28+
rm -rf kernel-headers-3.12.6-6
29+
2930
ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
3031
CC_i686_unknown_linux_musl=musl-gcc

ci/docker/sparc64-unknown-linux-gnu/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
55
gcc libc6-dev \
66
gcc-sparc64-linux-gnu libc6-dev-sparc64-cross \
77
qemu-system-sparc64 openbios-sparc seabios ipxe-qemu \
8-
p7zip-full cpio
8+
p7zip-full cpio linux-libc-dev-sparc64-cross linux-headers-4.9.0-3-common
9+
10+
# Put linux/module.h into the right spot as it is not shipped by debian
11+
RUN cp /usr/src/linux-headers-4.9.0-3-common/include/uapi/linux/module.h /usr/sparc64-linux-gnu/include/linux/
912

1013
COPY linux-sparc64.sh /
1114
RUN bash /linux-sparc64.sh

ci/docker/x86_64-unknown-linux-musl/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ FROM ubuntu:17.10
33
RUN apt-get update
44
RUN apt-get install -y --no-install-recommends \
55
gcc make libc6-dev git curl ca-certificates
6-
RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
6+
RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \
77
tar xzf - && \
8-
cd musl-1.1.15 && \
8+
cd musl-1.1.19 && \
99
./configure --prefix=/musl-x86_64 && \
1010
make install -j4 && \
1111
cd .. && \
12-
rm -rf musl-1.1.15 && \
12+
rm -rf musl-1.1.19
1313
# Install linux kernel headers sanitized for use with musl
14-
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
14+
RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
1515
tar xzf - && \
16-
cd kernel-headers-3.12.6-5 && \
16+
cd kernel-headers-3.12.6-6 && \
1717
make ARCH=x86_64 prefix=/musl-x86_64 install -j4 && \
1818
cd .. && \
19-
rm -rf kernel-headers-3.12.6-5
19+
rm -rf kernel-headers-3.12.6-6
2020
ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin

ci/run.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,20 @@ if [ "$QEMU" != "" ]; then
7979
exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
8080
fi
8181

82-
# FIXME: x86_64-unknown-linux-gnux32 fail to compile wihout --release
82+
# FIXME: x86_64-unknown-linux-gnux32 fail to compile without --release
8383
# See https://github.com/rust-lang/rust/issues/45417
8484
opt=
8585
if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then
8686
opt="--release"
8787
fi
8888

89-
cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml --target $TARGET
89+
# Building with --no-default-features is currently broken on rumprun because we
90+
# need cfg(target_vendor), which is currently unstable.
91+
if [ "$TARGET" != "x86_64-rumprun-netbsd" ]; then
92+
cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml --target $TARGET
93+
fi
94+
# Test the #[repr(align(x))] feature if this is building on Rust >= 1.25
95+
if [ $(rustc --version | sed -E 's/^rustc 1\.([0-9]*)\..*/\1/') -ge 25 ]; then
96+
cargo test $opt --features align --manifest-path libc-test/Cargo.toml --target $TARGET
97+
fi
9098
exec cargo test $opt --manifest-path libc-test/Cargo.toml --target $TARGET

libc-test/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ctest = { git = "https://github.com/alexcrichton/ctest" }
1414
[features]
1515
default = [ "use_std" ]
1616
use_std = [ "libc/use_std" ]
17+
align = [ "libc/align" ]
1718

1819
[[test]]
1920
name = "main"

0 commit comments

Comments
 (0)