Skip to content

Commit e3be3f6

Browse files
nikiccuviper
authored andcommitted
[rust] Fix lld build errors with GCC 5.2
1 parent 639388a commit e3be3f6

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

lld/ELF/Arch/RISCV.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,9 +618,9 @@ static bool relax(InputSection &sec) {
618618
valueDelta[sa[0].d] = delta;
619619
delta = aux.relocDeltas[it.index()];
620620
}
621-
for (const SymbolAnchor &sa : sa)
622-
if (!sa.end)
623-
valueDelta[sa.d] = delta;
621+
for (const SymbolAnchor &saElem : sa)
622+
if (!saElem.end)
623+
valueDelta[saElem.d] = delta;
624624
sa = makeArrayRef(aux.anchors);
625625
delta = 0;
626626

lld/ELF/InputFiles.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,14 @@ template <class ELFT> static void doParseFile(InputFile *file) {
185185

186186
// .so file
187187
if (auto *f = dyn_cast<SharedFile>(file)) {
188-
f->parse<ELFT>();
188+
f->template parse<ELFT>();
189189
return;
190190
}
191191

192192
// LLVM bitcode file
193193
if (auto *f = dyn_cast<BitcodeFile>(file)) {
194194
ctx->bitcodeFiles.push_back(f);
195-
f->parse<ELFT>();
195+
f->template parse<ELFT>();
196196
return;
197197
}
198198

lld/ELF/InputSection.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ template <class ELFT> RelsOrRelas<ELFT> InputSectionBase::relsOrRelas() const {
130130
return {};
131131
RelsOrRelas<ELFT> ret;
132132
typename ELFT::Shdr shdr =
133-
cast<ELFFileBase>(file)->getELFShdrs<ELFT>()[relSecIdx];
133+
cast<ELFFileBase>(file)->template getELFShdrs<ELFT>()[relSecIdx];
134134
if (shdr.sh_type == SHT_REL) {
135135
ret.rels = makeArrayRef(reinterpret_cast<const typename ELFT::Rel *>(
136136
file->mb.getBufferStart() + shdr.sh_offset),
@@ -413,7 +413,7 @@ void InputSection::copyRelocations(uint8_t *buf, ArrayRef<RelTy> rels) {
413413
// individual "gp" values used by each input object file.
414414
// As a workaround we add the "gp" value to the relocation
415415
// addend and save it back to the file.
416-
addend += sec->getFile<ELFT>()->mipsGp0;
416+
addend += sec->template getFile<ELFT>()->mipsGp0;
417417
}
418418

419419
if (RelTy::IsRela)
@@ -963,9 +963,9 @@ void InputSectionBase::relocate(uint8_t *buf, uint8_t *bufEnd) {
963963
// locations with tombstone values.
964964
const RelsOrRelas<ELFT> rels = sec->template relsOrRelas<ELFT>();
965965
if (rels.areRelocsRel())
966-
sec->relocateNonAlloc<ELFT>(buf, rels.rels);
966+
sec->template relocateNonAlloc<ELFT>(buf, rels.rels);
967967
else
968-
sec->relocateNonAlloc<ELFT>(buf, rels.relas);
968+
sec->template relocateNonAlloc<ELFT>(buf, rels.relas);
969969
}
970970

971971
void InputSectionBase::relocateAlloc(uint8_t *buf, uint8_t *bufEnd) {
@@ -1172,7 +1172,8 @@ void InputSectionBase::adjustSplitStackFunctionPrologues(uint8_t *buf,
11721172
// conservative.
11731173
if (Defined *d = dyn_cast<Defined>(rel.sym))
11741174
if (InputSection *isec = cast_or_null<InputSection>(d->section))
1175-
if (!isec || !isec->getFile<ELFT>() || isec->getFile<ELFT>()->splitStack)
1175+
if (!isec || !isec->template getFile<ELFT>() ||
1176+
isec->template getFile<ELFT>()->splitStack)
11761177
continue;
11771178

11781179
if (enclosingPrologueAttempted(rel.offset, prologues))

lld/ELF/SyntheticSections.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ std::unique_ptr<MipsOptionsSection<ELFT>> MipsOptionsSection<ELFT>::create() {
197197
auto *opt = reinterpret_cast<const Elf_Mips_Options *>(d.data());
198198
if (opt->kind == ODK_REGINFO) {
199199
reginfo.ri_gprmask |= opt->getRegInfo().ri_gprmask;
200-
sec->getFile<ELFT>()->mipsGp0 = opt->getRegInfo().ri_gp_value;
200+
sec->template getFile<ELFT>()->mipsGp0 = opt->getRegInfo().ri_gp_value;
201201
break;
202202
}
203203

@@ -249,7 +249,7 @@ std::unique_ptr<MipsReginfoSection<ELFT>> MipsReginfoSection<ELFT>::create() {
249249

250250
auto *r = reinterpret_cast<const Elf_Mips_RegInfo *>(sec->rawData.data());
251251
reginfo.ri_gprmask |= r->ri_gprmask;
252-
sec->getFile<ELFT>()->mipsGp0 = r->ri_gp_value;
252+
sec->template getFile<ELFT>()->mipsGp0 = r->ri_gp_value;
253253
};
254254

255255
return std::make_unique<MipsReginfoSection<ELFT>>(reginfo);
@@ -3360,7 +3360,7 @@ template <class ELFT> void elf::splitSections() {
33603360
if (auto *s = dyn_cast<MergeInputSection>(sec))
33613361
s->splitIntoPieces();
33623362
else if (auto *eh = dyn_cast<EhInputSection>(sec))
3363-
eh->split<ELFT>();
3363+
eh->template split<ELFT>();
33643364
}
33653365
});
33663366
}

0 commit comments

Comments
 (0)