[ELF] Detemplate maybeReportUndefined and copySectionsIntoPartitions

llvm-svn: 367117
This commit is contained in:
Fangrui Song 2019-07-26 14:57:53 +00:00
parent 8a8c69808c
commit 3d51d4ed6d
2 changed files with 3 additions and 4 deletions

View File

@ -766,7 +766,6 @@ template <class ELFT> void elf::reportUndefinedSymbols() {
// Report an undefined symbol if necessary.
// Returns true if the undefined symbol will produce an error message.
template <class ELFT>
static bool maybeReportUndefined(Symbol &sym, InputSectionBase &sec,
uint64_t offset) {
if (!sym.isUndefined() || sym.isWeak())
@ -1125,7 +1124,7 @@ static void scanReloc(InputSectionBase &sec, OffsetGetter &getOffset, RelTy *&i,
// Error if the target symbol is undefined. Symbol index 0 may be used by
// marker relocations, e.g. R_*_NONE and R_ARM_V4BX. Don't error on them.
if (symIndex != 0 && maybeReportUndefined<ELFT>(sym, sec, rel.r_offset))
if (symIndex != 0 && maybeReportUndefined(sym, sec, rel.r_offset))
return;
const uint8_t *relocatedAddr = sec.data().begin() + rel.r_offset;

View File

@ -154,7 +154,7 @@ void Writer<ELFT>::removeEmptyPTLoad(std::vector<PhdrEntry *> &phdrs) {
});
}
template <class ELFT> static void copySectionsIntoPartitions() {
static void copySectionsIntoPartitions() {
std::vector<InputSectionBase *> newSections;
for (unsigned part = 2; part != partitions.size() + 1; ++part) {
for (InputSectionBase *s : inputSections) {
@ -546,7 +546,7 @@ template <class ELFT> static void createSyntheticSections() {
template <class ELFT> void Writer<ELFT>::run() {
// Make copies of any input sections that need to be copied into each
// partition.
copySectionsIntoPartitions<ELFT>();
copySectionsIntoPartitions();
// Create linker-synthesized sections such as .got or .plt.
// Such sections are of type input section.