Skip to content

Commit be11aac

Browse files
committed
Add va_list_kind to target specification
Each architecture may represent a va_list differently. Add the va_list_kind enumeration to the target specification that includes the common ways a va_list is represented.
1 parent 64e6dda commit be11aac

Some content is hidden

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

54 files changed

+180
-55
lines changed

src/librustc_target/spec/aarch64_linux_android.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult, VaListKind};
1212

1313
// See https://developer.android.com/ndk/guides/abis.html#arm64-v8a
1414
// for target ABI requirements.
@@ -19,6 +19,7 @@ pub fn target() -> TargetResult {
1919
// As documented in http://developer.android.com/ndk/guides/cpu-features.html
2020
// the neon (ASIMD) and FP must exist on all android aarch64 targets.
2121
base.features = "+neon,+fp-armv8".to_string();
22+
base.va_list_kind = VaListKind::AArch64Abi;
2223
Ok(Target {
2324
llvm_target: "aarch64-linux-android".to_string(),
2425
target_endian: "little".to_string(),

src/librustc_target/spec/aarch64_unknown_cloudabi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use spec::{LinkerFlavor, Target, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetResult, VaListKind};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::cloudabi_base::opts();
1515
base.max_atomic_width = Some(128);
1616
base.abi_blacklist = super::arm_base::abi_blacklist();
1717
base.linker = Some("aarch64-unknown-cloudabi-cc".to_string());
18+
base.va_list_kind = VaListKind::AArch64Abi;
1819

1920
Ok(Target {
2021
llvm_target: "aarch64-unknown-cloudabi".to_string(),

src/librustc_target/spec/aarch64_unknown_freebsd.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult, VaListKind};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::freebsd_base::opts();
1515
base.max_atomic_width = Some(128);
16+
base.va_list_kind = VaListKind::AArch64Abi;
1617

1718
// see #36994
1819
base.exe_allocation_crate = None;

src/librustc_target/spec/aarch64_unknown_fuchsia.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult, VaListKind};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::fuchsia_base::opts();
1515
base.max_atomic_width = Some(128);
16+
base.va_list_kind = VaListKind::AArch64Abi;
1617

1718
Ok(Target {
1819
llvm_target: "aarch64-unknown-fuchsia".to_string(),

src/librustc_target/spec/aarch64_unknown_linux_gnu.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult, VaListKind};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::linux_base::opts();
1515
base.max_atomic_width = Some(128);
16+
base.va_list_kind = VaListKind::AArch64Abi;
1617

1718
// see #36994
1819
base.exe_allocation_crate = None;

src/librustc_target/spec/aarch64_unknown_linux_musl.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult, VaListKind};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::linux_musl_base::opts();
1515
base.max_atomic_width = Some(128);
16+
base.va_list_kind = VaListKind::AArch64Abi;
1617

1718
// see #36994
1819
base.exe_allocation_crate = None;

src/librustc_target/spec/apple_ios_base.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use std::io;
1212
use std::process::Command;
13-
use spec::{LinkArgs, LinkerFlavor, TargetOptions};
13+
use spec::{LinkArgs, LinkerFlavor, TargetOptions, VaListKind};
1414

1515
use self::Arch::*;
1616

@@ -92,6 +92,13 @@ fn target_cpu(arch: Arch) -> String {
9292

9393
pub fn opts(arch: Arch) -> Result<TargetOptions, String> {
9494
let pre_link_args = build_pre_link_args(arch)?;
95+
let va_list_kind = match arch {
96+
Arch::Armv7 | Arch::Armv7s => VaListKind::VoidPtr,
97+
Arch::Arm64 => VaListKind::AArch64Abi,
98+
Arch::I386 => VaListKind::CharPtr,
99+
Arch::X86_64 => VaListKind::X86_64Abi,
100+
};
101+
95102
Ok(TargetOptions {
96103
cpu: target_cpu(arch),
97104
dynamic_linking: false,
@@ -102,6 +109,7 @@ pub fn opts(arch: Arch) -> Result<TargetOptions, String> {
102109
// ios. jemalloc 5.0 is supposed to fix this.
103110
// see https://github.com/rust-lang/rust/issues/45262
104111
exe_allocation_crate: None,
112+
va_list_kind,
105113
.. super::apple_base::opts()
106114
})
107115
}

src/librustc_target/spec/arm_linux_androideabi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult, VaListKind};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::android_base::opts();
@@ -29,6 +29,7 @@ pub fn target() -> TargetResult {
2929
linker_flavor: LinkerFlavor::Gcc,
3030
options: TargetOptions {
3131
abi_blacklist: super::arm_base::abi_blacklist(),
32+
va_list_kind: VaListKind::VoidPtr,
3233
.. base
3334
},
3435
})

src/librustc_target/spec/arm_unknown_linux_gnueabi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult, VaListKind};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::linux_base::opts();
@@ -28,6 +28,7 @@ pub fn target() -> TargetResult {
2828
options: TargetOptions {
2929
features: "+strict-align,+v6".to_string(),
3030
abi_blacklist: super::arm_base::abi_blacklist(),
31+
va_list_kind: VaListKind::VoidPtr,
3132
.. base
3233
},
3334
})

src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult, VaListKind};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::linux_base::opts();
@@ -28,6 +28,7 @@ pub fn target() -> TargetResult {
2828
options: TargetOptions {
2929
features: "+strict-align,+v6,+vfp2".to_string(),
3030
abi_blacklist: super::arm_base::abi_blacklist(),
31+
va_list_kind: VaListKind::VoidPtr,
3132
.. base
3233
}
3334
})

0 commit comments

Comments
 (0)