[PATCH] D28105: [DWARF] - Introduce DWARFCompression class.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 01:26:01 PST 2017


>> +bool Decompressor::isCompressed(const object::SectionRef &Section) {
>> +  StringRef Name;
> +  Section.getName(Name);
>
>Do we get compressed sections on non-elf?
>You should check the error of getName.

isSectionCompressed(DataRefImpl Sec) has logic only for ELF.
Other implementations just returns false.
I do not know if non-elf has compressed sections.

".z" prefix in name was checked for all platforms,
May be we should check isGnuStyle() name only for ELF ?
Like:

 if (Section.isCompressed())
   return true;
 const ObjectFile *Obj = Section.getObject();
 if (!isa<object::ELFObjectFileBase>(Obj))
   return;
 StringRef Name;
  if (std::error_code E = Section.getName(Name))
    return false;
return isGnuStyle(Name);

>> +  return Section.isCompressed() || isGnuStyle(Name);
>> +}
>> +
>> +bool Decompressor::isCompressedELFSection(uint64_t Flags, StringRef Name) {
>> +  return (Flags & ELF::SHF_COMPRESSED) || isGnuStyle(Name);
>> +}
>
>Why do you need a special version for ELF?

I am using this patch in D28106, in LLD.
In LLD we do not have object::SectionRefs, but have flags and section names.

>Cheers,
>Rafael

George.


More information about the llvm-commits mailing list