@@ -419,26 +419,19 @@ class StringTableSection final : public SyntheticSection {
419
419
class DynamicReloc {
420
420
public:
421
421
enum Kind {
422
- // / The resulting dynamic relocation does not reference a symbol (#sym must
423
- // / be nullptr) and uses #addend as the result of computeAddend(ctx).
424
- AddendOnly,
425
422
// / The resulting dynamic relocation will not reference a symbol: #sym is
426
423
// / only used to compute the addend with InputSection::getRelocTargetVA().
427
424
// / Useful for various relative and TLS relocations (e.g. R_X86_64_TPOFF64).
428
- AddendOnlyWithTargetVA ,
425
+ AddendOnly ,
429
426
// / The resulting dynamic relocation references symbol #sym from the dynamic
430
- // / symbol table and uses #addend as the value of computeAddend(ctx).
427
+ // / symbol table and uses InputSection::getRelocTargetVA() for the final
428
+ // / addend.
431
429
AgainstSymbol,
432
- // / The resulting dynamic relocation references symbol #sym from the dynamic
433
- // / symbol table and uses InputSection::getRelocTargetVA() + #addend for the
434
- // / final addend. It can be used for relocations that write the symbol VA as
435
- // the addend (e.g. R_MIPS_TLS_TPREL64) but still reference the symbol.
436
- AgainstSymbolWithTargetVA,
437
430
// / This is used by the MIPS multi-GOT implementation. It relocates
438
431
// / addresses of 64kb pages that lie inside the output section.
439
432
MipsMultiGotPage,
440
433
};
441
- // / This constructor records a relocation against a symbol .
434
+ // / This constructor records a normal relocation .
442
435
DynamicReloc (RelType type, const InputSectionBase *inputSec,
443
436
uint64_t offsetInSec, Kind kind, Symbol &sym, int64_t addend,
444
437
RelExpr expr)
@@ -447,8 +440,9 @@ class DynamicReloc {
447
440
// / This constructor records a relative relocation with no symbol.
448
441
DynamicReloc (RelType type, const InputSectionBase *inputSec,
449
442
uint64_t offsetInSec, int64_t addend = 0 )
450
- : sym(nullptr ), inputSec(inputSec), offsetInSec(offsetInSec), type(type),
451
- addend(addend), kind(AddendOnly), expr(R_ADDEND) {}
443
+ : sym(inputSec->getCtx ().dummySym), inputSec(inputSec),
444
+ offsetInSec(offsetInSec), type(type), addend(addend), kind(AddendOnly),
445
+ expr(R_ADDEND) {}
452
446
// / This constructor records dynamic relocation settings used by the MIPS
453
447
// / multi-GOT implementation.
454
448
DynamicReloc (RelType type, const InputSectionBase *inputSec,
@@ -460,9 +454,7 @@ class DynamicReloc {
460
454
461
455
uint64_t getOffset () const ;
462
456
uint32_t getSymIndex (SymbolTableBaseSection *symTab) const ;
463
- bool needsDynSymIndex () const {
464
- return kind == AgainstSymbol || kind == AgainstSymbolWithTargetVA;
465
- }
457
+ bool needsDynSymIndex () const { return kind == AgainstSymbol; }
466
458
467
459
// / Computes the addend of the dynamic relocation. Note that this is not the
468
460
// / same as the #addend member variable as it may also include the symbol
@@ -528,8 +520,8 @@ class RelocationBaseSection : public SyntheticSection {
528
520
uint64_t offsetInSec, Symbol &sym, int64_t addend,
529
521
RelType addendRelType, RelExpr expr) {
530
522
assert (expr != R_ADDEND && " expected non-addend relocation expression" );
531
- addReloc<shard>(DynamicReloc::AddendOnlyWithTargetVA , dynType, isec,
532
- offsetInSec, sym, addend, expr, addendRelType);
523
+ addReloc<shard>(DynamicReloc::AddendOnly , dynType, isec, offsetInSec, sym ,
524
+ addend, expr, addendRelType);
533
525
}
534
526
// / Add a dynamic relocation using the target address of \p sym as the addend
535
527
// / if \p sym is non-preemptible. Otherwise add a relocation against \p sym.
0 commit comments