[ELF2/AArch64] Read the right amount of bytes.
This was clearly wrong (thanks Rui for spotting), and I honestly would like to get this tested so such mistakes won't repeat. Unfortunately, I wasn't (easily) able to craft a test that exposes the bad behavior. Ideally, we would like to get tests of this kind for all relocations, but at the time of writing, this is not true. So, for now just fix this bug and try to re-evaluate a way to test this in the future. llvm-svn: 249359
This commit is contained in:
parent
e16edb554f
commit
b4606e183e
|
@ -286,7 +286,7 @@ static void handle_ABS16(uint8_t *Location, uint64_t S, int64_t A) {
|
|||
uint64_t X = S + A;
|
||||
if (!isInt<16>(X)) // -2^15 <= X < 2^16
|
||||
error("Relocation R_AARCH64_ABS16 out of range");
|
||||
write16le(Location, read32le(Location) | X);
|
||||
write16le(Location, read16le(Location) | X);
|
||||
}
|
||||
|
||||
static void handle_ABS32(uint8_t *Location, uint64_t S, int64_t A) {
|
||||
|
@ -299,7 +299,7 @@ static void handle_ABS32(uint8_t *Location, uint64_t S, int64_t A) {
|
|||
static void handle_ABS64(uint8_t *Location, uint64_t S, int64_t A) {
|
||||
uint64_t X = S + A;
|
||||
// No overflow check.
|
||||
write64le(Location, read32le(Location) | X);
|
||||
write64le(Location, read64le(Location) | X);
|
||||
}
|
||||
|
||||
static void handle_ADD_ABS_LO12_NC(uint8_t *Location, uint64_t S, int64_t A) {
|
||||
|
|
Loading…
Reference in New Issue