[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
This commit is contained in:
Jez Ng 2021-04-09 19:47:10 -04:00
parent 5091671c9b
commit 88cb786ec2
4 changed files with 8 additions and 13 deletions

View File

@ -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)},

View File

@ -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)},

View File

@ -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;
}

View File

@ -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).