-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix R_AARCH64_MOVW_UABS_G3 relocation
Summary: The relocation is missing mask so an address that has non-zero bits in 47:43 may overwrite the register number. (Frequently shows up as target register changed to `xzr`....) Reviewers: t.p.northover, lhames Subscribers: davide, aemerson, rengolin, llvm-commits Differential Revision: https://reviews.llvm.org/D27609 llvm-svn: 289880
- Loading branch information
Showing
5 changed files
with
118 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
llvm/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_BE-relocations.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# RUN: llvm-mc -triple=aarch64_be-none-linux-gnu -filetype=obj -o %T/be-reloc.o %s | ||
# RUN: llvm-rtdyld -triple=aarch64_be-none-linux-gnu -verify -dummy-extern f=0x0123456789abcdef -check=%s %T/be-reloc.o | ||
|
||
.text | ||
.globl g | ||
.p2align 2 | ||
.type g,@function | ||
g: | ||
# R_AARCH64_MOVW_UABS_G3 | ||
movz x0, #:abs_g3:f | ||
# R_AARCH64_MOVW_UABS_G2_NC | ||
movk x0, #:abs_g2_nc:f | ||
# R_AARCH64_MOVW_UABS_G1_NC | ||
movk x0, #:abs_g1_nc:f | ||
# R_AARCH64_MOVW_UABS_G0_NC | ||
movk x0, #:abs_g0_nc:f | ||
ret | ||
.Lfunc_end0: | ||
.size g, .Lfunc_end0-g | ||
|
||
.type k,@object | ||
.data | ||
.globl k | ||
.p2align 3 | ||
k: | ||
.xword f | ||
.size k, 8 | ||
|
||
# LE instructions read as BE | ||
# rtdyld-check: *{4}(g) = 0x6024e0d2 | ||
# rtdyld-check: *{4}(g + 4) = 0xe0acc8f2 | ||
# rtdyld-check: *{4}(g + 8) = 0x6035b1f2 | ||
# rtdyld-check: *{4}(g + 12) = 0xe0bd99f2 | ||
# rtdyld-check: *{8}k = f |
33 changes: 33 additions & 0 deletions
33
llvm/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# RUN: llvm-mc -triple=arm64-none-linux-gnu -filetype=obj -o %T/reloc.o %s | ||
# RUN: llvm-rtdyld -triple=arm64-none-linux-gnu -verify -dummy-extern f=0x0123456789abcdef -check=%s %T/reloc.o | ||
|
||
.text | ||
.globl g | ||
.p2align 2 | ||
.type g,@function | ||
g: | ||
# R_AARCH64_MOVW_UABS_G3 | ||
movz x0, #:abs_g3:f | ||
# R_AARCH64_MOVW_UABS_G2_NC | ||
movk x0, #:abs_g2_nc:f | ||
# R_AARCH64_MOVW_UABS_G1_NC | ||
movk x0, #:abs_g1_nc:f | ||
# R_AARCH64_MOVW_UABS_G0_NC | ||
movk x0, #:abs_g0_nc:f | ||
ret | ||
.Lfunc_end0: | ||
.size g, .Lfunc_end0-g | ||
|
||
.type k,@object | ||
.data | ||
.globl k | ||
.p2align 3 | ||
k: | ||
.xword f | ||
.size k, 8 | ||
|
||
# rtdyld-check: *{4}(g) = 0xd2e02460 | ||
# rtdyld-check: *{4}(g + 4) = 0xf2c8ace0 | ||
# rtdyld-check: *{4}(g + 8) = 0xf2b13560 | ||
# rtdyld-check: *{4}(g + 12) = 0xf299bde0 | ||
# rtdyld-check: *{8}k = f |