Skip to content

Commit 12a8bc6

Browse files
committed
rustc: Use 16bit c_int for msp430
Fix regression from c2fe69b, where main() signature was changed from using 16bit isize to 32bit c_int for argc parameter/result.
1 parent a204c19 commit 12a8bc6

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

src/librustc_back/target/msp430_none_elf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
1616
llvm_target: "msp430-none-elf".to_string(),
1717
target_endian: "little".to_string(),
1818
target_pointer_width: "16".to_string(),
19-
target_c_int_width: "32".to_string(),
19+
target_c_int_width: "16".to_string(),
2020
data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".to_string(),
2121
arch: "msp430".to_string(),
2222
target_os: "none".to_string(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2017 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+
// Checks the signature of the implicitly generated native main()
12+
// entry point. It must match C's `int main(int, char **)`.
13+
14+
// This test is for targets with 16bit c_int only.
15+
// ignore-aarch64
16+
// ignore-arm
17+
// ignore-asmjs
18+
// ignore-hexagon
19+
// ignore-mips
20+
// ignore-powerpc
21+
// ignore-powerpc64
22+
// ignore-s390x
23+
// ignore-sparc
24+
// ignore-wasm32
25+
// ignore-x86
26+
// ignore-x86_64
27+
// ignore-xcore
28+
29+
fn main() {
30+
}
31+
32+
// CHECK: define i16 @main(i16, i8**)

src/test/codegen/abi-main-signature.rs renamed to src/test/codegen/abi-main-signature-32bit-c-int.rs

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// Checks the signature of the implicitly generated native main()
1212
// entry point. It must match C's `int main(int, char **)`.
1313

14+
// This test is for targets with 32bit c_int only.
15+
// ignore-msp430
16+
1417
fn main() {
1518
}
1619

0 commit comments

Comments
 (0)