[lld] [lld][macho] Support 1-byte branch relocs for x86_64 (PR #164439)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 12:24:43 PDT 2025


================
@@ -96,11 +98,18 @@ int64_t X86_64::getEmbeddedAddend(MemoryBufferRef mb, uint64_t offset,
 void X86_64::relocateOne(uint8_t *loc, const Reloc &r, uint64_t value,
                          uint64_t relocVA) const {
   if (r.pcrel) {
-    uint64_t pc = relocVA + 4 + pcrelOffset(r.type);
+    uint64_t pc = relocVA + (1 << r.length) + pcrelOffset(r.type);
----------------
ellishg wrote:

It is also used in another file :) But yeah, it's not a hard requirement for me. Although I wish it was at least named `r.loglength` or something similar.

https://github.com/llvm/llvm-project/pull/164439


More information about the llvm-commits mailing list