[lld] 88cb786 - [lld-macho][nfc] Remove DYSYM8 reloc attribute

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 9 16:51:11 PDT 2021


Author: Jez Ng
Date: 2021-04-09T19:48:08-04:00
New Revision: 88cb786ec261c9d947b3116c00ecd30e6570f64c

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

LOG: [lld-macho][nfc] Remove DYSYM8 reloc attribute

It's likely redundant, per discussion with @gkm. The BYTE8
attribute covers the bit width requirement already.

Reviewed By: #lld-macho, gkm

Differential Revision: https://reviews.llvm.org/D100133

Added: 
    

Modified: 
    lld/MachO/Arch/ARM64.cpp
    lld/MachO/Arch/X86_64.cpp
    lld/MachO/Relocations.cpp
    lld/MachO/Relocations.h

Removed: 
    


################################################################################
diff  --git a/lld/MachO/Arch/ARM64.cpp b/lld/MachO/Arch/ARM64.cpp
index bbb426a5979da..f0d0b308c3edf 100644
--- a/lld/MachO/Arch/ARM64.cpp
+++ b/lld/MachO/Arch/ARM64.cpp
@@ -55,8 +55,8 @@ struct ARM64 : TargetInfo {
 const RelocAttrs &ARM64::getRelocAttrs(uint8_t type) const {
   static const std::array<RelocAttrs, 11> relocAttrsArray{{
 #define B(x) RelocAttrBits::x
-      {"UNSIGNED", B(UNSIGNED) | B(ABSOLUTE) | B(EXTERN) | B(LOCAL) |
-                       B(DYSYM8) | B(BYTE4) | B(BYTE8)},
+      {"UNSIGNED",
+       B(UNSIGNED) | B(ABSOLUTE) | B(EXTERN) | B(LOCAL) | B(BYTE4) | B(BYTE8)},
       {"SUBTRACTOR", B(SUBTRAHEND) | B(BYTE4) | B(BYTE8)},
       {"BRANCH26", B(PCREL) | B(EXTERN) | B(BRANCH) | B(BYTE4)},
       {"PAGE21", B(PCREL) | B(EXTERN) | B(BYTE4)},

diff  --git a/lld/MachO/Arch/X86_64.cpp b/lld/MachO/Arch/X86_64.cpp
index 2e1120d77d159..0feb7bb635101 100644
--- a/lld/MachO/Arch/X86_64.cpp
+++ b/lld/MachO/Arch/X86_64.cpp
@@ -45,8 +45,8 @@ struct X86_64 : TargetInfo {
 const RelocAttrs &X86_64::getRelocAttrs(uint8_t type) const {
   static const std::array<RelocAttrs, 10> relocAttrsArray{{
 #define B(x) RelocAttrBits::x
-      {"UNSIGNED", B(UNSIGNED) | B(ABSOLUTE) | B(EXTERN) | B(LOCAL) |
-                       B(DYSYM8) | B(BYTE4) | B(BYTE8)},
+      {"UNSIGNED",
+       B(UNSIGNED) | B(ABSOLUTE) | B(EXTERN) | B(LOCAL) | B(BYTE4) | B(BYTE8)},
       {"SIGNED", B(PCREL) | B(EXTERN) | B(LOCAL) | B(BYTE4)},
       {"BRANCH", B(PCREL) | B(EXTERN) | B(BRANCH) | B(BYTE4)},
       {"GOT_LOAD", B(PCREL) | B(EXTERN) | B(GOT) | B(LOAD) | B(BYTE4)},

diff  --git a/lld/MachO/Relocations.cpp b/lld/MachO/Relocations.cpp
index e3b4cea5123b1..03cb6973b6ab1 100644
--- a/lld/MachO/Relocations.cpp
+++ b/lld/MachO/Relocations.cpp
@@ -31,10 +31,6 @@ bool macho::validateSymbolRelocation(const Symbol *sym,
   if (relocAttrs.hasAttr(RelocAttrBits::TLV) != sym->isTlv())
     error(message(Twine("requires that variable ") +
                   (sym->isTlv() ? "not " : "") + "be thread-local"));
-  if (relocAttrs.hasAttr(RelocAttrBits::DYSYM8) && isa<DylibSymbol>(sym) &&
-      r.length != 3)
-    error(message("has width " + std::to_string(1 << r.length) +
-                  " bytes, but must be 8 bytes"));
 
   return valid;
 }

diff  --git a/lld/MachO/Relocations.h b/lld/MachO/Relocations.h
index d58f9d4798639..6d31d27ec8321 100644
--- a/lld/MachO/Relocations.h
+++ b/lld/MachO/Relocations.h
@@ -36,11 +36,10 @@ enum class RelocAttrBits {
   BRANCH = 1 << 8,     // Value is branch target
   GOT = 1 << 9,        // References a symbol in the Global Offset Table
   TLV = 1 << 10,       // References a thread-local symbol
-  DYSYM8 = 1 << 11,    // Requires DySym width to be 8 bytes
-  LOAD = 1 << 12,      // Relaxable indirect load
-  POINTER = 1 << 13,   // Non-relaxable indirect load (pointer is taken)
-  UNSIGNED = 1 << 14,  // *_UNSIGNED relocs
-  LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue*/ (1 << 15) - 1),
+  LOAD = 1 << 11,      // Relaxable indirect load
+  POINTER = 1 << 12,   // Non-relaxable indirect load (pointer is taken)
+  UNSIGNED = 1 << 13,  // *_UNSIGNED relocs
+  LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue*/ (1 << 14) - 1),
 };
 // Note: SUBTRACTOR always pairs with UNSIGNED (a delta between two symbols).
 


        


More information about the llvm-commits mailing list