|
| 1 | +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT |
| 2 | +// file at the top-level directory of this distribution and at |
| 3 | +// http://rust-lang.org/COPYRIGHT. |
| 4 | +// |
| 5 | +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 7 | +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 8 | +// option. This file may not be copied, modified, or distributed |
| 9 | +// except according to those terms. |
| 10 | + |
| 11 | +use spec::{LinkerFlavor, Target, TargetOptions, TargetResult, PanicStrategy}; |
| 12 | + |
| 13 | +pub fn target() -> TargetResult { |
| 14 | + let mut base = super::windows_msvc_base::opts(); |
| 15 | + |
| 16 | + // Prevent error LNK2013: BRANCH24(T) fixup overflow |
| 17 | + // The LBR optimization tries to eliminate branch islands, |
| 18 | + // but if the displacement is larger than can fit |
| 19 | + // in the instruction, this error will occur. The linker |
| 20 | + // should be smart enough to insert branch islands only |
| 21 | + // where necessary, but this is not the observed behavior. |
| 22 | + // Disabling the LBR optimization works around the issue. |
| 23 | + base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().push( |
| 24 | + "/OPT:NOLBR".to_string()); |
| 25 | + |
| 26 | + // FIXME(jordanrh): use PanicStrategy::Unwind when SEH is |
| 27 | + // implemented for windows/arm in LLVM |
| 28 | + base.panic_strategy = PanicStrategy::Abort; |
| 29 | + |
| 30 | + Ok(Target { |
| 31 | + llvm_target: "thumbv7a-pc-windows-msvc".to_string(), |
| 32 | + target_endian: "little".to_string(), |
| 33 | + target_pointer_width: "32".to_string(), |
| 34 | + target_c_int_width: "32".to_string(), |
| 35 | + data_layout: "e-m:w-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), |
| 36 | + arch: "arm".to_string(), |
| 37 | + target_os: "windows".to_string(), |
| 38 | + target_env: "msvc".to_string(), |
| 39 | + target_vendor: "pc".to_string(), |
| 40 | + linker_flavor: LinkerFlavor::Msvc, |
| 41 | + |
| 42 | + options: TargetOptions { |
| 43 | + features: "+vfp3,+neon".to_string(), |
| 44 | + cpu: "generic".to_string(), |
| 45 | + max_atomic_width: Some(64), |
| 46 | + abi_blacklist: super::arm_base::abi_blacklist(), |
| 47 | + .. base |
| 48 | + } |
| 49 | + }) |
| 50 | +} |
0 commit comments