-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ARM] Clear the constant pool cache on explicit .ltorg directives
Multiple ldr pseudoinstructions with the same constant value will reuse the same constant pool entry. However, if the constant pool is explicitly flushed with a .ltorg directive, we should not try to reference constants in the previous pool any longer, since they may be out of range. This fixes assembling hand-written assembler source which repeatedly loads the same constant value, across a binary size larger than the pc-relative fixup range for ldr instructions (4096 bytes). Such assembler source already uses explicit .ltorg instructions to emit constant pools with regular intervals. However if we try to reuse constants emitted in earlier pools, they end up out of range. This makes the output of the testcase match what binutils gas does (prior to this patch, it would fail to assemble). Differential Revision: https://reviews.llvm.org/D32847 llvm-svn: 302416
- Loading branch information
Showing
4 changed files
with
42 additions
and
0 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
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,27 @@ | ||
@ RUN: llvm-mc -triple armv7-unknown-linux-gnueabi -filetype obj -o - %s \ | ||
@ RUN: | llvm-objdump -d - | FileCheck %s | ||
|
||
ldr r0, =0x01020304 | ||
@ CHECK: ldr | ||
.ltorg | ||
@ CHECK: 0x01020304 | ||
ldr r0, =0x01020304 | ||
ldr r0, =0x01020304 | ||
ldr r0, =0x01020304 | ||
@ CHECK: ldr | ||
@ CHECK: ldr | ||
@ CHECK: ldr | ||
.ltorg | ||
@ CHECK: 0x01020304 | ||
.rep 1028 | ||
.word 0 | ||
.endr | ||
@ CHECK: 0x00000000 | ||
|
||
ldr r0, =0x01020304 | ||
@ CHECK: ldr | ||
.ltorg | ||
@ CHECK: 0x01020304 | ||
.rep 1028 | ||
.word 0 | ||
.endr |