diff options
| author | Daniel Klauer <daniel.c.klauer@web.de> | 2017-09-30 13:48:12 +0200 |
|---|---|---|
| committer | Daniel Klauer <daniel.c.klauer@web.de> | 2017-09-30 16:30:12 +0200 |
| commit | 12a8bc6eb916c3b8a61ad813c2e15aac8184c357 (patch) | |
| tree | 887b81f11b6b29d21a7976c452ce686b5db8a6a3 | |
| parent | a204c193cad7309412e98db09d6bf8f3c456b063 (diff) | |
| download | rust-12a8bc6eb916c3b8a61ad813c2e15aac8184c357.tar.gz rust-12a8bc6eb916c3b8a61ad813c2e15aac8184c357.zip | |
rustc: Use 16bit c_int for msp430
Fix regression from c2fe69b9, where main() signature was changed from using 16bit isize to 32bit c_int for argc parameter/result.
| -rw-r--r-- | src/librustc_back/target/msp430_none_elf.rs | 2 | ||||
| -rw-r--r-- | src/test/codegen/abi-main-signature-16bit-c-int.rs | 32 | ||||
| -rw-r--r-- | src/test/codegen/abi-main-signature-32bit-c-int.rs (renamed from src/test/codegen/abi-main-signature.rs) | 3 |
3 files changed, 36 insertions, 1 deletions
diff --git a/src/librustc_back/target/msp430_none_elf.rs b/src/librustc_back/target/msp430_none_elf.rs index e3851ec0829..9227a96e750 100644 --- a/src/librustc_back/target/msp430_none_elf.rs +++ b/src/librustc_back/target/msp430_none_elf.rs @@ -16,7 +16,7 @@ pub fn target() -> TargetResult { llvm_target: "msp430-none-elf".to_string(), target_endian: "little".to_string(), target_pointer_width: "16".to_string(), - target_c_int_width: "32".to_string(), + target_c_int_width: "16".to_string(), data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".to_string(), arch: "msp430".to_string(), target_os: "none".to_string(), diff --git a/src/test/codegen/abi-main-signature-16bit-c-int.rs b/src/test/codegen/abi-main-signature-16bit-c-int.rs new file mode 100644 index 00000000000..fbe2fd10e7a --- /dev/null +++ b/src/test/codegen/abi-main-signature-16bit-c-int.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Checks the signature of the implicitly generated native main() +// entry point. It must match C's `int main(int, char **)`. + +// This test is for targets with 16bit c_int only. +// ignore-aarch64 +// ignore-arm +// ignore-asmjs +// ignore-hexagon +// ignore-mips +// ignore-powerpc +// ignore-powerpc64 +// ignore-s390x +// ignore-sparc +// ignore-wasm32 +// ignore-x86 +// ignore-x86_64 +// ignore-xcore + +fn main() { +} + +// CHECK: define i16 @main(i16, i8**) diff --git a/src/test/codegen/abi-main-signature.rs b/src/test/codegen/abi-main-signature-32bit-c-int.rs index 3d09e0d9e6f..3139749dfcb 100644 --- a/src/test/codegen/abi-main-signature.rs +++ b/src/test/codegen/abi-main-signature-32bit-c-int.rs @@ -11,6 +11,9 @@ // Checks the signature of the implicitly generated native main() // entry point. It must match C's `int main(int, char **)`. +// This test is for targets with 32bit c_int only. +// ignore-msp430 + fn main() { } |
