[llvm-branch-commits] [NFC][ELF] Don't duplicate DynamicReloc constructor (PR #150811)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Jul 26 18:18:12 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld-elf

Author: Jessica Clarke (jrtc27)

<details>
<summary>Changes</summary>

This second constructor is just a shorthand for an AddendOnly relocation
against dummySym with R_ADDEND, so write it as such.


---
Full diff: https://github.com/llvm/llvm-project/pull/150811.diff


1 Files Affected:

- (modified) lld/ELF/SyntheticSections.h (+2-3) 


``````````diff
diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index 2e7a3c3bc96d2..24ca93fb2b16a 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -442,9 +442,8 @@ class DynamicReloc {
   /// This constructor records a relative relocation with no symbol.
   DynamicReloc(RelType type, const InputSectionBase *inputSec,
                uint64_t offsetInSec, int64_t addend = 0)
-      : sym(inputSec->getCtx().dummySym), inputSec(inputSec),
-        offsetInSec(offsetInSec), type(type), addend(addend), kind(AddendOnly),
-        expr(R_ADDEND) {}
+      : DynamicReloc(type, inputSec, offsetInSec, AddendOnly,
+                     *inputSec->getCtx().dummySym, addend, R_ADDEND) {}
 
   uint64_t getOffset() const;
   uint32_t getSymIndex(SymbolTableBaseSection *symTab) const;

``````````

</details>


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


More information about the llvm-branch-commits mailing list