With -r or --emit-relocs, we warn STT_SECTION symbol should be defined
on relocations to discarded section symbol. This was added as an error
in rLLD319404, but was not so effective before D61583 (turned to a
warning).
Relocations from .eh_frame .debug* .zdebug* .gcc_except_table to
discarded .text are very common and somewhat expected. Don't warn/error
on them. As a reference, ld.bfd has a similar logic in
_bfd_elf_default_action_discarded() to allow these cases.
invalid-undef-section-symbol.test can be deleted as what it intended to
check is now covered by the updated comdat-discarded-reloc.s
There is a newline in a little bit weird place. Is this what clang-format formatted?
Maybe you should write this using two assignments rather than writing it as a single line.