[ELF] Fix handling of FDE negative relative PC addr
authorAndrew Ng <anng.sw@gmail.com>
Mon, 23 Jul 2018 11:29:46 +0000 (11:29 +0000)
committerAndrew Ng <anng.sw@gmail.com>
Mon, 23 Jul 2018 11:29:46 +0000 (11:29 +0000)
commite33d69199027e68916208bcea4924193b7f88d63
treea2b5a45dd0bf06412a19c79427a75f0e708e46c1
parentfae3f89088b870dec1c39c83634cc27a44822f9a
[ELF] Fix handling of FDE negative relative PC addr

Signed values for the FDE PC addr were not correctly handled in
readFdeAddr(). If the value is negative and the type of the value is
smaller than 64 bits, the FDE PC addr overflow error would be
incorrectly triggered.

Fixed readFdeAddr() to properly handle signed values by sign extending
where appropriate.

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

llvm-svn: 337683
lld/ELF/SyntheticSections.cpp
lld/test/ELF/eh-frame-negative-pcrel-sdata2.s [new file with mode: 0644]
lld/test/ELF/eh-frame-negative-pcrel-sdata4.s [new file with mode: 0644]
lld/test/ELF/eh-frame-negative-pcrel-sdata8.s [new file with mode: 0644]