Relax relocation type checking in a non-ALLOC section.
authorRui Ueyama <ruiu@google.com>
Fri, 16 Feb 2018 01:10:51 +0000 (01:10 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 16 Feb 2018 01:10:51 +0000 (01:10 +0000)
commit65b620be8a63c8dee5225562a43c6dfc827394a7
tree94a131817f542bc3ec34f96ad6d452daf92046e7
parentda9c122203ee41d66979e906cea81c9ddbd1cfdc
Relax relocation type checking in a non-ALLOC section.

Even though it doesn't make sense, there seems to be multiple programs
in the wild that create PC-relative relocations in non-ALLOC sections.
I believe this is caused by the negligence of GNU linkers to not report
any errors for such relocations.

Currently, lld emits warnings against such relocations and exits.
So, you cannot link any program that contains wrong relocations until
you fix an issue in a program that generates wrong ELF files. It's often
impractical to fix a program because it's not always easy.

This patch relaxes the error checking and emit a warning instead.

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

llvm-svn: 325307
lld/ELF/InputSection.cpp
lld/test/ELF/i386-debug-noabs.test
lld/test/ELF/non-abs-reloc.s