[lld] d71bb6a - [ELF] Inline isPPC64SmallCodeModelTocReloc which is only called once. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 9 20:41:14 PST 2021
Author: Fangrui Song
Date: 2021-11-09T20:41:05-08:00
New Revision: d71bb6a4091893b12d52947d4d4f774a672921bf
URL: https://github.com/llvm/llvm-project/commit/d71bb6a4091893b12d52947d4d4f774a672921bf
DIFF: https://github.com/llvm/llvm-project/commit/d71bb6a4091893b12d52947d4d4f774a672921bf.diff
LOG: [ELF] Inline isPPC64SmallCodeModelTocReloc which is only called once. NFC
Added:
Modified:
lld/ELF/Arch/PPC64.cpp
lld/ELF/Relocations.cpp
lld/ELF/Target.h
Removed:
################################################################################
diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp
index d1568de3fba47..d5e73ab9ec979 100644
--- a/lld/ELF/Arch/PPC64.cpp
+++ b/lld/ELF/Arch/PPC64.cpp
@@ -187,11 +187,6 @@ unsigned elf::getPPC64GlobalEntryToLocalEntryOffset(uint8_t stOther) {
return 0;
}
-bool elf::isPPC64SmallCodeModelTocReloc(RelType type) {
- // The only small code model relocations that access the .toc section.
- return type == R_PPC64_TOC16 || type == R_PPC64_TOC16_DS;
-}
-
void elf::writePrefixedInstruction(uint8_t *loc, uint64_t insn) {
insn = config->isLE ? insn << 32 | insn >> 32 : insn;
write64(loc, insn);
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 1d444a9684a41..9c22ce7d60133 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1333,7 +1333,7 @@ static void scanReloc(InputSectionBase &sec, OffsetGetter &getOffset, RelTy *&i,
// have got-based small code model relocs. The .toc sections get placed
// after the end of the linker allocated .got section and we do sort those
// so sections addressed with small code model relocations come first.
- if (isPPC64SmallCodeModelTocReloc(type))
+ if (type == R_PPC64_TOC16 || type == R_PPC64_TOC16_DS)
sec.file->ppc64SmallCodeModelTocRelocs = true;
// Record the TOC entry (.toc + addend) as not relaxable. See the comment in
diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h
index abb769b25dfb4..e0e97301ca98c 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -212,10 +212,6 @@ unsigned getPPCDFormOp(unsigned secondaryOp);
// to the local entry-point.
unsigned getPPC64GlobalEntryToLocalEntryOffset(uint8_t stOther);
-// Returns true if a relocation is a small code model relocation that accesses
-// the .toc section.
-bool isPPC64SmallCodeModelTocReloc(RelType type);
-
// Write a prefixed instruction, which is a 4-byte prefix followed by a 4-byte
// instruction (regardless of endianness). Therefore, the prefix is always in
// lower memory than the instruction.
More information about the llvm-commits
mailing list