| 1 |
--- a/lib.rs |
| 2 |
+++ b/lib.rs |
| 3 |
@@ -783,6 +783,23 @@ |
| 4 |
let (effective_target, explicit_target) = |
| 5 |
find_effective_target(&options.clang_args); |
| 6 |
|
| 7 |
+ // pass time64 options for glibc to libclang |
| 8 |
+ // In theory we don't have to worry about 64-bit architectures as the |
| 9 |
+ // options are supposed to be no-ops there. However in practice the |
| 10 |
+ // time64 options seem to cause some problems on mips64el, so if the |
| 11 |
+ // first part of the target string contains "64" we assume the target |
| 12 |
+ // is 64-bit and do not pass the flags. |
| 13 |
+ |
| 14 |
+ // We also have to exclude i368, since debian has decided to exclude |
| 15 |
+ // that from the time64 transition . We also check for |
| 16 |
+ // i468, i568 and i686. I'm not sure if it's possible for them to appear |
| 17 |
+ // here, but it seems safer to check for them than not. |
| 18 |
+ if (!effective_target.split("-").next().unwrap().contains("64")) && (!effective_target.starts_with("i386")) && (!effective_target.starts_with("i486")) && (!effective_target.starts_with("i586")) && (!effective_target.starts_with("i686")) { |
| 19 |
+ options |
| 20 |
+ .clang_args |
| 21 |
+ .extend(["-D_FILE_OFFSET_BITS=64".into(), "-D_TIME_BITS=64".into()]); |
| 22 |
+ } |
| 23 |
+ |
| 24 |
let is_host_build = |
| 25 |
rust_to_clang_target(HOST_TARGET) == effective_target; |
| 26 |
|