Skip to content

Commit cf597c2

Browse files
committed
Auto merge of #2636 - skrap:master, r=Amanieu
uclibc: fix O_TMPFILE value, hide some unused fields to fix libc-test This was a bit of a yak-shave. First, O_TMPFILE was wrong because 020000000 is decimal, not octal. 🤦 This was, of course, causing all sorts of things to be horrible. That led me to switch to a newer toolchain which actually defined O_TMPFILE, so that the libc tests pass on `armv7-unknown-linux-uclibceabihf`. That revealed that certain field names had changed since the last time I ran the libc tests on this architecture, which revealed that some struct fields (e.g. `__unused`) were being marked as `pub` where all other architectures left them as private. So, this patch might seem somewhat sprawling, but without all of these changes it's not possible to run libc-test! To test: * get https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--uclibc--bleeding-edge-2021.11-1.tar.bz2 * unpack somewhere, and call that `$TOOLCHAIN` ``` cd libc-test PATH=$TOOLCHAIN/bin:$PATH \ CC_armv7_unknown_linux_uclibc=armv7-buildroot-linux-uclibc-gcc \ CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_LINKER=armv7-buildroot-linux-uclibc-gcc \ CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_RUNNER="qemu-arm -L $TOOLCHAIN/arm-buildroot-linux-uclibcgnueabihf/sysroot/" \ cargo +nightly test --target armv7-unknown-linux-uclibceabihf -Zbuild-std=core,std ```
2 parents f617891 + 0fcf5b3 commit cf597c2

File tree

4 files changed

+21
-31
lines changed

4 files changed

+21
-31
lines changed

ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
66

77
RUN mkdir /toolchain
88

9-
RUN curl --retry 5 -L https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--uclibc--bleeding-edge-2020.08-1.tar.bz2 | \
9+
RUN curl --retry 5 -L https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--uclibc--bleeding-edge-2021.11-1.tar.bz2 | \
1010
tar xjf - -C /toolchain --strip-components=1
1111
RUN /toolchain/relocate-sdk.sh
1212

libc-test/build.rs

