[llvm-strip] Allow copying relocation sections without symbol tables.
authorJordan Rupprecht <rupprecht@google.com>
Tue, 4 Sep 2018 22:28:49 +0000 (22:28 +0000)
committerJordan Rupprecht <rupprecht@google.com>
Tue, 4 Sep 2018 22:28:49 +0000 (22:28 +0000)
commitec277a827815015e516ea08d79bbd4c64259c3d1
tree5a7b0b395611a8c7d89b446909b62f4f9aa81bbe
parent034423377cf8ef69ff248b69b4487b0b7b00ab81
[llvm-strip] Allow copying relocation sections without symbol tables.

Summary:
Fixes the error "Link field value 0 in section .rela.plt is invalid" when copying/stripping certain binaries. Minimal repro:

```
$ cat /tmp/a.c
int main() { return 0; }
$ clang -static /tmp/a.c -o /tmp/a
$ llvm-strip /tmp/a -o /tmp/b
llvm-strip: error: Link field value 0 in section .rela.plt is invalid.
```

Reviewers: jakehehrlich, alexshap

Subscribers: llvm-commits

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

llvm-svn: 341419
llvm/test/tools/llvm-objcopy/reloc-no-symtab.test [new file with mode: 0644]
llvm/tools/llvm-objcopy/Object.cpp