[lld] b0fc36d - [ELF] Remove unneeded getTargetInfo. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 28 20:29:42 PDT 2024


Author: Fangrui Song
Date: 2024-09-28T20:29:37-07:00
New Revision: b0fc36dfa42c420d38a9422e2c3092ca3ae84075

URL: https://github.com/llvm/llvm-project/commit/b0fc36dfa42c420d38a9422e2c3092ca3ae84075
DIFF: https://github.com/llvm/llvm-project/commit/b0fc36dfa42c420d38a9422e2c3092ca3ae84075.diff

LOG: [ELF] Remove unneeded getTargetInfo. NFC

Added: 
    

Modified: 
    lld/ELF/Arch/AArch64.cpp
    lld/ELF/Arch/X86_64.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp
index fb70e66b6d7561..d1e2834f1ee2c2 100644
--- a/lld/ELF/Arch/AArch64.cpp
+++ b/lld/ELF/Arch/AArch64.cpp
@@ -1073,18 +1073,6 @@ void AArch64BtiPac::writePlt(uint8_t *buf, const Symbol &sym,
     memcpy(buf + sizeof(addrInst) + sizeof(stdBr), nopData, sizeof(nopData));
 }
 
-static TargetInfo *getTargetInfo() {
-  if ((ctx.arg.andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) ||
-      ctx.arg.zPacPlt) {
-    static AArch64BtiPac t;
-    return &t;
-  }
-  static AArch64 t;
-  return &t;
-}
-
-TargetInfo *elf::getAArch64TargetInfo() { return getTargetInfo(); }
-
 template <class ELFT>
 static void
 addTaggedSymbolReferences(InputSectionBase &sec,
@@ -1187,3 +1175,13 @@ void lld::elf::createTaggedSymbols(const SmallVector<ELFFileBase *, 0> &files) {
     symbol->setIsTagged(true);
   }
 }
+
+TargetInfo *elf::getAArch64TargetInfo() {
+  if ((ctx.arg.andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) ||
+      ctx.arg.zPacPlt) {
+    static AArch64BtiPac t;
+    return &t;
+  }
+  static AArch64 t;
+  return &t;
+}

diff  --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp
index 019ccfd7e04e8c..6e13333edb8e41 100644
--- a/lld/ELF/Arch/X86_64.cpp
+++ b/lld/ELF/Arch/X86_64.cpp
@@ -1224,7 +1224,7 @@ void RetpolineZNow::writePlt(uint8_t *buf, const Symbol &sym,
   write32le(buf + 8, ctx.in.plt->getVA() - pltEntryAddr - 12);
 }
 
-static TargetInfo *getTargetInfo() {
+TargetInfo *elf::getX86_64TargetInfo() {
   if (ctx.arg.zRetpolineplt) {
     if (ctx.arg.zNow) {
       static RetpolineZNow t;
@@ -1242,5 +1242,3 @@ static TargetInfo *getTargetInfo() {
   static X86_64 t;
   return &t;
 }
-
-TargetInfo *elf::getX86_64TargetInfo() { return getTargetInfo(); }


        


More information about the llvm-commits mailing list