[lld] 1522ad9 - [NFC][ELF] Don't duplicate DynamicReloc constructor

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 30 09:07:51 PDT 2025


Author: Jessica Clarke
Date: 2025-07-30T17:07:48+01:00
New Revision: 1522ad956929b53d3adfe61c1c3f60d2d3fe076c

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

LOG: [NFC][ELF] Don't duplicate DynamicReloc constructor

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

Reviewers: arichardson, MaskRay

Reviewed By: MaskRay, arichardson

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

Added: 
    

Modified: 
    lld/ELF/SyntheticSections.h

Removed: 
    


################################################################################
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;


        


More information about the llvm-commits mailing list