Skip to content

Commit 7b7ad2d

Browse files
committed
target specs: rename abi to cfg_abi
1 parent 7ed1083 commit 7b7ad2d

File tree

122 files changed

+398
-352
lines changed

Some content is hidden

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

122 files changed

+398
-352
lines changed

compiler/rustc_codegen_cranelift/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
4646
use rustc_session::Session;
4747
use rustc_session::config::OutputFilenames;
4848
use rustc_span::{Symbol, sym};
49-
use rustc_target::spec::{Abi, Arch, Env, Os};
49+
use rustc_target::spec::{Arch, CfgAbi, Env, Os};
5050

5151
pub use crate::config::*;
5252
use crate::prelude::*;
@@ -178,7 +178,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
178178
let has_reliable_f16_f128 = !(sess.target.arch == Arch::X86_64
179179
&& sess.target.os == Os::Windows
180180
&& sess.target.env == Env::Gnu
181-
&& sess.target.abi != Abi::Llvm);
181+
&& sess.target.cfg_abi != CfgAbi::Llvm);
182182

183183
// FIXME(f128): f128 math operations need f128 math symbols, which currently aren't always
184184
// filled in by compiler-builtins. The only libc that provides these currently is glibc.

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use rustc_session::config::{
2828
use rustc_span::{DUMMY_SP, Span, Spanned, Symbol};
2929
use rustc_symbol_mangling::mangle_internal_symbol;
3030
use rustc_target::spec::{
31-
Abi, Arch, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
31+
Arch, CfgAbi, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
3232
};
3333
use smallvec::SmallVec;
3434

@@ -360,7 +360,7 @@ pub(crate) unsafe fn create_module<'ll>(
360360
if sess.target.is_like_msvc
361361
|| (sess.target.options.os == Os::Windows
362362
&& sess.target.options.env == Env::Gnu
363-
&& sess.target.options.abi == Abi::Llvm)
363+
&& sess.target.options.cfg_abi == CfgAbi::Llvm)
364364
{
365365
match sess.opts.cg.control_flow_guard {
366366
CFGuard::Disabled => {}

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_middle::bug;
1616
use rustc_session::Session;
1717
use rustc_session::config::{PrintKind, PrintRequest};
1818
use rustc_target::spec::{
19-
Abi, Arch, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
19+
Arch, CfgAbi, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
2020
};
2121
use smallvec::{SmallVec, smallvec};
2222

@@ -366,7 +366,7 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
366366
let target_arch = &sess.target.arch;
367367
let target_os = &sess.target.options.os;
368368
let target_env = &sess.target.options.env;
369-
let target_abi = &sess.target.options.abi;
369+
let target_abi = &sess.target.options.cfg_abi;
370370
let target_pointer_width = sess.target.pointer_width;
371371
let version = get_version();
372372
let (major, _, _) = version;
@@ -384,7 +384,9 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
384384
// Selection failure <https://github.com/llvm/llvm-project/issues/50374> (fixed in llvm21)
385385
(Arch::S390x, _) if major < 21 => false,
386386
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
387-
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false,
387+
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => {
388+
false
389+
}
388390
// Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>
389391
(Arch::CSky, _) if major < 22 => false, // (fixed in llvm22)
390392
(Arch::Hexagon, _) if major < 21 => false, // (fixed in llvm21)
@@ -417,7 +419,9 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
417419
// not fail if our compiler-builtins is linked. (fixed in llvm21)
418420
(Arch::X86, _) if major < 21 => false,
419421
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
420-
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false,
422+
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => {
423+
false
424+
}
421425
// There are no known problems on other platforms, so the only requirement is that symbols
422426
// are available. `compiler-builtins` provides all symbols required for core `f128`
423427
// support, so this should work for everything else.

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use rustc_session::{Session, filesearch};
4747
use rustc_span::Symbol;
4848
use rustc_target::spec::crt_objects::CrtObjects;
4949
use rustc_target::spec::{
50-
Abi, BinaryFormat, Cc, Env, LinkOutputKind, LinkSelfContainedComponents,
50+
BinaryFormat, Cc, CfgAbi, Env, LinkOutputKind, LinkSelfContainedComponents,
5151
LinkSelfContainedDefault, LinkerFeatures, LinkerFlavor, LinkerFlavorCli, Lld, Os, RelocModel,
5252
RelroLevel, SanitizerSet, SplitDebuginfo,
5353
};
@@ -1917,7 +1917,7 @@ fn self_contained_components(
19171917
LinkSelfContainedDefault::InferredForMusl => sess.crt_static(Some(crate_type)),
19181918
LinkSelfContainedDefault::InferredForMingw => {
19191919
sess.host == sess.target
1920-
&& sess.target.abi != Abi::Uwp
1920+
&& sess.target.cfg_abi != CfgAbi::Uwp
19211921
&& detect_self_contained_mingw(sess, linker)
19221922
}
19231923
}

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc_middle::middle::exported_symbols::{
1818
use rustc_middle::ty::TyCtxt;
1919
use rustc_session::Session;
2020
use rustc_session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel, Strip};
21-
use rustc_target::spec::{Abi, Arch, Cc, LinkOutputKind, LinkerFlavor, Lld, Os};
21+
use rustc_target::spec::{Arch, Cc, CfgAbi, LinkOutputKind, LinkerFlavor, Lld, Os};
2222
use tracing::{debug, warn};
2323

2424
use super::command::Command;
@@ -84,7 +84,7 @@ pub(crate) fn get_linker<'a>(
8484
// To comply with the Windows App Certification Kit,
8585
// MSVC needs to link with the Store versions of the runtime libraries (vcruntime, msvcrt, etc).
8686
let t = &sess.target;
87-
if matches!(flavor, LinkerFlavor::Msvc(..)) && t.abi == Abi::Uwp {
87+
if matches!(flavor, LinkerFlavor::Msvc(..)) && t.cfg_abi == CfgAbi::Uwp {
8888
if let Some(ref tool) = msvc_tool {
8989
let original_path = tool.path();
9090
if let Some(root_lib_path) = original_path.ancestors().nth(4) {
@@ -135,7 +135,7 @@ pub(crate) fn get_linker<'a>(
135135

136136
// FIXME: Move `/LIBPATH` addition for uwp targets from the linker construction
137137
// to the linker args construction.
138-
assert!(cmd.get_args().is_empty() || sess.target.abi == Abi::Uwp);
138+
assert!(cmd.get_args().is_empty() || sess.target.cfg_abi == CfgAbi::Uwp);
139139
match flavor {
140140
LinkerFlavor::Unix(Cc::No) if sess.target.os == Os::L4Re => {
141141
Box::new(L4Bender::new(cmd, sess)) as Box<dyn Linker>

compiler/rustc_codegen_ssa/src/back/metadata.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_metadata::fs::METADATA_FILENAME;
2020
use rustc_middle::bug;
2121
use rustc_session::Session;
2222
use rustc_span::sym;
23-
use rustc_target::spec::{Abi, Os, RelocModel, Target, ef_avr_arch};
23+
use rustc_target::spec::{CfgAbi, Os, RelocModel, Target, ef_avr_arch};
2424
use tracing::debug;
2525

2626
use super::apple;
@@ -372,7 +372,7 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
372372
}
373373
}
374374
Architecture::Csky => {
375-
if matches!(sess.target.options.abi, Abi::AbiV2) {
375+
if matches!(sess.target.options.cfg_abi, CfgAbi::AbiV2) {
376376
elf::EF_CSKY_ABIV2
377377
} else {
378378
elf::EF_CSKY_ABIV1

compiler/rustc_codegen_ssa/src/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_middle::ty::{self, Instance, TyCtxt};
77
use rustc_middle::{bug, mir, span_bug};
88
use rustc_session::cstore::{DllCallingConvention, DllImport};
99
use rustc_span::Span;
10-
use rustc_target::spec::{Abi, Env, Os, Target};
10+
use rustc_target::spec::{CfgAbi, Env, Os, Target};
1111

1212
use crate::traits::*;
1313

@@ -171,7 +171,7 @@ pub fn asm_const_to_str<'tcx>(
171171
}
172172

173173
pub fn is_mingw_gnu_toolchain(target: &Target) -> bool {
174-
target.os == Os::Windows && target.env == Env::Gnu && target.abi == Abi::Unspecified
174+
target.os == Os::Windows && target.env == Env::Gnu && target.cfg_abi == CfgAbi::Unspecified
175175
}
176176

177177
pub fn i686_decorated_name(

compiler/rustc_metadata/src/native_libs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_session::cstore::{DllCallingConvention, DllImport, ForeignModule, Nati
1414
use rustc_session::search_paths::PathKind;
1515
use rustc_span::Symbol;
1616
use rustc_span::def_id::{DefId, LOCAL_CRATE};
17-
use rustc_target::spec::{Abi, Arch, BinaryFormat, Env, LinkSelfContainedComponents, Os};
17+
use rustc_target::spec::{Arch, BinaryFormat, CfgAbi, Env, LinkSelfContainedComponents, Os};
1818

1919
use crate::errors;
2020

@@ -68,14 +68,14 @@ pub fn walk_native_lib_search_dirs<R>(
6868
// FIXME: On AIX this also has the side-effect of making the list of library search paths
6969
// non-empty, which is needed or the linker may decide to record the LIBPATH env, if
7070
// defined, as the search path instead of appending the default search paths.
71-
if sess.target.abi == Abi::Fortanix
71+
if sess.target.cfg_abi == CfgAbi::Fortanix
7272
|| sess.target.os == Os::Linux
7373
|| sess.target.os == Os::Fuchsia
7474
|| sess.target.is_like_aix
7575
|| sess.target.is_like_darwin && !sess.sanitizers().is_empty()
7676
|| sess.target.os == Os::Windows
7777
&& sess.target.env == Env::Gnu
78-
&& sess.target.abi == Abi::Llvm
78+
&& sess.target.cfg_abi == CfgAbi::Llvm
7979
{
8080
f(&sess.target_tlib_path.dir, false)?;
8181
}

compiler/rustc_session/src/config/cfg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg {
239239
ins_none!(sym::sanitizer_cfi_normalize_integers);
240240
}
241241

242-
ins_sym!(sym::target_abi, sess.target.abi.desc_symbol());
242+
ins_sym!(sym::target_abi, sess.target.cfg_abi.desc_symbol());
243243
ins_sym!(sym::target_arch, sess.target.arch.desc_symbol());
244244
ins_str!(sym::target_endian, sess.target.endian.as_str());
245245
ins_sym!(sym::target_env, sess.target.env.desc_symbol());
@@ -447,7 +447,7 @@ impl CheckCfg {
447447
};
448448

449449
for target in Target::builtins().chain(iter::once(current_target.clone())) {
450-
values_target_abi.insert(target.options.abi.desc_symbol());
450+
values_target_abi.insert(target.options.cfg_abi.desc_symbol());
451451
values_target_arch.insert(target.arch.desc_symbol());
452452
values_target_endian.insert(Symbol::intern(target.options.endian.as_str()));
453453
values_target_env.insert(target.options.env.desc_symbol());

compiler/rustc_target/src/asm/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
55
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
66
use rustc_span::Symbol;
77

8-
use crate::spec::{Abi, Arch, RelocModel, Target};
8+
use crate::spec::{Arch, CfgAbi, RelocModel, Target};
99

1010
pub struct ModifierInfo {
1111
pub modifier: char,
@@ -1001,7 +1001,7 @@ impl InlineAsmClobberAbi {
10011001
_ => Err(&["C", "system", "efiapi"]),
10021002
},
10031003
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => match name {
1004-
"C" | "system" => Ok(if target.abi == Abi::Spe {
1004+
"C" | "system" => Ok(if target.cfg_abi == CfgAbi::Spe {
10051005
InlineAsmClobberAbi::PowerPCSPE
10061006
} else {
10071007
InlineAsmClobberAbi::PowerPC

0 commit comments

Comments
 (0)