llvm.org GIT mirror llvm / 26d9773
Revert "Revert "ExecutionEngine: add R_AARCH64_ABS{16,32}"" This reverts commit SVN r313668. The original test case attempted to write a pointer value into 16-bits, although the value may exceed the range representable in 16-bits. Ensure that the symbol is located in the address space such that its absolute address is representable in 16-bits. This should fix the assertion failure that was seen on the Windows hosts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313822 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 3 years ago
2 changed file(s) with 25 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
353353 default:
354354 llvm_unreachable("Relocation type not implemented yet!");
355355 break;
356 case ELF::R_AARCH64_ABS16: {
357 uint64_t Result = Value + Addend;
358 assert(static_cast(Result) >= INT16_MIN && Result < UINT16_MAX);
359 write(isBE, TargetPtr, static_cast(Result & 0xffffU));
360 break;
361 }
362 case ELF::R_AARCH64_ABS32: {
363 uint64_t Result = Value + Addend;
364 assert(static_cast(Result) >= INT32_MIN && Result < UINT32_MAX);
365 write(isBE, TargetPtr, static_cast(Result & 0xffffffffU));
366 break;
367 }
356368 case ELF::R_AARCH64_ABS64:
357369 write(isBE, TargetPtr, Value + Addend);
358370 break;
0 # RUN: llvm-mc -triple=arm64-none-linux-gnu -filetype=obj -o %t %s
1 # RUN: llvm-rtdyld -triple=arm64-none-linux-gnu -verify -dummy-extern f=0x0123456789abcdef -check=%s %t
2
1 # RUN: llvm-rtdyld -triple=arm64-none-linux-gnu -verify -dummy-extern f=0x0123456789abcdef -dummy-extern symbol=0xf00f -check=%s %t
2
33 .globl Q
44 .section .dummy, "ax"
55 Q:
8181 ## f & 0xFFF = 0xdef (bits 11:0 of f)
8282 ## 0xdef << 10 = 0x37bc00
8383 # rtdyld-check: *{4}(a) = 0x9137bc00
84
85 .data
86 ABS16:
87 .short symbol
88 # rtdyld-check: (*{2}ABS16) = symbol[15:0]
89 ABS32:
90 .long symbol
91 # rtdyld-check: (*{4}ABS32) = symbol[31:0]
92 ABS64:
93 .xword symbol
94 # rtdyld-check: (*{8}ABS64) = symbol