[PATCH] D46502: [ELF] - Fix for "LLD can create incorrect debug PC ranges for functions in Comdat groups."

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 12 00:46:25 PDT 2018


grimar added a comment.

In https://reviews.llvm.org/D46502#1096122, @ruiu wrote:

> I'd agree that there might be some alternative way of doing this. I thought that, if there's some way to obtain a replacing comdat section from here
>
> https://github.com/llvm-project/llvm-project-20170507/blob/master/lld/ELF/Symbols.cpp#L54
>
> then we can get an address for a replaced comdat section which might solve the issue. But with the data structure it doesn't seem to be easy thing to do (and that's not lld's fault as it is for a compiler bug workaround).


Yes. And this place is probably hot as it is called for each relocation. That is why I ended with proxy object finally. We could add one more light base section probably.
Without adding the one more explicit section type. Something like:

  class SectionBase;
  
  class SectionProxy {
  public:
    // <new comment>
    SectionBase *Repl;
  
    unsigned SectionKind : 3;
  
    // The next two bit fields are only used by InputSectionBase, but we
    // put them here so the struct packs better.
  
    // The garbage collector sets sections' Live bits.
    // If GC is disabled, all sections are considered live by default.
    unsigned Live : 1;
  
    unsigned Bss : 1;
  
    unsigned Proxy : 1;
  }
  
  
  class SectionBase : public SectionProxy  { ...

So creating many proxy sections would be much cheaper. I am not sure if such approach for that is OK though.


https://reviews.llvm.org/D46502





More information about the llvm-commits mailing list