summaryrefslogtreecommitdiff
path: root/gnu/llvm
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2017-03-14 08:11:35 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2017-03-14 08:11:35 +0000
commit489aa4b3613388d8a9e35dfcb0c691739e05bbec (patch)
tree2da73ddb93c0e07bfad83a99c9afd444f829bf13 /gnu/llvm
parentd6d113268daec774e6dfd7f2833ea4fd62dbe386 (diff)
Merge LLVM 4.0.0 release.
Diffstat (limited to 'gnu/llvm')
-rw-r--r--gnu/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp8
-rw-r--r--gnu/llvm/lib/Target/AArch64/AArch64Subtarget.h4
-rw-r--r--gnu/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td7
-rw-r--r--gnu/llvm/tools/clang/lib/Basic/Targets.cpp2
-rw-r--r--gnu/llvm/tools/lld/ELF/Driver.cpp2
-rw-r--r--gnu/llvm/tools/lld/ELF/Symbols.cpp6
-rw-r--r--gnu/llvm/tools/lld/ELF/SyntheticSections.cpp82
7 files changed, 64 insertions, 47 deletions
diff --git a/gnu/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/gnu/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 0ccc1a8650f..d95f80c93c1 100644
--- a/gnu/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/gnu/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -3155,7 +3155,8 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
}
if (VA.isRegLoc()) {
- if (realArgIdx == 0 && Flags.isReturned() && Outs[0].VT == MVT::i64) {
+ if (realArgIdx == 0 && Flags.isReturned() && !Flags.isSwiftSelf() &&
+ Outs[0].VT == MVT::i64) {
assert(VA.getLocVT() == MVT::i64 &&
"unexpected calling convention register assignment");
assert(!Ins.empty() && Ins[0].VT == MVT::i64 &&
@@ -8934,8 +8935,9 @@ static SDValue splitStoreSplat(SelectionDAG &DAG, StoreSDNode &St,
// instructions (stp).
SDLoc DL(&St);
SDValue BasePtr = St.getBasePtr();
+ const MachinePointerInfo &PtrInfo = St.getPointerInfo();
SDValue NewST1 =
- DAG.getStore(St.getChain(), DL, SplatVal, BasePtr, St.getPointerInfo(),
+ DAG.getStore(St.getChain(), DL, SplatVal, BasePtr, PtrInfo,
OrigAlignment, St.getMemOperand()->getFlags());
unsigned Offset = EltOffset;
@@ -8944,7 +8946,7 @@ static SDValue splitStoreSplat(SelectionDAG &DAG, StoreSDNode &St,
SDValue OffsetPtr = DAG.getNode(ISD::ADD, DL, MVT::i64, BasePtr,
DAG.getConstant(Offset, DL, MVT::i64));
NewST1 = DAG.getStore(NewST1.getValue(0), DL, SplatVal, OffsetPtr,
- St.getPointerInfo(), Alignment,
+ PtrInfo.getWithOffset(Offset), Alignment,
St.getMemOperand()->getFlags());
Offset += EltOffset;
}
diff --git a/gnu/llvm/lib/Target/AArch64/AArch64Subtarget.h b/gnu/llvm/lib/Target/AArch64/AArch64Subtarget.h
index 76a006266ef..5354788cd35 100644
--- a/gnu/llvm/lib/Target/AArch64/AArch64Subtarget.h
+++ b/gnu/llvm/lib/Target/AArch64/AArch64Subtarget.h
@@ -79,7 +79,7 @@ protected:
bool CustomAsCheapAsMove = false;
bool UsePostRAScheduler = false;
bool Misaligned128StoreIsSlow = false;
- bool AvoidQuadLdStPairs = false;
+ bool Paired128IsSlow = false;
bool UseAlternateSExtLoadCVTF32Pattern = false;
bool HasArithmeticBccFusion = false;
bool HasArithmeticCbzFusion = false;
@@ -189,7 +189,7 @@ public:
}
bool hasCustomCheapAsMoveHandling() const { return CustomAsCheapAsMove; }
bool isMisaligned128StoreSlow() const { return Misaligned128StoreIsSlow; }
- bool avoidQuadLdStPairs() const { return AvoidQuadLdStPairs; }
+ bool isPaired128Slow() const { return Paired128IsSlow; }
bool useAlternateSExtLoadCVTF32Pattern() const {
return UseAlternateSExtLoadCVTF32Pattern;
}
diff --git a/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 334974f4684..d3e21ed9798 100644
--- a/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3337,8 +3337,8 @@ def note_ovl_candidate : Note<"candidate "
def note_ovl_candidate_inherited_constructor : Note<
"constructor from base class %0 inherited here">;
def note_ovl_candidate_inherited_constructor_slice : Note<
- "constructor inherited from base class cannot be used to initialize from "
- "an argument of the derived class type">;
+ "candidate %select{constructor|template}0 ignored: "
+ "inherited constructor cannot be used to %select{copy|move}1 object">;
def note_ovl_candidate_illegal_constructor : Note<
"candidate %select{constructor|template}0 ignored: "
"instantiation %select{takes|would take}0 its own class type by value">;
@@ -3373,7 +3373,8 @@ def note_ovl_candidate_has_pass_object_size_params: Note<
"candidate address cannot be taken because parameter %0 has "
"pass_object_size attribute">;
def err_diagnose_if_succeeded : Error<"%0">;
-def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>;
+def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
+ ShowInSystemHeader;
def note_ovl_candidate_disabled_by_function_cond_attr : Note<
"candidate disabled: %0">;
def note_ovl_candidate_disabled_by_extension : Note<
diff --git a/gnu/llvm/tools/clang/lib/Basic/Targets.cpp b/gnu/llvm/tools/clang/lib/Basic/Targets.cpp
index f6db9047c34..455b03f6eac 100644
--- a/gnu/llvm/tools/clang/lib/Basic/Targets.cpp
+++ b/gnu/llvm/tools/clang/lib/Basic/Targets.cpp
@@ -512,7 +512,7 @@ protected:
Builder.defineMacro("__unix__");
Builder.defineMacro("__ELF__");
if (Opts.POSIXThreads)
- Builder.defineMacro("_POSIX_THREADS");
+ Builder.defineMacro("_REENTRANT");
switch (Triple.getArch()) {
default:
diff --git a/gnu/llvm/tools/lld/ELF/Driver.cpp b/gnu/llvm/tools/lld/ELF/Driver.cpp
index e9425007530..c6e69c5bb4b 100644
--- a/gnu/llvm/tools/lld/ELF/Driver.cpp
+++ b/gnu/llvm/tools/lld/ELF/Driver.cpp
@@ -502,7 +502,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->PrintGcSections = Args.hasArg(OPT_print_gc_sections);
Config->Relocatable = Args.hasArg(OPT_relocatable);
Config->DefineCommon = getArg(Args, OPT_define_common, OPT_no_define_common,
- !Config->Relocatable);
+ !Config->Relocatable);
Config->Discard = getDiscardOption(Args);
Config->SaveTemps = Args.hasArg(OPT_save_temps);
Config->SingleRoRx = Args.hasArg(OPT_no_rosegment);
diff --git a/gnu/llvm/tools/lld/ELF/Symbols.cpp b/gnu/llvm/tools/lld/ELF/Symbols.cpp
index fb752dcb3bf..43af44ec4b8 100644
--- a/gnu/llvm/tools/lld/ELF/Symbols.cpp
+++ b/gnu/llvm/tools/lld/ELF/Symbols.cpp
@@ -205,8 +205,8 @@ void SymbolBody::parseSymbolVersion() {
// Truncate the symbol name so that it doesn't include the version string.
Name = {S.data(), Pos};
- // If this is an undefined or shared symbol it is not a definition.
- if (isUndefined() || isShared())
+ // If this is not in this DSO, it is not a definition.
+ if (!isInCurrentDSO())
return;
// '@@' in a symbol name means the default version.
@@ -302,7 +302,7 @@ uint8_t Symbol::computeBinding() const {
if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED)
return STB_LOCAL;
const SymbolBody *Body = body();
- if (VersionId == VER_NDX_LOCAL && !Body->isUndefined() && !Body->isShared())
+ if (VersionId == VER_NDX_LOCAL && Body->isInCurrentDSO())
return STB_LOCAL;
if (Config->NoGnuUnique && Binding == STB_GNU_UNIQUE)
return STB_GLOBAL;
diff --git a/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp b/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp
index 2e6c80e575d..b673a4ece1d 100644
--- a/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp
+++ b/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp
@@ -437,7 +437,7 @@ template <class ELFT> void GotSection<ELFT>::writeTo(uint8_t *Buf) {
template <class ELFT>
MipsGotSection<ELFT>::MipsGotSection()
: SyntheticSection<ELFT>(SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL,
- SHT_PROGBITS, Target->GotEntrySize, ".got") {}
+ SHT_PROGBITS, 16, ".got") {}
template <class ELFT>
void MipsGotSection<ELFT>::addEntry(SymbolBody &Sym, uintX_t Addend,
@@ -886,9 +886,9 @@ template <class ELFT> void DynamicSection<ELFT>::finalize() {
add({DT_FINI_ARRAYSZ, Out<ELFT>::FiniArray, Entry::SecSize});
}
- if (SymbolBody *B = Symtab<ELFT>::X->find(Config->Init))
+ if (SymbolBody *B = Symtab<ELFT>::X->findInCurrentDSO(Config->Init))
add({DT_INIT, B});
- if (SymbolBody *B = Symtab<ELFT>::X->find(Config->Fini))
+ if (SymbolBody *B = Symtab<ELFT>::X->findInCurrentDSO(Config->Fini))
add({DT_FINI, B});
bool HasVerNeed = In<ELFT>::VerNeed->getNeedNum() != 0;
@@ -1068,22 +1068,21 @@ template <class ELFT> void SymbolTableSection<ELFT>::finalize() {
this->OutSec->Info = this->Info = NumLocals + 1;
this->OutSec->Entsize = this->Entsize;
- if (Config->Relocatable) {
- size_t I = NumLocals;
- for (const SymbolTableEntry &S : Symbols)
- S.Symbol->DynsymIndex = ++I;
+ if (Config->Relocatable)
return;
- }
if (!StrTabSec.isDynamic()) {
- std::stable_sort(
- Symbols.begin(), Symbols.end(),
- [](const SymbolTableEntry &L, const SymbolTableEntry &R) {
- return L.Symbol->symbol()->computeBinding() == STB_LOCAL &&
- R.Symbol->symbol()->computeBinding() != STB_LOCAL;
+ auto GlobBegin = Symbols.begin() + NumLocals;
+ auto It = std::stable_partition(
+ GlobBegin, Symbols.end(), [](const SymbolTableEntry &S) {
+ return S.Symbol->symbol()->computeBinding() == STB_LOCAL;
});
+ // update sh_info with number of Global symbols output with computed
+ // binding of STB_LOCAL
+ this->OutSec->Info = this->Info = 1 + It - Symbols.begin();
return;
}
+
if (In<ELFT>::GnuHashTab)
// NB: It also sorts Symbols to meet the GNU hash table requirements.
In<ELFT>::GnuHashTab->addSymbols(Symbols);
@@ -1097,10 +1096,25 @@ template <class ELFT> void SymbolTableSection<ELFT>::finalize() {
S.Symbol->DynsymIndex = ++I;
}
-template <class ELFT> void SymbolTableSection<ELFT>::addSymbol(SymbolBody *B) {
+template <class ELFT> void SymbolTableSection<ELFT>::addGlobal(SymbolBody *B) {
Symbols.push_back({B, StrTabSec.addString(B->getName(), false)});
}
+template <class ELFT> void SymbolTableSection<ELFT>::addLocal(SymbolBody *B) {
+ assert(!StrTabSec.isDynamic());
+ ++NumLocals;
+ Symbols.push_back({B, StrTabSec.addString(B->getName())});
+}
+
+template <class ELFT>
+size_t SymbolTableSection<ELFT>::getSymbolIndex(SymbolBody *Body) {
+ auto I = llvm::find_if(
+ Symbols, [&](const SymbolTableEntry &E) { return E.Symbol == Body; });
+ if (I == Symbols.end())
+ return 0;
+ return I - Symbols.begin() + 1;
+}
+
template <class ELFT> void SymbolTableSection<ELFT>::writeTo(uint8_t *Buf) {
Buf += sizeof(Elf_Sym);
@@ -1116,26 +1130,24 @@ template <class ELFT>
void SymbolTableSection<ELFT>::writeLocalSymbols(uint8_t *&Buf) {
// Iterate over all input object files to copy their local symbols
// to the output symbol table pointed by Buf.
- for (ObjectFile<ELFT> *File : Symtab<ELFT>::X->getObjectFiles()) {
- for (const std::pair<const DefinedRegular<ELFT> *, size_t> &P :
- File->KeptLocalSyms) {
- const DefinedRegular<ELFT> &Body = *P.first;
- InputSectionBase<ELFT> *Section = Body.Section;
- auto *ESym = reinterpret_cast<Elf_Sym *>(Buf);
-
- if (!Section) {
- ESym->st_shndx = SHN_ABS;
- ESym->st_value = Body.Value;
- } else {
- const OutputSectionBase *OutSec = Section->OutSec;
- ESym->st_shndx = OutSec->SectionIndex;
- ESym->st_value = OutSec->Addr + Section->getOffset(Body);
- }
- ESym->st_name = P.second;
- ESym->st_size = Body.template getSize<ELFT>();
- ESym->setBindingAndType(STB_LOCAL, Body.Type);
- Buf += sizeof(*ESym);
+
+ for (auto I = Symbols.begin(); I != Symbols.begin() + NumLocals; ++I) {
+ const DefinedRegular<ELFT> &Body = *cast<DefinedRegular<ELFT>>(I->Symbol);
+ InputSectionBase<ELFT> *Section = Body.Section;
+ auto *ESym = reinterpret_cast<Elf_Sym *>(Buf);
+
+ if (!Section) {
+ ESym->st_shndx = SHN_ABS;
+ ESym->st_value = Body.Value;
+ } else {
+ const OutputSectionBase *OutSec = Section->OutSec;
+ ESym->st_shndx = OutSec->SectionIndex;
+ ESym->st_value = OutSec->Addr + Section->getOffset(Body);
}
+ ESym->st_name = I->StrTabOffset;
+ ESym->st_size = Body.template getSize<ELFT>();
+ ESym->setBindingAndType(STB_LOCAL, Body.Type);
+ Buf += sizeof(*ESym);
}
}
@@ -1144,7 +1156,9 @@ void SymbolTableSection<ELFT>::writeGlobalSymbols(uint8_t *Buf) {
// Write the internal symbol table contents to the output symbol table
// pointed by Buf.
auto *ESym = reinterpret_cast<Elf_Sym *>(Buf);
- for (const SymbolTableEntry &S : Symbols) {
+
+ for (auto I = Symbols.begin() + NumLocals; I != Symbols.end(); ++I) {
+ const SymbolTableEntry &S = *I;
SymbolBody *Body = S.Symbol;
size_t StrOff = S.StrTabOffset;