diff options
author | Nathan Froyd <froydnj@gmail.com> | 2017-05-12 14:21:27 -0400 |
---|---|---|
committer | Nathan Froyd <froydnj@gmail.com> | 2017-05-12 14:29:12 -0400 |
commit | e966d976fc35c8237a557cef53d1fbf952ff99cd (patch) | |
tree | d30b705d34203307d6330e68b9b46cbf7346792d | |
parent | 121662aa570f9e4005deec6d502acba7ab56c076 (diff) | |
download | servo-e966d976fc35c8237a557cef53d1fbf952ff99cd.tar.gz servo-e966d976fc35c8237a557cef53d1fbf952ff99cd.zip |
explicitly specify bitness for x86 cross-compilation situations
Despite compiling for architecture X, the user may have specified a
clang that defaults to architecture Y. We need to ensure that we invoke
clang with the correct architecture selection. We do not use --target
to do this, however, because that runs into problems with LLVM's default
search paths. For the x86 case, we can simply use -m$BITNESS to select
the correct architecture.
-rw-r--r-- | components/style/build_gecko.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index 3b80bd33819..b7f4baaf51f 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -153,6 +153,15 @@ mod bindings { } if cfg!(target_os = "linux") { builder = builder.clang_arg("-DOS_LINUX=1"); + // We may be cross-compiling with a clang that defaults to + // a different architecture, so we should explicitly specify + // the bitness being used here. Specifying --target instead + // leads to difficulties with LLVM search paths. + if cfg!(target_arch = "x86") { + builder = builder.clang_arg("-m32") + } else if cfg!(target_arch = "x86_64") { + builder = builder.clang_arg("-m64") + } } else if cfg!(target_os = "solaris") { builder = builder.clang_arg("-DOS_SOLARIS=1"); } else if cfg!(target_os = "dragonfly") { |