[all-commits] [llvm/llvm-project] 88d66f: [ELF] Move duplicate symbol check after input file...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Feb 22 10:08:11 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 88d66f6ed1e5a3a9370a3181b7307fe65590e3ac
      https://github.com/llvm/llvm-project/commit/88d66f6ed1e5a3a9370a3181b7307fe65590e3ac
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-02-22 (Tue, 22 Feb 2022)

  Changed paths:
    M lld/ELF/Driver.cpp
    M lld/ELF/InputFiles.cpp
    M lld/ELF/InputFiles.h
    M lld/ELF/SymbolTable.cpp
    M lld/ELF/SymbolTable.h
    M lld/ELF/Symbols.cpp
    M lld/ELF/Symbols.h
    M lld/test/ELF/invalid/symtab-sh-info-dup.test
    M lld/test/ELF/lto/duplicated.ll
    M lld/test/ELF/vs-diagnostics-duplicate.s

  Log Message:
  -----------
  [ELF] Move duplicate symbol check after input file parsing

https://discourse.llvm.org/t/parallel-input-file-parsing/60164

To decouple symbol initialization and section initialization, `Defined::section`
assignment should be postponed after input file parsing. To avoid spurious
duplicate definition error due to two definitions in COMDAT groups of the same
signature, we should postpone the duplicate symbol check.

The function is called postScan instead of a more specific name like
checkDuplicateSymbols, because we may merge Symbol::mergeProperties into
postScan. It is placed after compileBitcodeFiles to apply to ET_REL files
produced by LTO. This causes minor diagnostic regression
for skipLinkedOutput configurations: ld.lld --thinlto-index-only a.bc b.o
(bitcode definition prevails) won't detect duplicate symbol error. I think this
is an acceptable compromise. The important cases where (a) both files are
bitcode or (b) --thinlto-index-only is unused are still detected.

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D119908




More information about the All-commits mailing list