Skip to content

Commit 0defa20

Browse files
committed
Auto merge of #44906 - dkl:main-signature, r=nagisa
Fix native main() signature on 64bit Hello, in LLVM-IR produced by rustc on x86_64-linux-gnu, the native main() function had incorrect types for the function result and argc parameter: i64, while it should be i32 (really c_int). See also #20064, #29633. So I've attempted a fix here. I tested it by checking the LLVM IR produced with --target x86_64-unknown-linux-gnu and i686-unknown-linux-gnu. Also I tried running the tests (`./x.py test`), however I'm getting two failures with and without the patch, which I'm guessing is unrelated.
2 parents 1c09315 + a4e8373 commit 0defa20

File tree

79 files changed

+153
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+153
-6
lines changed

src/librustc_back/target/aarch64_apple_ios.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn target() -> TargetResult {
1818
llvm_target: "arm64-apple-ios".to_string(),
1919
target_endian: "little".to_string(),
2020
target_pointer_width: "64".to_string(),
21+
target_c_int_width: "32".to_string(),
2122
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
2223
arch: "aarch64".to_string(),
2324
target_os: "ios".to_string(),

src/librustc_back/target/aarch64_linux_android.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub fn target() -> TargetResult {
2424
llvm_target: "aarch64-linux-android".to_string(),
2525
target_endian: "little".to_string(),
2626
target_pointer_width: "64".to_string(),
27+
target_c_int_width: "32".to_string(),
2728
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
2829
arch: "aarch64".to_string(),
2930
target_os: "android".to_string(),

src/librustc_back/target/aarch64_unknown_freebsd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub fn target() -> TargetResult {
2222
llvm_target: "aarch64-unknown-freebsd".to_string(),
2323
target_endian: "little".to_string(),
2424
target_pointer_width: "64".to_string(),
25+
target_c_int_width: "32".to_string(),
2526
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
2627
arch: "aarch64".to_string(),
2728
target_os: "freebsd".to_string(),

src/librustc_back/target/aarch64_unknown_fuchsia.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn target() -> TargetResult {
1919
llvm_target: "aarch64-unknown-fuchsia".to_string(),
2020
target_endian: "little".to_string(),
2121
target_pointer_width: "64".to_string(),
22+
target_c_int_width: "32".to_string(),
2223
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
2324
arch: "aarch64".to_string(),
2425
target_os: "fuchsia".to_string(),

src/librustc_back/target/aarch64_unknown_linux_gnu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub fn target() -> TargetResult {
2222
llvm_target: "aarch64-unknown-linux-gnu".to_string(),
2323
target_endian: "little".to_string(),
2424
target_pointer_width: "64".to_string(),
25+
target_c_int_width: "32".to_string(),
2526
target_env: "gnu".to_string(),
2627
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
2728
arch: "aarch64".to_string(),

src/librustc_back/target/aarch64_unknown_linux_musl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub fn target() -> TargetResult {
2222
llvm_target: "aarch64-unknown-linux-musl".to_string(),
2323
target_endian: "little".to_string(),
2424
target_pointer_width: "64".to_string(),
25+
target_c_int_width: "32".to_string(),
2526
target_env: "musl".to_string(),
2627
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
2728
arch: "aarch64".to_string(),

src/librustc_back/target/arm_linux_androideabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub fn target() -> TargetResult {
2121
llvm_target: "arm-linux-androideabi".to_string(),
2222
target_endian: "little".to_string(),
2323
target_pointer_width: "32".to_string(),
24+
target_c_int_width: "32".to_string(),
2425
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
2526
arch: "arm".to_string(),
2627
target_os: "android".to_string(),

src/librustc_back/target/arm_unknown_linux_gnueabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn target() -> TargetResult {
1818
llvm_target: "arm-unknown-linux-gnueabi".to_string(),
1919
target_endian: "little".to_string(),
2020
target_pointer_width: "32".to_string(),
21+
target_c_int_width: "32".to_string(),
2122
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
2223
arch: "arm".to_string(),
2324
target_os: "linux".to_string(),

src/librustc_back/target/arm_unknown_linux_gnueabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn target() -> TargetResult {
1818
llvm_target: "arm-unknown-linux-gnueabihf".to_string(),
1919
target_endian: "little".to_string(),
2020
target_pointer_width: "32".to_string(),
21+
target_c_int_width: "32".to_string(),
2122
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
2223
arch: "arm".to_string(),
2324
target_os: "linux".to_string(),

src/librustc_back/target/arm_unknown_linux_musleabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub fn target() -> TargetResult {
2525
llvm_target: "arm-unknown-linux-gnueabi".to_string(),
2626
target_endian: "little".to_string(),
2727
target_pointer_width: "32".to_string(),
28+
target_c_int_width: "32".to_string(),
2829
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
2930
arch: "arm".to_string(),
3031
target_os: "linux".to_string(),

0 commit comments

Comments
 (0)