summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2023-02-28 18:21:20 -0500
committerLouis Dionne <ldionne.2@gmail.com>2023-03-10 09:08:07 -0500
commitc73c3a078a130c4180a9d3626dcbc408992d53f9 (patch)
treedeecb1826cec3b7a7cd6a6aee5bd1e43b22917a4
parent17d403f6644337e3e099e6dcb7b057fce11e65a5 (diff)
downloadllvm-c73c3a078a130c4180a9d3626dcbc408992d53f9.tar.gz
[libc++] Clean up old macOS back-deployment workarounds
This patch bumps the minimum macOS version for building the dylib or back-deploying a statically-linked libc++ from macOS 10.11 to macOS 10.13. AFAICT, Chrome was the last one to require macOS 10.11, but since then they have bumped their minimal supported version to macOS 10.13. Differential Revision: https://reviews.llvm.org/D145012
-rw-r--r--libcxx/docs/ReleaseNotes.rst4
-rw-r--r--libcxx/docs/index.rst2
-rw-r--r--libcxx/src/chrono.cpp55
-rw-r--r--libcxx/src/filesystem/filesystem_common.h9
-rw-r--r--libcxx/src/include/apple_availability.h18
5 files changed, 7 insertions, 81 deletions
diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index aca9eaf475e1..03cab834485d 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -91,3 +91,7 @@ ABI Affecting Changes
Build System Changes
--------------------
+
+- Building libc++ and libc++abi for Apple platforms now requires targeting macOS 10.13 and later.
+ This is relevant for vendors building the libc++ shared library and for folks statically linking
+ libc++ into an application that has back-deployment requirements on Apple platforms.
diff --git a/libcxx/docs/index.rst b/libcxx/docs/index.rst
index 41a87f4a90a6..4303a8f3e1c3 100644
--- a/libcxx/docs/index.rst
+++ b/libcxx/docs/index.rst
@@ -116,7 +116,7 @@ Libc++ also supports common platforms and architectures:
=============== ========================= ============================
Target platform Target architecture Notes
=============== ========================= ============================
-macOS 10.9+ i386, x86_64, arm64 Building the shared library itself requires targetting macOS 10.11+
+macOS 10.9+ i386, x86_64, arm64 Building the shared library itself requires targetting macOS 10.13+
FreeBSD 12+ i386, x86_64, arm
Linux i386, x86_64, arm, arm64 Only glibc-2.24 and later and no other libc is officially supported
Windows i386, x86_64 Both MSVC and MinGW style environments
diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp
index 0af89d6a526c..8c85d96e5444 100644
--- a/libcxx/src/chrono.cpp
+++ b/libcxx/src/chrono.cpp
@@ -167,59 +167,6 @@ system_clock::from_time_t(time_t t) noexcept
#if defined(__APPLE__)
-// TODO(ldionne):
-// This old implementation of steady_clock is retained until Chrome drops supports
-// for macOS < 10.12. The issue is that they link libc++ statically into their
-// application, which means that libc++ must support being built for such deployment
-// targets. See https://llvm.org/D74489 for details.
-#if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \
- (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \
- (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \
- (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000)
-# define _LIBCPP_USE_OLD_MACH_ABSOLUTE_TIME
-#endif
-
-#if defined(_LIBCPP_USE_OLD_MACH_ABSOLUTE_TIME)
-
-// mach_absolute_time() * MachInfo.numer / MachInfo.denom is the number of
-// nanoseconds since the computer booted up. MachInfo.numer and MachInfo.denom
-// are run time constants supplied by the OS. This clock has no relationship
-// to the Gregorian calendar. It's main use is as a high resolution timer.
-
-// MachInfo.numer / MachInfo.denom is often 1 on the latest equipment. Specialize
-// for that case as an optimization.
-
-static steady_clock::rep steady_simplified() {
- return static_cast<steady_clock::rep>(mach_absolute_time());
-}
-static double compute_steady_factor() {
- mach_timebase_info_data_t MachInfo;
- mach_timebase_info(&MachInfo);
- return static_cast<double>(MachInfo.numer) / MachInfo.denom;
-}
-
-static steady_clock::rep steady_full() {
- static const double factor = compute_steady_factor();
- return static_cast<steady_clock::rep>(mach_absolute_time() * factor);
-}
-
-typedef steady_clock::rep (*FP)();
-
-static FP init_steady_clock() {
- mach_timebase_info_data_t MachInfo;
- mach_timebase_info(&MachInfo);
- if (MachInfo.numer == MachInfo.denom)
- return &steady_simplified;
- return &steady_full;
-}
-
-static steady_clock::time_point __libcpp_steady_clock_now() {
- static FP fp = init_steady_clock();
- return steady_clock::time_point(steady_clock::duration(fp()));
-}
-
-#else // vvvvv default behavior for Apple platforms vvvvv
-
// On Apple platforms, only CLOCK_UPTIME_RAW, CLOCK_MONOTONIC_RAW or
// mach_absolute_time are able to time functions in the nanosecond range.
// Furthermore, only CLOCK_MONOTONIC_RAW is truly monotonic, because it
@@ -232,8 +179,6 @@ static steady_clock::time_point __libcpp_steady_clock_now() {
return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
}
-#endif
-
#elif defined(_LIBCPP_WIN32API)
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms644905(v=vs.85).aspx says:
diff --git a/libcxx/src/filesystem/filesystem_common.h b/libcxx/src/filesystem/filesystem_common.h
index 5867805efeee..0d524262b182 100644
--- a/libcxx/src/filesystem/filesystem_common.h
+++ b/libcxx/src/filesystem/filesystem_common.h
@@ -34,14 +34,9 @@
# include <unistd.h>
#endif // defined(_LIBCPP_WIN32API)
-#include "../include/apple_availability.h"
-
-#if !defined(__APPLE__)
-// We can use the presence of UTIME_OMIT to detect platforms that provide
-// utimensat.
+// We can use the presence of UTIME_OMIT to detect platforms that provide utimensat.
#if defined(UTIME_OMIT)
-#define _LIBCPP_USE_UTIMENSAT
-#endif
+# define _LIBCPP_USE_UTIMENSAT
#endif
// TODO: Check whether these functions actually need internal linkage, or if they can be made normal header functions
diff --git a/libcxx/src/include/apple_availability.h b/libcxx/src/include/apple_availability.h
index 75bf79658d1e..c8d158e990e2 100644
--- a/libcxx/src/include/apple_availability.h
+++ b/libcxx/src/include/apple_availability.h
@@ -12,24 +12,6 @@
#if defined(__APPLE__)
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
-#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101300
-#define _LIBCPP_USE_UTIMENSAT
-#endif
-#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
-#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 110000
-#define _LIBCPP_USE_UTIMENSAT
-#endif
-#elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__)
-#if __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 110000
-#define _LIBCPP_USE_UTIMENSAT
-#endif
-#elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
-#if __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 40000
-#define _LIBCPP_USE_UTIMENSAT
-#endif
-#endif // __ENVIRONMENT_.*_VERSION_MIN_REQUIRED__
-
-#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500
#define _LIBCPP_USE_ULOCK
#endif