[llvm-readobj/elf] - Fix the PREL31 relocation computation used for dumping arm32...
authorGeorgii Rymar <grimar@accesssoftek.com>
Mon, 28 Sep 2020 11:43:19 +0000 (14:43 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Mon, 28 Sep 2020 13:22:56 +0000 (16:22 +0300)
commit4ba00619ee70be6eda1d6fbd37471636145d1140
treeb25a4f991fbd92a4240b3711015cf139ee6960c1
parentfdfe324da195ebd9b9c691f006b0d6ccc64365e1
[llvm-readobj/elf] - Fix the PREL31 relocation computation used for dumping arm32 unwind info (-u).

This is a part of https://bugs.llvm.org/show_bug.cgi?id=47581.

We have the following computation:
```
(1) uint64_t Location = Address & 0x7fffffff;
(2) if (Location & 0x04000000)
(3)   Location |= (uint64_t) ~0x7fffffff;
(4) return Location + Place;
```

At line 2 there is a mistype. The constant should be `0x40000000`,
not `0x04000000`, because the intention here is to sign extend the `Location`,
which is the 31 bit signed value.

Differential revision: https://reviews.llvm.org/D88407
llvm/test/tools/llvm-readobj/ELF/ARM/unwind-non-relocatable.test
llvm/tools/llvm-readobj/ARMEHABIPrinter.h