summaryrefslogtreecommitdiff
path: root/libcxx/src
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2023-03-06 16:14:06 -0500
committerLouis Dionne <ldionne.2@gmail.com>2023-04-19 17:27:14 -0400
commit87cec865979cb1e5c172bcdbb78e834bf4935c0f (patch)
tree4a26ac34518c43caf3450c0c696e7f28948f10b7 /libcxx/src
parent77e3914be7c99a76a2f728adbb2a169d7cfc5a10 (diff)
downloadllvm-87cec865979cb1e5c172bcdbb78e834bf4935c0f.tar.gz
[libc++] Remove symbols for a std::allocator_arg & friends from the dylib
This patch removes the symbols defined in the library for std::allocator_arg, std::defer_lock, std::try_to_lock, std::adopt_lock, and std::piecewise_construct. Those were defined in the library because we provided them in C++03 as an extension, and in C++03 it was impossible to define them as `constexpr` variables, like in the spec. This is technically an ABI break since we are removing symbols from the library. However, in practice, only programs compiled in C++03 mode who take the address of those objects (or pass them as a reference) will have an undefined ref to those symbols. In practice, this is expected to be rare. First, those are C++11 features that we happen to provide in C++03, and only the C++03 definition can potentially lead to code referencing the dylib definition. So any code that is using these objects but compiling in C++11 mode (as they should) is not at risk. Second, all uses of these types in the library is done by passing those types by value to a function that can get inlined. Since they are empty types, the compiler won't generate an undefined reference if passed by value, since there's nothing to pass anyway. Long story short, the risk for code actually containing an undefined reference to one of these types is rather small (but non-zero). I also couldn't find any app on the App Store that referenced these symbols, which supports my impression that this won't be an issue in practice. Differential Revision: https://reviews.llvm.org/D145587
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/CMakeLists.txt1
-rw-r--r--libcxx/src/memory.cpp2
-rw-r--r--libcxx/src/mutex.cpp4
-rw-r--r--libcxx/src/utility.cpp15
4 files changed, 0 insertions, 22 deletions
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 9ff2a62e9394..14130a7527b4 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -58,7 +58,6 @@ set(LIBCXX_SOURCES
system_error.cpp
thread.cpp
typeinfo.cpp
- utility.cpp
valarray.cpp
variant.cpp
vector.cpp
diff --git a/libcxx/src/memory.cpp b/libcxx/src/memory.cpp
index 3fd5439049ab..d01d6140d370 100644
--- a/libcxx/src/memory.cpp
+++ b/libcxx/src/memory.cpp
@@ -25,8 +25,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-const allocator_arg_t allocator_arg = allocator_arg_t();
-
bad_weak_ptr::~bad_weak_ptr() noexcept {}
const char*
diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp
index 90e615fb1297..9469dcf6c456 100644
--- a/libcxx/src/mutex.cpp
+++ b/libcxx/src/mutex.cpp
@@ -25,10 +25,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
-const defer_lock_t defer_lock{};
-const try_to_lock_t try_to_lock{};
-const adopt_lock_t adopt_lock{};
-
// ~mutex is defined elsewhere
void
diff --git a/libcxx/src/utility.cpp b/libcxx/src/utility.cpp
deleted file mode 100644
index 44433d11d7aa..000000000000
--- a/libcxx/src/utility.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include <utility>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-const piecewise_construct_t piecewise_construct{};
-
-_LIBCPP_END_NAMESPACE_STD