[ELF] - Detemplate elf::addSyntheticLocal(). NFC.

llvm-svn: 303155
This commit is contained in:
George Rimar 2017-05-16 10:11:36 +00:00
parent 2f314104e0
commit 390242d0e9
4 changed files with 14 additions and 28 deletions

View File

@ -293,7 +293,6 @@ InputSection *elf::createInterpSection() {
return Sec;
}
template <class ELFT>
SymbolBody *elf::addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value,
uint64_t Size, InputSectionBase *Section) {
auto *S = make<DefinedRegular>(Name, /*IsLocal*/ true, STV_DEFAULT, Type,
@ -2270,19 +2269,6 @@ template MergeInputSection *elf::createCommentSection<ELF32BE>();
template MergeInputSection *elf::createCommentSection<ELF64LE>();
template MergeInputSection *elf::createCommentSection<ELF64BE>();
template SymbolBody *elf::addSyntheticLocal<ELF32LE>(StringRef, uint8_t,
uint64_t, uint64_t,
InputSectionBase *);
template SymbolBody *elf::addSyntheticLocal<ELF32BE>(StringRef, uint8_t,
uint64_t, uint64_t,
InputSectionBase *);
template SymbolBody *elf::addSyntheticLocal<ELF64LE>(StringRef, uint8_t,
uint64_t, uint64_t,
InputSectionBase *);
template SymbolBody *elf::addSyntheticLocal<ELF64BE>(StringRef, uint8_t,
uint64_t, uint64_t,
InputSectionBase *);
template class elf::MipsAbiFlagsSection<ELF32LE>;
template class elf::MipsAbiFlagsSection<ELF32BE>;
template class elf::MipsAbiFlagsSection<ELF64LE>;

View File

@ -747,7 +747,7 @@ private:
template <class ELFT> InputSection *createCommonSection();
InputSection *createInterpSection();
template <class ELFT> MergeInputSection *createCommentSection();
template <class ELFT>
SymbolBody *addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value,
uint64_t Size, InputSectionBase *Section);

View File

@ -1762,8 +1762,8 @@ void ARMTargetInfo::writePltHeader(uint8_t *Buf) const {
void ARMTargetInfo::addPltHeaderSymbols(InputSectionBase *ISD) const {
auto *IS = cast<InputSection>(ISD);
addSyntheticLocal<ELF32LE>("$a", STT_NOTYPE, 0, 0, IS);
addSyntheticLocal<ELF32LE>("$d", STT_NOTYPE, 16, 0, IS);
addSyntheticLocal("$a", STT_NOTYPE, 0, 0, IS);
addSyntheticLocal("$d", STT_NOTYPE, 16, 0, IS);
}
void ARMTargetInfo::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
@ -1785,8 +1785,8 @@ void ARMTargetInfo::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
void ARMTargetInfo::addPltSymbols(InputSectionBase *ISD, uint64_t Off) const {
auto *IS = cast<InputSection>(ISD);
addSyntheticLocal<ELF32LE>("$a", STT_NOTYPE, Off, 0, IS);
addSyntheticLocal<ELF32LE>("$d", STT_NOTYPE, Off + 12, 0, IS);
addSyntheticLocal("$a", STT_NOTYPE, Off, 0, IS);
addSyntheticLocal("$d", STT_NOTYPE, Off + 12, 0, IS);
}
bool ARMTargetInfo::needsThunk(RelExpr Expr, uint32_t RelocType,

View File

@ -124,10 +124,10 @@ void ARMV7ABSLongThunk<ELFT>::writeTo(uint8_t *Buf, ThunkSection &IS) const {
template <class ELFT>
void ARMV7ABSLongThunk<ELFT>::addSymbols(ThunkSection &IS) {
this->ThunkSym = addSyntheticLocal<ELFT>(
this->ThunkSym = addSyntheticLocal(
Saver.save("__ARMv7ABSLongThunk_" + this->Destination.getName()),
STT_FUNC, this->Offset, size(), &IS);
addSyntheticLocal<ELFT>("$a", STT_NOTYPE, this->Offset, 0, &IS);
addSyntheticLocal("$a", STT_NOTYPE, this->Offset, 0, &IS);
}
template <class ELFT>
@ -145,10 +145,10 @@ void ThumbV7ABSLongThunk<ELFT>::writeTo(uint8_t *Buf, ThunkSection &IS) const {
template <class ELFT>
void ThumbV7ABSLongThunk<ELFT>::addSymbols(ThunkSection &IS) {
this->ThunkSym = addSyntheticLocal<ELFT>(
this->ThunkSym = addSyntheticLocal(
Saver.save("__Thumbv7ABSLongThunk_" + this->Destination.getName()),
STT_FUNC, this->Offset, size(), &IS);
addSyntheticLocal<ELFT>("$t", STT_NOTYPE, this->Offset, 0, &IS);
addSyntheticLocal("$t", STT_NOTYPE, this->Offset, 0, &IS);
}
template <class ELFT>
@ -168,10 +168,10 @@ void ARMV7PILongThunk<ELFT>::writeTo(uint8_t *Buf, ThunkSection &IS) const {
template <class ELFT>
void ARMV7PILongThunk<ELFT>::addSymbols(ThunkSection &IS) {
this->ThunkSym = addSyntheticLocal<ELFT>(
this->ThunkSym = addSyntheticLocal(
Saver.save("__ARMV7PILongThunk_" + this->Destination.getName()), STT_FUNC,
this->Offset, size(), &IS);
addSyntheticLocal<ELFT>("$a", STT_NOTYPE, this->Offset, 0, &IS);
addSyntheticLocal("$a", STT_NOTYPE, this->Offset, 0, &IS);
}
template <class ELFT>
@ -191,10 +191,10 @@ void ThumbV7PILongThunk<ELFT>::writeTo(uint8_t *Buf, ThunkSection &IS) const {
template <class ELFT>
void ThumbV7PILongThunk<ELFT>::addSymbols(ThunkSection &IS) {
this->ThunkSym = addSyntheticLocal<ELFT>(
this->ThunkSym = addSyntheticLocal(
Saver.save("__ThumbV7PILongThunk_" + this->Destination.getName()),
STT_FUNC, this->Offset, size(), &IS);
addSyntheticLocal<ELFT>("$t", STT_NOTYPE, this->Offset, 0, &IS);
addSyntheticLocal("$t", STT_NOTYPE, this->Offset, 0, &IS);
}
// Write MIPS LA25 thunk code to call PIC function from the non-PIC one.
@ -212,7 +212,7 @@ void MipsThunk<ELFT>::writeTo(uint8_t *Buf, ThunkSection &) const {
}
template <class ELFT> void MipsThunk<ELFT>::addSymbols(ThunkSection &IS) {
this->ThunkSym = addSyntheticLocal<ELFT>(
this->ThunkSym = addSyntheticLocal(
Saver.save("__LA25Thunk_" + this->Destination.getName()), STT_FUNC,
this->Offset, size(), &IS);
}