Skip to content

Commit 328846c

Browse files
committed
Rename is_like_osx to is_like_darwin
1 parent 7d49ae9 commit 328846c

File tree

24 files changed

+54
-54
lines changed

24 files changed

+54
-54
lines changed

Diff for: compiler/rustc_codegen_cranelift/src/abi/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
641641
.flat_map(|arg_abi| arg_abi.get_abi_param(fx.tcx).into_iter()),
642642
);
643643

644-
if fx.tcx.sess.target.is_like_osx && fx.tcx.sess.target.arch == "aarch64" {
644+
if fx.tcx.sess.target.is_like_darwin && fx.tcx.sess.target.arch == "aarch64" {
645645
// Add any padding arguments needed for Apple AArch64.
646646
// There's no need to pad the argument list unless variadic arguments are actually being
647647
// passed.

Diff for: compiler/rustc_codegen_cranelift/src/constant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
391391
data.set_align(alloc.align.bytes());
392392

393393
if let Some(section_name) = section_name {
394-
let (segment_name, section_name) = if tcx.sess.target.is_like_osx {
394+
let (segment_name, section_name) = if tcx.sess.target.is_like_darwin {
395395
// See https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCSectionMachO.cpp
396396
let mut parts = section_name.as_str().split(',');
397397
let Some(segment_name) = parts.next() else {

Diff for: compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl DebugContext {
5858
// FIXME this should be configurable
5959
// macOS doesn't seem to support DWARF > 3
6060
// 5 version is required for md5 file hash
61-
version: if tcx.sess.target.is_like_osx {
61+
version: if tcx.sess.target.is_like_darwin {
6262
3
6363
} else {
6464
// FIXME change to version 5 once the gdb and lldb shipping with the latest debian

Diff for: compiler/rustc_codegen_gcc/src/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl<'gcc, 'tcx> StaticCodegenMethods for CodegenCx<'gcc, 'tcx> {
131131
// will use load-unaligned instructions instead, and thus avoiding the crash.
132132
//
133133
// We could remove this hack whenever we decide to drop macOS 10.10 support.
134-
if self.tcx.sess.target.options.is_like_osx {
134+
if self.tcx.sess.target.options.is_like_darwin {
135135
// The `inspect` method is okay here because we checked for provenance, and
136136
// because we are doing this access to inspect the final interpreter state
137137
// (not as part of the interpreter execution).

Diff for: compiler/rustc_codegen_llvm/src/back/write.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ fn create_section_with_flags_asm(section_name: &str, section_flags: &str, data:
10241024
}
10251025

10261026
pub(crate) fn bitcode_section_name(cgcx: &CodegenContext<LlvmCodegenBackend>) -> &'static CStr {
1027-
if cgcx.target_is_like_osx {
1027+
if cgcx.target_is_like_darwin {
10281028
c"__LLVM,__bitcode"
10291029
} else if cgcx.target_is_like_aix {
10301030
c".ipa"
@@ -1077,7 +1077,7 @@ unsafe fn embed_bitcode(
10771077
// and COFF we emit the sections using module level inline assembly for that
10781078
// reason (see issue #90326 for historical background).
10791079
unsafe {
1080-
if cgcx.target_is_like_osx
1080+
if cgcx.target_is_like_darwin
10811081
|| cgcx.target_is_like_aix
10821082
|| cgcx.target_arch == "wasm32"
10831083
|| cgcx.target_arch == "wasm64"
@@ -1096,7 +1096,7 @@ unsafe fn embed_bitcode(
10961096
let llglobal =
10971097
llvm::add_global(llmod, common::val_ty(llconst), c"rustc.embedded.cmdline");
10981098
llvm::set_initializer(llglobal, llconst);
1099-
let section = if cgcx.target_is_like_osx {
1099+
let section = if cgcx.target_is_like_darwin {
11001100
c"__LLVM,__cmdline"
11011101
} else if cgcx.target_is_like_aix {
11021102
c".info"

Diff for: compiler/rustc_codegen_llvm/src/mono_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl CodegenCx<'_, '_> {
120120
}
121121

122122
// Match clang by only supporting COFF and ELF for now.
123-
if self.tcx.sess.target.is_like_osx {
123+
if self.tcx.sess.target.is_like_darwin {
124124
return false;
125125
}
126126

Diff for: compiler/rustc_codegen_llvm/src/va_arg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
399399
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), false)
400400
}
401401
// macOS / iOS AArch64
402-
"aarch64" if target.is_like_osx => {
402+
"aarch64" if target.is_like_darwin => {
403403
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), true)
404404
}
405405
"aarch64" => emit_aapcs_va_arg(bx, addr, target_ty),

Diff for: compiler/rustc_codegen_ssa/src/back/link.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ fn link_natively(
10121012
// On macOS the external `dsymutil` tool is used to create the packed
10131013
// debug information. Note that this will read debug information from
10141014
// the objects on the filesystem which we'll clean up later.
1015-
SplitDebuginfo::Packed if sess.target.is_like_osx => {
1015+
SplitDebuginfo::Packed if sess.target.is_like_darwin => {
10161016
let prog = Command::new("dsymutil").arg(out_filename).output();
10171017
match prog {
10181018
Ok(prog) => {
@@ -1043,7 +1043,7 @@ fn link_natively(
10431043

10441044
let strip = sess.opts.cg.strip;
10451045

1046-
if sess.target.is_like_osx {
1046+
if sess.target.is_like_darwin {
10471047
let stripcmd = "rust-objcopy";
10481048
match (strip, crate_type) {
10491049
(Strip::Debuginfo, _) => {
@@ -1241,7 +1241,7 @@ fn add_sanitizer_libraries(
12411241
// Everywhere else the runtimes are currently distributed as static
12421242
// libraries which should be linked to executables only.
12431243
if matches!(crate_type, CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro)
1244-
&& !(sess.target.is_like_osx || sess.target.is_like_msvc)
1244+
&& !(sess.target.is_like_darwin || sess.target.is_like_msvc)
12451245
{
12461246
return;
12471247
}
@@ -1294,7 +1294,7 @@ fn link_sanitizer_runtime(
12941294
let channel =
12951295
option_env!("CFG_RELEASE_CHANNEL").map(|channel| format!("-{channel}")).unwrap_or_default();
12961296

1297-
if sess.target.is_like_osx {
1297+
if sess.target.is_like_darwin {
12981298
// On Apple platforms, the sanitizer is always built as a dylib, and
12991299
// LLVM will link to `@rpath/*.dylib`, so we need to specify an
13001300
// rpath to the library as well (the rpath should be absolute, see
@@ -2182,7 +2182,7 @@ fn add_rpath_args(
21822182
let rpath_config = RPathConfig {
21832183
libs: &*libs,
21842184
out_filename: out_filename.to_path_buf(),
2185-
is_like_osx: sess.target.is_like_osx,
2185+
is_like_darwin: sess.target.is_like_darwin,
21862186
linker_is_gnu: sess.target.linker_flavor.is_gnu(),
21872187
};
21882188
cmd.link_args(&rpath::get_rpath_linker_args(&rpath_config));
@@ -3044,7 +3044,7 @@ pub(crate) fn are_upstream_rust_objects_already_included(sess: &Session) -> bool
30443044
/// - The deployment target.
30453045
/// - The SDK version.
30463046
fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
3047-
if !sess.target.is_like_osx {
3047+
if !sess.target.is_like_darwin {
30483048
return;
30493049
}
30503050
let LinkerFlavor::Darwin(cc, _) = flavor else {

Diff for: compiler/rustc_codegen_ssa/src/back/linker.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ impl<'a> GccLinker<'a> {
373373
// * On OSX they have their own linker, not binutils'
374374
// * For WebAssembly the only functional linker is LLD, which doesn't
375375
// support hint flags
376-
!self.sess.target.is_like_osx && !self.sess.target.is_like_wasm
376+
!self.sess.target.is_like_darwin && !self.sess.target.is_like_wasm
377377
}
378378

379379
// Some platforms take hints about whether a library is static or dynamic.
@@ -425,7 +425,7 @@ impl<'a> GccLinker<'a> {
425425

426426
fn build_dylib(&mut self, crate_type: CrateType, out_filename: &Path) {
427427
// On mac we need to tell the linker to let this library be rpathed
428-
if self.sess.target.is_like_osx {
428+
if self.sess.target.is_like_darwin {
429429
if self.is_cc() {
430430
// `-dynamiclib` makes `cc` pass `-dylib` to the linker.
431431
self.cc_arg("-dynamiclib");
@@ -470,7 +470,7 @@ impl<'a> GccLinker<'a> {
470470

471471
fn with_as_needed(&mut self, as_needed: bool, f: impl FnOnce(&mut Self)) {
472472
if !as_needed {
473-
if self.sess.target.is_like_osx {
473+
if self.sess.target.is_like_darwin {
474474
// FIXME(81490): ld64 doesn't support these flags but macOS 11
475475
// has -needed-l{} / -needed_library {}
476476
// but we have no way to detect that here.
@@ -485,7 +485,7 @@ impl<'a> GccLinker<'a> {
485485
f(self);
486486

487487
if !as_needed {
488-
if self.sess.target.is_like_osx {
488+
if self.sess.target.is_like_darwin {
489489
// See above FIXME comment
490490
} else if self.is_gnu && !self.sess.target.is_like_windows {
491491
self.link_arg("--as-needed");
@@ -618,7 +618,7 @@ impl<'a> Linker for GccLinker<'a> {
618618
let colon = if verbatim && self.is_gnu { ":" } else { "" };
619619
if !whole_archive {
620620
self.link_or_cc_arg(format!("-l{colon}{name}"));
621-
} else if self.sess.target.is_like_osx {
621+
} else if self.sess.target.is_like_darwin {
622622
// -force_load is the macOS equivalent of --whole-archive, but it
623623
// involves passing the full path to the library to link.
624624
self.link_arg("-force_load");
@@ -634,7 +634,7 @@ impl<'a> Linker for GccLinker<'a> {
634634
self.hint_static();
635635
if !whole_archive {
636636
self.link_or_cc_arg(path);
637-
} else if self.sess.target.is_like_osx {
637+
} else if self.sess.target.is_like_darwin {
638638
self.link_arg("-force_load").link_arg(path);
639639
} else {
640640
self.link_arg("--whole-archive").link_arg(path).link_arg("--no-whole-archive");
@@ -669,7 +669,7 @@ impl<'a> Linker for GccLinker<'a> {
669669
// -dead_strip can't be part of the pre_link_args because it's also used
670670
// for partial linking when using multiple codegen units (-r). So we
671671
// insert it here.
672-
if self.sess.target.is_like_osx {
672+
if self.sess.target.is_like_darwin {
673673
self.link_arg("-dead_strip");
674674

675675
// If we're building a dylib, we don't use --gc-sections because LLVM
@@ -727,7 +727,7 @@ impl<'a> Linker for GccLinker<'a> {
727727

728728
fn debuginfo(&mut self, strip: Strip, _: &[PathBuf]) {
729729
// MacOS linker doesn't support stripping symbols directly anymore.
730-
if self.sess.target.is_like_osx {
730+
if self.sess.target.is_like_darwin {
731731
return;
732732
}
733733

@@ -794,7 +794,7 @@ impl<'a> Linker for GccLinker<'a> {
794794

795795
debug!("EXPORTED SYMBOLS:");
796796

797-
if self.sess.target.is_like_osx {
797+
if self.sess.target.is_like_darwin {
798798
// Write a plain, newline-separated list of symbols
799799
let res: io::Result<()> = try {
800800
let mut f = File::create_buffered(&path)?;
@@ -840,7 +840,7 @@ impl<'a> Linker for GccLinker<'a> {
840840
}
841841
}
842842

843-
if self.sess.target.is_like_osx {
843+
if self.sess.target.is_like_darwin {
844844
self.link_arg("-exported_symbols_list").link_arg(path);
845845
} else if self.sess.target.is_like_solaris {
846846
self.link_arg("-M").link_arg(path);

Diff for: compiler/rustc_codegen_ssa/src/back/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
214214

215215
let mut file = write::Object::new(binary_format, architecture, endianness);
216216
file.set_sub_architecture(sub_architecture);
217-
if sess.target.is_like_osx {
217+
if sess.target.is_like_darwin {
218218
if macho_is_arm64e(&sess.target) {
219219
file.set_macho_cpu_subtype(object::macho::CPU_SUBTYPE_ARM64E);
220220
}

Diff for: compiler/rustc_codegen_ssa/src/back/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub mod write;
1919
///
2020
/// Certain optimizations also depend on the deployment target.
2121
pub fn versioned_llvm_target(sess: &Session) -> Cow<'_, str> {
22-
if sess.target.is_like_osx {
22+
if sess.target.is_like_darwin {
2323
apple::add_version_to_llvm_target(&sess.target.llvm_target, apple::deployment_target(sess))
2424
.into()
2525
} else {

Diff for: compiler/rustc_codegen_ssa/src/back/rpath.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use tracing::debug;
99
pub(super) struct RPathConfig<'a> {
1010
pub libs: &'a [&'a Path],
1111
pub out_filename: PathBuf,
12-
pub is_like_osx: bool,
12+
pub is_like_darwin: bool,
1313
pub linker_is_gnu: bool,
1414
}
1515

@@ -63,7 +63,7 @@ fn get_rpaths_relative_to_output(config: &RPathConfig<'_>) -> Vec<OsString> {
6363

6464
fn get_rpath_relative_to_output(config: &RPathConfig<'_>, lib: &Path) -> OsString {
6565
// Mac doesn't appear to support $ORIGIN
66-
let prefix = if config.is_like_osx { "@loader_path" } else { "$ORIGIN" };
66+
let prefix = if config.is_like_darwin { "@loader_path" } else { "$ORIGIN" };
6767

6868
// Strip filenames
6969
let lib = lib.parent().unwrap();

Diff for: compiler/rustc_codegen_ssa/src/back/rpath/tests.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn test_rpath_relative() {
2828
if cfg!(target_os = "macos") {
2929
let config = &mut RPathConfig {
3030
libs: &[],
31-
is_like_osx: true,
31+
is_like_darwin: true,
3232
linker_is_gnu: false,
3333
out_filename: PathBuf::from("bin/rustc"),
3434
};
@@ -38,7 +38,7 @@ fn test_rpath_relative() {
3838
let config = &mut RPathConfig {
3939
libs: &[],
4040
out_filename: PathBuf::from("bin/rustc"),
41-
is_like_osx: false,
41+
is_like_darwin: false,
4242
linker_is_gnu: true,
4343
};
4444
let res = get_rpath_relative_to_output(config, Path::new("lib/libstd.so"));
@@ -51,7 +51,7 @@ fn test_rpath_relative_issue_119571() {
5151
let config = &mut RPathConfig {
5252
libs: &[],
5353
out_filename: PathBuf::from("rustc"),
54-
is_like_osx: false,
54+
is_like_darwin: false,
5555
linker_is_gnu: true,
5656
};
5757
// Should not panic when out_filename only contains filename.

Diff for: compiler/rustc_codegen_ssa/src/back/write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
352352
pub is_pe_coff: bool,
353353
pub target_can_use_split_dwarf: bool,
354354
pub target_arch: String,
355-
pub target_is_like_osx: bool,
355+
pub target_is_like_darwin: bool,
356356
pub target_is_like_aix: bool,
357357
pub split_debuginfo: rustc_target::spec::SplitDebuginfo,
358358
pub split_dwarf_kind: rustc_session::config::SplitDwarfKind,
@@ -1216,7 +1216,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
12161216
is_pe_coff: tcx.sess.target.is_like_windows,
12171217
target_can_use_split_dwarf: tcx.sess.target_can_use_split_dwarf(),
12181218
target_arch: tcx.sess.target.arch.to_string(),
1219-
target_is_like_osx: tcx.sess.target.is_like_osx,
1219+
target_is_like_darwin: tcx.sess.target.is_like_darwin,
12201220
target_is_like_aix: tcx.sess.target.is_like_aix,
12211221
split_debuginfo: tcx.sess.split_debuginfo(),
12221222
split_dwarf_kind: tcx.sess.opts.unstable_opts.split_dwarf_kind,

Diff for: compiler/rustc_codegen_ssa/src/codegen_attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
213213
// somewhat, and is subject to change in the future (which
214214
// is a good thing, because this would ideally be a bit
215215
// more firmed up).
216-
let is_like_elf = !(tcx.sess.target.is_like_osx
216+
let is_like_elf = !(tcx.sess.target.is_like_darwin
217217
|| tcx.sess.target.is_like_windows
218218
|| tcx.sess.target.is_like_wasm);
219219
codegen_fn_attrs.flags |= if is_like_elf {

Diff for: compiler/rustc_driver_impl/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ fn print_crate_info(
779779
}
780780
}
781781
DeploymentTarget => {
782-
if sess.target.is_like_osx {
782+
if sess.target.is_like_darwin {
783783
println_info!(
784784
"{}={}",
785785
apple::deployment_target_env_var(&sess.target.os),

Diff for: compiler/rustc_metadata/src/native_libs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub fn walk_native_lib_search_dirs<R>(
7373
|| sess.target.os == "linux"
7474
|| sess.target.os == "fuchsia"
7575
|| sess.target.is_like_aix
76-
|| sess.target.is_like_osx && !sess.opts.unstable_opts.sanitizer.is_empty()
76+
|| sess.target.is_like_darwin && !sess.opts.unstable_opts.sanitizer.is_empty()
7777
{
7878
f(&sess.target_tlib_path.dir, false)?;
7979
}
@@ -258,7 +258,7 @@ impl<'tcx> Collector<'tcx> {
258258
"static" => NativeLibKind::Static { bundle: None, whole_archive: None },
259259
"dylib" => NativeLibKind::Dylib { as_needed: None },
260260
"framework" => {
261-
if !sess.target.is_like_osx {
261+
if !sess.target.is_like_darwin {
262262
sess.dcx().emit_err(errors::LinkFrameworkApple { span });
263263
}
264264
NativeLibKind::Framework { as_needed: None }
@@ -532,7 +532,7 @@ impl<'tcx> Collector<'tcx> {
532532
let mut renames = FxHashSet::default();
533533
for lib in &self.tcx.sess.opts.libs {
534534
if let NativeLibKind::Framework { .. } = lib.kind
535-
&& !self.tcx.sess.target.is_like_osx
535+
&& !self.tcx.sess.target.is_like_darwin
536536
{
537537
// Cannot check this when parsing options because the target is not yet available.
538538
self.tcx.dcx().emit_err(errors::LibFrameworkApple);

Diff for: compiler/rustc_target/src/asm/aarch64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub(crate) fn target_reserves_x18(target: &Target, target_features: &FxIndexSet<
7878
target.os == "android"
7979
|| target.os == "fuchsia"
8080
|| target.env == "ohos"
81-
|| target.is_like_osx
81+
|| target.is_like_darwin
8282
|| target.is_like_windows
8383
|| target_features.contains(&sym::reserve_x18)
8484
}

Diff for: compiler/rustc_target/src/asm/arm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl ArmInlineAsmRegClass {
6868

6969
// This uses the same logic as useR7AsFramePointer in LLVM
7070
fn frame_pointer_is_r7(target_features: &FxIndexSet<Symbol>, target: &Target) -> bool {
71-
target.is_like_osx || (!target.is_like_windows && target_features.contains(&sym::thumb_mode))
71+
target.is_like_darwin || (!target.is_like_windows && target_features.contains(&sym::thumb_mode))
7272
}
7373

7474
fn frame_pointer_r11(

Diff for: compiler/rustc_target/src/callconv/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
670670
}
671671
},
672672
"aarch64" | "arm64ec" => {
673-
let kind = if cx.target_spec().is_like_osx {
673+
let kind = if cx.target_spec().is_like_darwin {
674674
aarch64::AbiKind::DarwinPCS
675675
} else if cx.target_spec().is_like_windows {
676676
aarch64::AbiKind::Win64

Diff for: compiler/rustc_target/src/callconv/x86.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ where
104104
let byval_align = if arg.layout.align.abi < align_4 {
105105
// (1.)
106106
align_4
107-
} else if t.is_like_osx && contains_vector(cx, arg.layout) {
107+
} else if t.is_like_darwin && contains_vector(cx, arg.layout) {
108108
// (3.)
109109
align_16
110110
} else {

Diff for: compiler/rustc_target/src/spec/base/apple/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub(crate) fn base(
115115
function_sections: false,
116116
dynamic_linking: true,
117117
families: cvs!["unix"],
118-
is_like_osx: true,
118+
is_like_darwin: true,
119119
binary_format: BinaryFormat::MachO,
120120
// LLVM notes that macOS 10.11+ and iOS 9+ default
121121
// to v4, so we do the same.

0 commit comments

Comments
 (0)