-10
Original file line numberDiff line numberDiff line change
@@ -3167,10 +3167,6 @@ fn test_linux(target: &str) {
31673167
"NETLINK_GET_STRICT_CHK" if arm || mips || musl => true,
31683168

31693169
// kernel constants not available in uclibc 1.0.34
3170-
| "ADDR_COMPAT_LAYOUT"
3171-
| "ADDR_LIMIT_3GB"
3172-
| "ADDR_NO_RANDOMIZE"
3173-
| "CLONE_NEWCGROUP"
31743170
| "EXTPROC"
31753171
| "FAN_MARK_FILESYSTEM"
31763172
| "FAN_MARK_INODE"
@@ -3181,13 +3177,7 @@ fn test_linux(target: &str) {
31813177
| "IPV6_PMTUDISC_INTERFACE"
31823178
| "IPV6_PMTUDISC_OMIT"
31833179
| "IPV6_ROUTER_ALERT_ISOLATE"
3184-
| "O_TMPFILE"
31853180
| "PACKET_MR_UNICAST"
3186-
| "PTRACE_EVENT_STOP"
3187-
| "PTRACE_O_EXITKILL"
3188-
| "PTRACE_O_SUSPEND_SECCOMP"
3189-
| "PTRACE_PEEKSIGINFO"
3190-
| "READ_IMPLIES_EXEC"
31913181
| "RUSAGE_THREAD"
31923182
| "SHM_EXEC"
31933183
| "UDP_GRO"

src/unix/linux_like/linux/uclibc/arm/mod.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ s! {
4444

4545
pub struct stat {
4646
pub st_dev: ::c_ulonglong,
47-
pub __pad1: ::c_ushort,
47+
__pad1: ::c_ushort,
4848
pub st_ino: ::ino_t,
4949
pub st_mode: ::mode_t,
5050
pub st_nlink: ::nlink_t,
5151
pub st_uid: ::uid_t,
5252
pub st_gid: ::gid_t,
5353
pub st_rdev: ::c_ulonglong,
54-
pub __pad2: ::c_ushort,
54+
__pad2: ::c_ushort,
5555
pub st_size: ::off_t,
5656
pub st_blksize: ::blksize_t,
5757
pub st_blocks: ::blkcnt_t,
@@ -61,8 +61,8 @@ s! {
6161
pub st_mtime_nsec: ::c_long,
6262
pub st_ctime: ::time_t,
6363
pub st_ctime_nsec: ::c_long,
64-
pub __unused4: ::c_ulong,
65-
pub __unused5: ::c_ulong,
64+
__unused4: ::c_ulong,
65+
__unused5: ::c_ulong,
6666
}
6767

6868
pub struct stat64
@@ -202,44 +202,44 @@ s! {
202202
pub cuid: ::uid_t,
203203
pub cgid: ::gid_t,
204204
pub mode: ::c_ushort,
205-
pub __pad1: ::c_ushort,
205+
__pad1: ::c_ushort,
206206
pub __seq: ::c_ushort,
207-
pub __pad2: ::c_ushort,
208-
pub __unused1: ::c_ulong,
209-
pub __unused2: ::c_ulong,
207+
__pad2: ::c_ushort,
208+
__unused1: ::c_ulong,
209+
__unused2: ::c_ulong,
210210
}
211211

212212
pub struct msqid_ds {
213213
pub msg_perm: ::ipc_perm,
214214
pub msg_stime: ::time_t,
215-
pub __unused1: ::c_ulong,
215+
__unused1: ::c_ulong,
216216
pub msg_rtime: ::time_t,
217-
pub __unused2: ::c_ulong,
217+
__unused2: ::c_ulong,
218218
pub msg_ctime: ::time_t,
219-
pub __unused3: ::c_ulong,
220-
pub __msg_cbytes: ::c_ulong,
219+
__unused3: ::c_ulong,
220+
__msg_cbytes: ::c_ulong,
221221
pub msg_qnum: ::msgqnum_t,
222222
pub msg_qbytes: ::msglen_t,
223223
pub msg_lspid: ::pid_t,
224224
pub msg_lrpid: ::pid_t,
225-
pub __unused4: ::c_ulong,
226-
pub __unused5: ::c_ulong,
225+
__unused4: ::c_ulong,
226+
__unused5: ::c_ulong,
227227
}
228228

229229
pub struct shmid_ds {
230230
pub shm_perm: ::ipc_perm,
231231
pub shm_segsz: ::size_t,
232232
pub shm_atime: ::time_t,
233-
pub __unused1: ::c_ulong,
233+
__unused1: ::c_ulong,
234234
pub shm_dtime: ::time_t,
235-
pub __unused2: ::c_ulong,
235+
__unused2: ::c_ulong,
236236
pub shm_ctime: ::time_t,
237-
pub __unused3: ::c_ulong,
237+
__unused3: ::c_ulong,
238238
pub shm_cpid: ::pid_t,
239239
pub shm_lpid: ::pid_t,
240240
pub shm_nattch: ::shmatt_t,
241-
pub __unused4: ::c_ulong,
242-
pub __unused5: ::c_ulong,
241+
__unused4: ::c_ulong,
242+
__unused5: ::c_ulong,
243243
}
244244
}
245245

src/unix/linux_like/linux/uclibc/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ pub const MAP_HUGE_16GB: ::c_int = 34 << MAP_HUGE_SHIFT;
303303
pub const MINSIGSTKSZ: ::c_int = 2048;
304304
pub const MSG_COPY: ::c_int = 040000;
305305
pub const NI_MAXHOST: ::socklen_t = 1025;
306-
pub const O_TMPFILE: ::c_int = 020000000 | O_DIRECTORY;
306+
pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
307307
pub const PACKET_MR_UNICAST: ::c_int = 3;
308308
pub const PF_NFC: ::c_int = 39;
309309
pub const PF_VSOCK: ::c_int = 40;

0 commit comments

Comments
 (0)