Commit a62b86a
authored
[AArch64,ELF] Restrict MOVZ/MOVK to non-PIC large code model (#70178)
There is no PIC support for -mcmodel=large
(https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst)
and Clang recently rejects -mcmodel= with PIC (#70262).
The current backend code assumes that the large code model is non-PIC.
This patch adds `!getTargetMachine().isPositionIndependent()` conditions
to clarify that the support is non-PIC only. In addition, add some tests
as change detectors in case PIC large code model is supported in the
future.
If other front-ends/JITs use the large code model with PIC, they will
get small code model code sequence, instead of potentially-incorrect
MOVZ/MOVK sequence, which is only suitable for non-PIC. The sequence
will cause text relocations using ELF linkers.
(The small code model code sequence is usually sufficient as ADRP+ADD or
ADRP+LDR targets [-2**32,2**32), which has a doubled range of x86-64
R_X86_64_REX_GOTPCRELX/R_X86_64_PC32 [-2**32,2**32).)1 parent 442da60 commit a62b86a
File tree
9 files changed
+234
-120
lines changed- llvm
- lib/Target/AArch64
- GISel
- test/CodeGen/AArch64
- GlobalISel
9 files changed
+234
-120
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8203 | 8203 | | |
8204 | 8204 | | |
8205 | 8205 | | |
8206 | | - | |
| 8206 | + | |
| 8207 | + | |
8207 | 8208 | | |
8208 | 8209 | | |
8209 | 8210 | | |
| |||
9568 | 9569 | | |
9569 | 9570 | | |
9570 | 9571 | | |
9571 | | - | |
9572 | | - | |
| 9572 | + | |
| 9573 | + | |
| 9574 | + | |
9573 | 9575 | | |
9574 | | - | |
| 9576 | + | |
9575 | 9577 | | |
9576 | | - | |
9577 | 9578 | | |
9578 | 9579 | | |
9579 | 9580 | | |
| |||
9599 | 9600 | | |
9600 | 9601 | | |
9601 | 9602 | | |
9602 | | - | |
9603 | | - | |
| 9603 | + | |
| 9604 | + | |
9604 | 9605 | | |
9605 | 9606 | | |
9606 | 9607 | | |
9607 | 9608 | | |
9608 | | - | |
9609 | | - | |
| 9609 | + | |
| 9610 | + | |
| 9611 | + | |
9610 | 9612 | | |
9611 | | - | |
9612 | | - | |
9613 | 9613 | | |
| 9614 | + | |
9614 | 9615 | | |
9615 | 9616 | | |
9616 | 9617 | | |
9617 | 9618 | | |
9618 | 9619 | | |
9619 | | - | |
9620 | | - | |
9621 | | - | |
9622 | | - | |
| 9620 | + | |
| 9621 | + | |
| 9622 | + | |
| 9623 | + | |
| 9624 | + | |
9623 | 9625 | | |
9624 | 9626 | | |
9625 | 9627 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2849 | 2849 | | |
2850 | 2850 | | |
2851 | 2851 | | |
2852 | | - | |
| 2852 | + | |
| 2853 | + | |
2853 | 2854 | | |
2854 | 2855 | | |
2855 | 2856 | | |
| |||
3502 | 3503 | | |
3503 | 3504 | | |
3504 | 3505 | | |
3505 | | - | |
| 3506 | + | |
3506 | 3507 | | |
3507 | 3508 | | |
3508 | 3509 | | |
| |||
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
54 | 65 | | |
55 | 66 | | |
56 | 67 | | |
| |||
Lines changed: 31 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
49 | 62 | | |
50 | 63 | | |
51 | 64 | | |
| |||
Lines changed: 25 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
26 | 36 | | |
27 | 37 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
31 | 43 | | |
32 | 44 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
36 | 49 | | |
37 | 50 | | |
38 | 51 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
This file was deleted.
0 commit comments