Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/lld/Common/Memory.h b/linux-x64/clang/include/lld/Common/Memory.h
index 41d8f15..f516a32 100644
--- a/linux-x64/clang/include/lld/Common/Memory.h
+++ b/linux-x64/clang/include/lld/Common/Memory.h
@@ -47,11 +47,20 @@
llvm::SpecificBumpPtrAllocator<T> alloc;
};
+// Use a static local for these singletons so they are only registered if an
+// object of this instance is ever constructed. Otherwise we will create and
+// register ELF allocators for COFF and the reverse.
+template <typename T>
+inline llvm::SpecificBumpPtrAllocator<T> &getSpecificAllocSingleton() {
+ static SpecificAlloc<T> instance;
+ return instance.alloc;
+}
+
// Use this arena if your object has a destructor.
// Your destructor will be invoked from freeArena().
template <typename T, typename... U> T *make(U &&... args) {
- static SpecificAlloc<T> alloc;
- return new (alloc.alloc.Allocate()) T(std::forward<U>(args)...);
+ return new (getSpecificAllocSingleton<T>().Allocate())
+ T(std::forward<U>(args)...);
}
} // namespace lld