OSDN Git Service

[llvm-objcopy] - Check dynamic relocation sections for broken references.
authorGeorge Rimar <grimar@accesssoftek.com>
Tue, 30 Apr 2019 11:02:09 +0000 (11:02 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Tue, 30 Apr 2019 11:02:09 +0000 (11:02 +0000)
commitb9ccf789ff08821252e1c0e38fed023419537f38
treeb28d17c2fb0f18f5910dab5e3657905835284071
parenta9a1e42b67947492c31dfc31366c2e317f003ebf
[llvm-objcopy] - Check dynamic relocation sections for broken references.

This is a fix for https://bugs.llvm.org/show_bug.cgi?id=41371.

Currently, it is possible to break the sh_link field of the dynamic relocation section
by removing the section it refers to. The patch fixes an issue and adds 2 test cases.

One of them shows that it does not seem possible to break the sh_info field.
I added an assert to verify this.

Differential revision: https://reviews.llvm.org/D60825

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359552 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shinfo-reference.test [new file with mode: 0644]
test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shlink-reference.test [new file with mode: 0644]
tools/llvm-objcopy/ELF/Object.cpp
tools/llvm-objcopy/ELF/Object.h