Skip to content

Commit 66e61c7

Browse files
authored
Rollup merge of rust-lang#138949 - madsmtm:rename-to-darwin, r=WaffleLapkin
Rename `is_like_osx` to `is_like_darwin` Replace `is_like_osx` with `is_like_darwin`, which more closely describes reality (OS X is the pre-2016 name for macOS, and is by now quite outdated; Darwin is the overall name for the OS underlying Apple's macOS, iOS, etc.). ``@rustbot`` label O-apple r? compiler
2 parents 9e14530 + 328846c commit 66e61c7

File tree

24 files changed

+54
-54
lines changed

24 files changed

+54
-54
lines changed

compiler/rustc_codegen_cranelift/src/abi/mod.rs

Lines changed: 1 addition & 1 deletion
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.

compiler/rustc_codegen_cranelift/src/constant.rs

Lines changed: 1 addition & 1 deletion
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 {

compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
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

compiler/rustc_codegen_gcc/src/consts.rs

Lines changed: 1 addition & 1 deletion
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).

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 3 additions & 3 deletions
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"

compiler/rustc_codegen_llvm/src/mono_item.rs

Lines changed: 1 addition & 1 deletion
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

compiler/rustc_codegen_llvm/src/va_arg.rs

Lines changed: 1 addition & 1 deletion
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),

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 6 additions & 6 deletions
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 {

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 10 additions & 10 deletions
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");
@@ -471,7 +471,7 @@ impl<'a> GccLinker<'a> {
471471

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

488488
if !as_needed {
489-
if self.sess.target.is_like_osx {
489+
if self.sess.target.is_like_darwin {
490490
// See above FIXME comment
491491
} else if self.is_gnu && !self.sess.target.is_like_windows {
492492
self.link_arg("--as-needed");
@@ -619,7 +619,7 @@ impl<'a> Linker for GccLinker<'a> {
619619
let colon = if verbatim && self.is_gnu { ":" } else { "" };
620620
if !whole_archive {
621621
self.link_or_cc_arg(format!("-l{colon}{name}"));
622-
} else if self.sess.target.is_like_osx {
622+
} else if self.sess.target.is_like_darwin {
623623
// -force_load is the macOS equivalent of --whole-archive, but it
624624
// involves passing the full path to the library to link.
625625
self.link_arg("-force_load");
@@ -635,7 +635,7 @@ impl<'a> Linker for GccLinker<'a> {
635635
self.hint_static();
636636
if !whole_archive {
637637
self.link_or_cc_arg(path);
638-
} else if self.sess.target.is_like_osx {
638+
} else if self.sess.target.is_like_darwin {
639639
self.link_arg("-force_load").link_arg(path);
640640
} else {
641641
self.link_arg("--whole-archive").link_arg(path).link_arg("--no-whole-archive");
@@ -670,7 +670,7 @@ impl<'a> Linker for GccLinker<'a> {
670670
// -dead_strip can't be part of the pre_link_args because it's also used
671671
// for partial linking when using multiple codegen units (-r). So we
672672
// insert it here.
673-
if self.sess.target.is_like_osx {
673+
if self.sess.target.is_like_darwin {
674674
self.link_arg("-dead_strip");
675675

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

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

@@ -795,7 +795,7 @@ impl<'a> Linker for GccLinker<'a> {
795795

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

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

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

compiler/rustc_codegen_ssa/src/back/metadata.rs

Lines changed: 1 addition & 1 deletion
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
}

0 commit comments

Comments
 (0)