[LLVMdev] [lld] consolidating the usage of saving references

Rui Ueyama ruiu at google.com
Sun Nov 10 21:06:02 PST 2013


Look at COFFBaseDefinedAtom in lib/ReaderWriter/PECOFF/Atoms.h for PE/COFF.
Specifically, these functions and a field are for References.

  void addReference(std::unique_ptr<COFFReference> reference);
  virtual reference_iterator begin() const;
  virtual reference_iterator end() const;
  virtual const Reference *derefIterator(const void *iter) const;
  virtual void incrementIterator(const void *&iter) const;
  std::vector<std::unique_ptr<COFFReference>> _references;

As you can see References are stored into a single vector already. We don't
have anything similar to reference{Start,End}Index because we have never
needed it. Iterator knows where it is pointing to, so I don't see any
reason why DefiendAtom have to know it separately. What is the use case of
the fields in ELF?


On Sun, Nov 10, 2013 at 7:10 PM, Shankar Easwaran
<shankare at codeaurora.org>wrote:

> Hi,
>
> It looks like each flavor chooses to save references in its own way.
>
> The GNU flavor (ELF) uses a single vector of references and uses
> referenceStartIndex/referenceEndIndex to point to the references for each
> DefinedAtom.
>
> Darwin(Mach-O) / WinLink (PECOFF) uses a different way of storing
> references ?
>
> Is there a plan to make the WinLink/Darwin(Mach-O) use a single vector of
> references too at some point in time.
>
> There are merits/demerits of the approach that the Gnu flavor uses but it
> would be nice if we settle on one design for storing references.
>
> Thanks
>
> Shankar Easwaran
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by the Linux Foundation
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131110/5599f149/attachment.html>


More information about the llvm-dev mailing list