Revert r362743 "Revert "Revert "Reland D61583 [ELF] Error on relocations to…

Authored by hansw on Jun 25 2019, 7:58 AM.


Revert r362743 "Revert "Revert "Reland D61583 [ELF] Error on relocations to STT_SECTION symbols if the sections were discarded"""

(In effect, reverting "[ELF] Error on relocations to STT_SECTION symbols if the sections were discarded".)

It caused debug info problems in LibreOffice [1] and Chromium/V8 [2].
Reverting until those can be fixed.

It also reverts r362497 "STT_SECTION symbol should be defined" on .eh_frame, .debug*, .zdebug* and .gcc_except_table"
which was landed as a follow-up to the above.

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 (it turned the
error 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.

Delete invalid-undef-section-symbol.test because what it intended to
check is now covered by the updated comdat-discarded-reloc.s

Delete relocatable-eh-frame.s because we allow relocations from
.eh_frame as a special case now.

And finally it reverts r362218 "[ELF] Replace a dead test in getSymVA() with assert()"
as that also depended on the main change reverted here.

Symbols relative to discarded comdat sections are Undefined instead of
Defined now (after D59649 and D61583). The == &InputSection::Discarded
test becomes dead. I cannot find a test related to this behavior.

[1] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190603/659848.html
[2] https://bugs.chromium.org/p/chromium/issues/detail?id=978067

llvm-svn: 364321


hanswJun 25 2019, 7:58 AM
rGe98f8cf78f3b: [SLPVectorizer] Precommit of supernode.ll test for D63661