[PATCH] D29637: [LLD][ELF] Use synthetic section to hold copy relocations

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 12:25:41 PST 2017


> +// BSS section created for a copyReloc

s/BSS/NOBITS/

> +template <class ELFT>
> +class CopyRelSection final : public SyntheticSection<ELFT> {
> +  typedef typename ELFT::uint uintX_t;
> +
> +public:
> +  CopyRelSection(bool ReadOnly, uintX_t AddrAlign, size_t Size);
> +  void writeTo(uint8_t *) {}

writeTo should have an override, no?

> +  size_t getSize() const override { return Size; }
> +  size_t Size;
> +};


> +  // Create a SyntheticSection in CopySec to hold the .bss and the Copy Reloc
> +  auto *CopyISec = make<CopyRelSection<ELFT>>(IsReadOnly, Alignment, SymSize);
> +  CopyISec->OutSecOff = Off;
> +  CopyISec->OutSec = CopySec;
> +  CopySec->Sections.push_back(CopyISec);

Do we really need to create one input section per copy relocation? We
should only need one RO and RW, no? The symbol offset can then be change
to be the offset in the synthetic section.

This looks an improvement overall!

Cheers,
Rafael


More information about the llvm-commits mailing list