HomePhabricator

[ELF] Don't shrink RelrSection

Authored by MaskRay on Sep 4 2019, 9:27 AM.

Description

[ELF] Don't shrink RelrSection

Fixes PR43214.

The size of SHT_RELR may oscillate between 2 numbers (see D53003 for a
similar --pack-dyn-relocs=android issue). This can happen if the shrink
of SHT_RELR causes it to take more words to encode relocation offsets
(this can happen with thunks or segments with overlapping p_offset
ranges), and the expansion of SHT_RELR causes it to take fewer words to
encode relocation offsets.

To avoid the issue, add padding 1s to the end of the relocation section
if its size would decrease. Trailing 1s do not decode to more relocations.

Reviewed By: peter.smith

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

llvm-svn: 370923

Details

Committed
MaskRaySep 4 2019, 9:27 AM
Reviewer
peter.smith
Differential Revision
D67164: [ELF] Don't shrink RelrSection
Parents
rG97fd582b9158: [Attributor] Use the white list for attributes consistently
Branches
Unknown
Tags
Unknown