Skip to content

Conversation

@jrtc27
Copy link
Collaborator

@jrtc27 jrtc27 commented Jul 27, 2025

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

jrtc27 added 2 commits July 27, 2025 02:17
Created using spr 1.3.5
@llvmbot
Copy link
Member

llvmbot commented Jul 27, 2025

@llvm/pr-subscribers-lld

@llvm/pr-subscribers-lld-elf

Author: Jessica Clarke (jrtc27)

Changes

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

@hstk30-hw hstk30-hw requested a review from MaskRay July 27, 2025 15:43
jrtc27 added 2 commits July 30, 2025 17:07
Created using spr 1.3.5

[skip ci]
Created using spr 1.3.5
@jrtc27 jrtc27 changed the base branch from users/jrtc27/spr/main.nfcelf-dont-duplicate-dynamicreloc-constructor to main July 30, 2025 16:07
@jrtc27 jrtc27 merged commit 1522ad9 into main Jul 30, 2025
8 of 16 checks passed
@jrtc27 jrtc27 deleted the users/jrtc27/spr/nfcelf-dont-duplicate-dynamicreloc-constructor branch July 30, 2025 16:07
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Jul 30, 2025
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: llvm/llvm-project#150811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants