[PATCH] D35005: [ELF] - Do not apply relocations to .debug_ranges when building -gdb-index
    George Rimar via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Jul  6 04:03:29 PDT 2017
    
    
  
>> +  ObjectInfo(const object::ObjectFile &Obj)
>> +      : ElfObj(cast<ELFObjectFile<ELFT>>(Obj)) {}
>> +
>> +  bool relocate(const object::SectionRef &RelSec,
>> +                RelocAddrMap *Map) const override {
>> +    StringRef S;
>> +    if (std::error_code EC = RelSec.getName(S))
>> +      return false;
>
>Should we really just eat this error?
I was wondering what we should do here. At fact DWARF parsers already
called getName() for this section before doing this call. Parsers do not check result
though. 
(https://github.com/llvm-mirror/llvm/blob/master/lib/DebugInfo/DWARF/DWARFContext.cpp#L994)
I was not sure - can we remove error handling at all here and assume SectionRef
is always correct ? And check this error on parser side instead.
>> +    if (S == ".rela.debug_ranges" || S == ".rel.debug_ranges")
>> +      return relocateDebugRanges(RelSec, Map);
>> +    return false;
>> +  }
>
>Please expand the description. It looks like you relocate *only*
>.debug_ranges, no?
I am relocating only .debug_ranges on LLD side, all other debug sections
are still relocated on parsers side. I'll add the comment.
Cheers,
Rafael
    
    
More information about the llvm-commits
mailing list