summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2017-05-24 18:31:48 +0000
committerKamil Rytarowski <n54@gmx.com>2017-05-24 18:31:48 +0000
commite739e49c0fad88faf72a309fca0c46bdd4fa20f5 (patch)
tree56d891a61dc8430740b788a3e264a1775ba286ec
parent466c82b74f72c6b122e97a3a4c903c173045ef08 (diff)
downloadbcm5719-llvm-e739e49c0fad88faf72a309fca0c46bdd4fa20f5.tar.gz
bcm5719-llvm-e739e49c0fad88faf72a309fca0c46bdd4fa20f5.zip
Replace std::call_once with llvm:call_once
Summary: This is required on some platforms, as GNU libstdc++ std::call_once is known to be buggy. This fixes operation of LLD on at least NetBSD and perhaps OpenBSD and Linux PowerPC. The same change has been introduced to LLVM and LLDB. Reviewers: ruiu Reviewed By: ruiu Subscribers: emaste, #lld Tags: #lld Differential Revision: https://reviews.llvm.org/D33508 llvm-svn: 303788
-rw-r--r--lld/ELF/InputSection.cpp3
-rw-r--r--lld/ELF/InputSection.h3
2 files changed, 4 insertions, 2 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index e8cfd21c4c4..bd96fdb3244 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -23,6 +23,7 @@
#include "llvm/Support/Compression.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/Threading.h"
#include <mutex>
using namespace llvm;
@@ -866,7 +867,7 @@ const SectionPiece *MergeInputSection::getSectionPiece(uint64_t Offset) const {
// it is not just an addition to a base output offset.
uint64_t MergeInputSection::getOffset(uint64_t Offset) const {
// Initialize OffsetMap lazily.
- std::call_once(InitOffsetMap, [&] {
+ llvm::call_once(InitOffsetMap, [&] {
OffsetMap.reserve(Pieces.size());
for (const SectionPiece &Piece : Pieces)
OffsetMap[Piece.InputOff] = Piece.OutputOff;
diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h
index 303c398b58c..75174969c48 100644
--- a/lld/ELF/InputSection.h
+++ b/lld/ELF/InputSection.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/Object/ELF.h"
+#include "llvm/Support/Threading.h"
#include <mutex>
namespace lld {
@@ -248,7 +249,7 @@ private:
std::vector<uint32_t> Hashes;
mutable llvm::DenseMap<uint64_t, uint64_t> OffsetMap;
- mutable std::once_flag InitOffsetMap;
+ mutable llvm::once_flag InitOffsetMap;
llvm::DenseSet<uint64_t> LiveOffsets;
};
OpenPOWER on IntegriCloud