[ELF] --orphan-handling=: don't warn/error for unused synthesized sections
authorFangrui Song <maskray@google.com>
Tue, 25 Feb 2020 23:02:04 +0000 (15:02 -0800)
committerFangrui Song <maskray@google.com>
Wed, 26 Feb 2020 16:56:12 +0000 (08:56 -0800)
commit423194098b88dfea86cca6f8e203e9d88f70abc9
tree8e7518ad4286f8d4972a12892b5554ed6ce53424
parent2011d14296eeaae911e898d11154ee5d1a5db1d6
[ELF] --orphan-handling=: don't warn/error for unused synthesized sections

This makes --orphan-handling= less noisy.
This change also improves our compatibility with GNU ld.

GNU ld special cases .symtab, .strtab and .shstrtab . We need output section
descriptions for .symtab, .strtab and .shstrtab to suppress:

  <internal>:(.symtab) is being placed in '.symtab'
  <internal>:(.shstrtab) is being placed in '.shstrtab'
  <internal>:(.strtab) is being placed in '.strtab'

With --strip-all, .symtab and .strtab can be omitted (note, --strip-all is not compatible with --emit-relocs).

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D75149
lld/ELF/LinkerScript.cpp
lld/ELF/LinkerScript.h
lld/ELF/Writer.cpp
lld/test/ELF/linkerscript/orphan-report.s