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
})

src/librustc_target/spec/arm_unknown_linux_musleabi.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_musl_base::opts();
@@ -33,6 +33,7 @@ pub fn target() -> TargetResult {
3333
linker_flavor: LinkerFlavor::Gcc,
3434
options: TargetOptions {
3535
abi_blacklist: super::arm_base::abi_blacklist(),
36+
va_list_kind: VaListKind::VoidPtr,
3637
.. base
3738
},
3839
})

src/librustc_target/spec/arm_unknown_linux_musleabihf.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_musl_base::opts();
@@ -33,6 +33,7 @@ pub fn target() -> TargetResult {
3333
linker_flavor: LinkerFlavor::Gcc,
3434
options: TargetOptions {
3535
abi_blacklist: super::arm_base::abi_blacklist(),
36+
va_list_kind: VaListKind::VoidPtr,
3637
.. base
3738
},
3839
})

src/librustc_target/spec/armv4t_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 base = super::linux_base::opts();
@@ -29,6 +29,7 @@ pub fn target() -> TargetResult {
2929
// Atomic operations provided by compiler-builtins
3030
max_atomic_width: Some(32),
3131
abi_blacklist: super::arm_base::abi_blacklist(),
32+
va_list_kind: VaListKind::VoidPtr,
3233
.. base
3334
}
3435
})

src/librustc_target/spec/armv5te_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 base = super::linux_base::opts();
@@ -29,6 +29,7 @@ pub fn target() -> TargetResult {
2929
// Atomic operations provided by compiler-builtins
3030
max_atomic_width: Some(32),
3131
abi_blacklist: super::arm_base::abi_blacklist(),
32+
va_list_kind: VaListKind::VoidPtr,
3233
.. base
3334
}
3435
})

src/librustc_target/spec/armv7_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
// See https://developer.android.com/ndk/guides/abis.html#v7a
1414
// for target ABI requirements.
@@ -33,6 +33,7 @@ pub fn target() -> TargetResult {
3333
linker_flavor: LinkerFlavor::Gcc,
3434
options: TargetOptions {
3535
abi_blacklist: super::arm_base::abi_blacklist(),
36+
va_list_kind: VaListKind::VoidPtr,
3637
.. base
3738
},
3839
})

src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.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, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetResult, VaListKind};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::cloudabi_base::opts();
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
base.features = "+v7,+vfp3,+neon".to_string();
1818
base.abi_blacklist = super::arm_base::abi_blacklist();
1919
base.linker = Some("armv7-unknown-cloudabi-eabihf-cc".to_string());
20+
base.va_list_kind = VaListKind::VoidPtr;
2021

2122
Ok(Target {
2223
llvm_target: "armv7-unknown-cloudabi-eabihf".to_string(),

src/librustc_target/spec/armv7_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 base = super::linux_base::opts();
@@ -30,6 +30,7 @@ pub fn target() -> TargetResult {
3030
cpu: "generic".to_string(),
3131
max_atomic_width: Some(64),
3232
abi_blacklist: super::arm_base::abi_blacklist(),
33+
va_list_kind: VaListKind::VoidPtr,
3334
.. base
3435
}
3536
})

src/librustc_target/spec/armv7_unknown_linux_musleabihf.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 base = super::linux_musl_base::opts();
@@ -34,6 +34,7 @@ pub fn target() -> TargetResult {
3434
cpu: "generic".to_string(),
3535
max_atomic_width: Some(64),
3636
abi_blacklist: super::arm_base::abi_blacklist(),
37+
va_list_kind: VaListKind::VoidPtr,
3738
.. base
3839
}
3940
})

src/librustc_target/spec/i686_apple_darwin.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
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::apple_base::opts();
1515
base.cpu = "yonah".to_string();
1616
base.max_atomic_width = Some(64);
1717
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".to_string()]);
1818
base.stack_probes = true;
19+
base.va_list_kind = VaListKind::CharPtr;
1920

2021
Ok(Target {
2122
llvm_target: "i686-apple-darwin".to_string(),
@@ -28,6 +29,6 @@ pub fn target() -> TargetResult {
2829
target_env: "".to_string(),
2930
target_vendor: "apple".to_string(),
3031
linker_flavor: LinkerFlavor::Gcc,
31-
options: base,
32+
options: base
3233
})
3334
}

src/librustc_target/spec/i686_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, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetResult, VaListKind};
1212

1313
// See https://developer.android.com/ndk/guides/abis.html#x86
1414
// for target ABI requirements.
@@ -22,6 +22,7 @@ pub fn target() -> TargetResult {
2222
base.cpu = "pentiumpro".to_string();
2323
base.features = "+mmx,+sse,+sse2,+sse3,+ssse3".to_string();
2424
base.stack_probes = true;
25+
base.va_list_kind = VaListKind::CharPtr;
2526

2627
Ok(Target {
2728
llvm_target: "i686-linux-android".to_string(),

src/librustc_target/spec/i686_unknown_cloudabi.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, TargetResult};
11+
use spec::{LinkerFlavor, Target, TargetResult, VaListKind};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::cloudabi_base::opts();
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
base.linker = Some("i686-unknown-cloudabi-cc".to_string());
1818
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
1919
base.stack_probes = true;
20+
base.va_list_kind = VaListKind::CharPtr;
2021

2122
Ok(Target {
2223
llvm_target: "i686-unknown-cloudabi".to_string(),

src/librustc_target/spec/i686_unknown_dragonfly.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
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::dragonfly_base::opts();
1515
base.cpu = "pentium4".to_string();
1616
base.max_atomic_width = Some(64);
1717
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
1818
base.stack_probes = true;
19+
base.va_list_kind = VaListKind::CharPtr;
1920

2021
Ok(Target {
2122
llvm_target: "i686-unknown-dragonfly".to_string(),

src/librustc_target/spec/i686_unknown_freebsd.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
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::freebsd_base::opts();
1515
base.cpu = "pentium4".to_string();
1616
base.max_atomic_width = Some(64);
1717
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
1818
base.stack_probes = true;
19+
base.va_list_kind = VaListKind::CharPtr;
1920

2021
Ok(Target {
2122
llvm_target: "i686-unknown-freebsd".to_string(),

0 commit comments

Comments
 (0)