[llvm-objcopy] - Fix --compress-debug-sections when there are relocations.
authorGeorge Rimar <grimar@accesssoftek.com>
Mon, 11 Mar 2019 11:01:24 +0000 (11:01 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Mon, 11 Mar 2019 11:01:24 +0000 (11:01 +0000)
commitd8a5c6cf19e7245f0c9d076831ebeabc29d6e174
tree66eb332dd8cc66dd93de98f26e631affdaf6615e
parenta7cdfd9cb5643b15fcbd885aa73e5c304ffff91b
[llvm-objcopy] - Fix --compress-debug-sections when there are relocations.

When --compress-debug-sections is given,
llvm-objcopy removes the uncompressed sections and adds compressed to the section list.
This makes all the pointers to old sections to be outdated.

Currently, code already has logic for replacing the target sections of the relocation
sections. But we also have to update the relocations by themselves.

This fixes https://bugs.llvm.org/show_bug.cgi?id=40885.

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

llvm-svn: 355821
llvm/test/tools/llvm-objcopy/ELF/Inputs/compress-debug-sections.yaml
llvm/test/tools/llvm-objcopy/ELF/compress-debug-sections-zlib-gnu.test
llvm/test/tools/llvm-objcopy/ELF/compress-debug-sections-zlib.test
llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
llvm/tools/llvm-objcopy/ELF/Object.cpp
llvm/tools/llvm-objcopy/ELF/Object.h