@@ -3230,6 +3230,31 @@ fn test_vxworks(target: &str) {
3230
3230
cfg. generate ( "../src/lib.rs" , "main.rs" ) ;
3231
3231
}
3232
3232
3233
+ fn config_gnu_time64 ( target : & str , cfg : & mut ctest:: TestGenerator ) {
3234
+ let gnu = target. contains ( "gnu" ) ;
3235
+ let x32 = target. contains ( "x32" ) ;
3236
+ let riscv = target. contains ( "riscv32" ) ;
3237
+
3238
+ if gnu && & env:: var ( "CARGO_CFG_TARGET_POINTER_WIDTH" ) . unwrap ( ) == "32" && !riscv && !x32 {
3239
+ match env:: var ( "RUST_LIBC_TIME_BITS" ) {
3240
+ Ok ( time_bits) => {
3241
+ if time_bits == "64" || time_bits == "default" {
3242
+ cfg. define ( "_TIME_BITS" , Some ( "64" ) ) ;
3243
+ cfg. define ( "_FILE_OFFSET_BITS" , Some ( "64" ) ) ;
3244
+ cfg. cfg ( "gnu_time64_abi" , None ) ;
3245
+ } else if time_bits != "32" {
3246
+ panic ! ( "Unsupported RUST_LIBC_TIME_BITS value {}" , time_bits)
3247
+ }
3248
+ }
3249
+ Err ( _) => {
3250
+ cfg. define ( "_TIME_BITS" , Some ( "64" ) ) ;
3251
+ cfg. define ( "_FILE_OFFSET_BITS" , Some ( "64" ) ) ;
3252
+ cfg. cfg ( "gnu_time64_abi" , None ) ;
3253
+ }
3254
+ }
3255
+ }
3256
+ }
3257
+
3233
3258
fn test_linux ( target : & str ) {
3234
3259
assert ! ( target. contains( "linux" ) ) ;
3235
3260
@@ -3272,6 +3297,8 @@ fn test_linux(target: &str) {
3272
3297
// glibc versions older than 2.29.
3273
3298
cfg. define ( "__GLIBC_USE_DEPRECATED_SCANF" , None ) ;
3274
3299
3300
+ config_gnu_time64 ( target, & mut cfg) ;
3301
+
3275
3302
headers ! { cfg:
3276
3303
"ctype.h" ,
3277
3304
"dirent.h" ,
@@ -4394,6 +4421,7 @@ fn test_linux_like_apis(target: &str) {
4394
4421
if linux || android || emscripten {
4395
4422
// test strerror_r from the `string.h` header
4396
4423
let mut cfg = ctest_cfg ( ) ;
4424
+ config_gnu_time64 ( target, & mut cfg) ;
4397
4425
cfg. skip_type ( |_| true ) . skip_static ( |_| true ) ;
4398
4426
4399
4427
headers ! { cfg: "string.h" }
@@ -4410,6 +4438,7 @@ fn test_linux_like_apis(target: &str) {
4410
4438
// test fcntl - see:
4411
4439
// http://man7.org/linux/man-pages/man2/fcntl.2.html
4412
4440
let mut cfg = ctest_cfg ( ) ;
4441
+ config_gnu_time64 ( target, & mut cfg) ;
4413
4442
4414
4443
if musl {
4415
4444
cfg. header ( "fcntl.h" ) ;
@@ -4439,6 +4468,7 @@ fn test_linux_like_apis(target: &str) {
4439
4468
if linux || android {
4440
4469
// test termios
4441
4470
let mut cfg = ctest_cfg ( ) ;
4471
+ config_gnu_time64 ( target, & mut cfg) ;
4442
4472
cfg. header ( "asm/termbits.h" ) ;
4443
4473
cfg. header ( "linux/termios.h" ) ;
4444
4474
cfg. skip_type ( |_| true )
@@ -4463,6 +4493,7 @@ fn test_linux_like_apis(target: &str) {
4463
4493
if linux || android {
4464
4494
// test IPV6_ constants:
4465
4495
let mut cfg = ctest_cfg ( ) ;
4496
+ config_gnu_time64 ( target, & mut cfg) ;
4466
4497
headers ! {
4467
4498
cfg:
4468
4499
"linux/in6.h"
@@ -4494,6 +4525,7 @@ fn test_linux_like_apis(target: &str) {
4494
4525
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
4495
4526
// making the tests for these fails when both are included.
4496
4527
let mut cfg = ctest_cfg ( ) ;
4528
+ config_gnu_time64 ( target, & mut cfg) ;
4497
4529
cfg. header ( "elf.h" ) ;
4498
4530
cfg. skip_fn ( |_| true )
4499
4531
. skip_static ( |_| true )
@@ -4513,6 +4545,7 @@ fn test_linux_like_apis(target: &str) {
4513
4545
if linux || android {
4514
4546
// Test `ARPHRD_CAN`.
4515
4547
let mut cfg = ctest_cfg ( ) ;
4548
+ config_gnu_time64 ( target, & mut cfg) ;
4516
4549
cfg. header ( "linux/if_arp.h" ) ;
4517
4550
cfg. skip_fn ( |_| true )
4518
4551
. skip_static ( |_| true )
0 commit comments