[PATCH] D80765: [ELF] Handle bitcode comdat groups separately to deduplicate thinlto comdat sections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 24 10:15:42 PDT 2020


MaskRay added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:611
+      // Else, check all comdat groups.
+      bool isNew = isLTOOutput
+                       ? symtab->ltoOutputComdatGroups
----------------
christylee wrote:
> @MaskRay 
> >  Since .debug_types (notably, a non-SHF_ALLOC section) is the only COMDAT rule this patch will discard, how about special casing .debug_types (i.e. if isLTOOutput && the group is related to .debug_types)?
> 
> At the time we run this check, not all InputSections have been initialized, so a the group might be related to an uninitialized section.  Since it might be uninitialized, what's the best way to check if that section is non-SHF_ALLOC?
This is difficult. An alternative is to use ltoOutputComdatGroups but assert that no collision happens

```
if (isLTOOutput) {
  CachedHashStringRef ref(signature);
  isNew = symtab->ltoOutputComdatGroups.try_emplace(ref, this).second);
  if (symtab->comdatGroups.coumt(ref))
    errorOrWarn(toString(this) + ": LTO output should not emit a section group whose signature collides with a non-LTO group signature");
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80765/new/

https://reviews.llvm.org/D80765





More information about the llvm-commits mailing list