-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm][MC][ARM] Don't autoresolve fixups #76574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bcdfa80
d331b07
0048c1f
57c39d7
2a20e1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@ RUN: not llvm-mc -filetype=obj --defsym=ERR=1 -o /dev/null %s 2>&1 -triple=thumbv7 | FileCheck %s --check-prefix=ERR | ||
@ RUN: not llvm-mc -filetype=obj --defsym=ERR=1 -o /dev/null %s 2>&1 -triple=thumbebv7 | FileCheck %s --check-prefix=ERR | ||
@ RUN: llvm-mc -filetype=obj -triple=armv7 %s -o %t | ||
@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=ARM | ||
@ RUN: llvm-objdump -d --triple=armv7 %t | FileCheck %s --check-prefix=ARM_ADDEND | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is another way to do it but is it really better? I think using Filecheck can easily get confusing, so matching two simple strings seems like a better idea, in general, compared to matching one more complicated one (especially since the tools' output is in flux and we don't want big parts of tests suddenly failing because of a change in the output format of a tool). I copied that idea from other Arm assembly tests in there. |
||
@ RUN: llvm-mc -filetype=obj -triple=armebv7 %s -o %t | ||
@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=ARM | ||
@ RUN: llvm-objdump -d --triple=armebv7 %t | FileCheck %s --check-prefix=ARM_ADDEND | ||
|
||
.section .text.bar, "ax" | ||
.balign 4 | ||
.global bar | ||
.type bar, %function | ||
|
||
bar: | ||
ldrd r0, r1, foo1 @ arm_pcrel_10_unscaled | ||
ldrd r0, r1, foo2-8 @ arm_pcrel_10_unscaled | ||
.ifdef ERR | ||
@ ERR:[[#@LINE-3]]:5: error: unsupported relocation type | ||
@ ERR:[[#@LINE-3]]:5: error: unsupported relocation type | ||
.endif | ||
bx lr | ||
|
||
.section .data.foo, "a", %progbits | ||
.balign 4 | ||
.global foo1 | ||
.global foo2 | ||
foo1: | ||
.word 0x11223344, 0x55667788 | ||
foo2: | ||
.word 0x99aabbcc, 0xddeeff00 | ||
|
||
@ ARM: R_ARM_LDRS_PC_G0 | ||
|
||
@ ARM_ADDEND: ldrd r0, r1, [pc, #-8] | ||
@ ARM_ADDEND: ldrd r0, r1, [pc, #-16] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@ RUN: llvm-mc -filetype=obj -o %t %s -triple=armv7 | ||
@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=RELOC | ||
@ RUN: llvm-objdump -d --triple=armv7 %t | FileCheck %s --check-prefix=ARM_OFFSET | ||
|
||
@ RUN: llvm-mc -filetype=obj -o %t %s -triple=armebv7 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it need to be replicated for {arm,thunb}x{le,be}? Testing (arm,le) + (thumb,be) may suffice, if you think thumb is worth separate testing (in some cases it's not). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it hurts. When/if these start failing it might be helpful with debug. Internally all these 4 go through different logic to resolve the fixup. Arm/Thumb have separate fixup kinds and and BE/LE have different way of assigning FixupKindInfo in |
||
@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=RELOC | ||
@ RUN: llvm-objdump -d --triple=armebv7 %t | FileCheck %s --check-prefix=ARM_OFFSET | ||
|
||
@ RUN: llvm-mc -filetype=obj -o %t %s -triple=thumbv7 | ||
@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=RELOC | ||
@ RUN: llvm-objdump -d --triple=thumbv7 %t | FileCheck %s --check-prefix=THUMB_OFFSET | ||
|
||
@ RUN: llvm-mc -filetype=obj -o %y %s -triple=thumbebv7 | ||
@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=RELOC | ||
@ RUN: llvm-objdump -d --triple=thumbebv7 %t | FileCheck %s --check-prefix=THUMB_OFFSET | ||
|
||
baz: | ||
.word 0x11223344, 0x55667788 | ||
label: | ||
|
||
ldrd r0, r1, foo @ arm_pcrel_10_unscaled / t2_pcrel_10 | ||
ldrd r0, r1, bar-8 @ arm_pcrel_10_unscaled / t2_pcrel_10 | ||
|
||
ldrd r0, r1, baz @ arm_pcrel_10_unscaled / t2_pcrel_10 | ||
ldrd r0, r1, label-8 @ arm_pcrel_10_unscaled / t2_pcrel_10 | ||
foo: | ||
.word 0x11223344, 0x55667788 | ||
bar: | ||
|
||
@ RELOC: There are no relocations in this file. | ||
|
||
@ ARM_OFFSET: ldrd r0, r1, [pc, #8] @ 0x18 <foo> | ||
@ ARM_OFFSET: ldrd r0, r1, [pc, #4] @ 0x18 <foo> | ||
@ ARM_OFFSET: ldrd r0, r1, [pc, #-24] @ 0x0 <baz> | ||
@ ARM_OFFSET: ldrd r0, r1, [pc, #-28] @ 0x0 <baz> | ||
@ THUMB_OFFSET: ldrd r0, r1, [pc, #12] @ 0x18 <foo> | ||
@ THUMB_OFFSET: ldrd r0, r1, [pc, #8] @ 0x18 <foo> | ||
@ THUMB_OFFSET: ldrd r0, r1, [pc, #-20] @ 0x0 <baz> | ||
@ THUMB_OFFSET: ldrd r0, r1, [pc, #-24] @ 0x0 <baz> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@ RUN: not llvm-mc -filetype=obj -o /dev/null %s 2>&1 -triple=armv8.2a-eabi | FileCheck %s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same-section and diff-section tests can be in one file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would you put them in the same test? Vldr_same/diff_section.s have slightly different code, one compiles, the other one doesn't. If I merge them it will fail as a whole. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As for the "unrelated details", I think you're referring to the checks of the addend values? And/or the symbol+imm checks? We've done something similar in all the tests related to pcrel relocations. It was recommended to me as a good extra check by @smithp35 . Here I just added a few more because we had a discussion on another review about whether an issue could be related to a pcrel instruction referring to a symbol before it rather than after. It wasn't but still I covered both cases from then on as to make it clearer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking of unnecessary instructions. It seems that the latest patch removed them. Thanks |
||
@ RUN: not llvm-mc -filetype=obj -o /dev/null %s 2>&1 -triple=armebv8.2a-eabi | FileCheck %s | ||
@ RUN: not llvm-mc -filetype=obj -o /dev/null %s 2>&1 -triple=thumbv8.2a-eabi | FileCheck %s | ||
@ RUN: not llvm-mc -filetype=obj -o /dev/null %s 2>&1 -triple=thumbebv8.2a-eabi | FileCheck %s | ||
|
||
.arch_extension fp16 | ||
|
||
vldr s0, foo @ arm_pcrel_10 / t2_pcrel_10 | ||
vldr d0, foo @ arm_pcrel_10 / t2_pcrel_10 | ||
vldr.16 s0,foo @ arm_pcrel_9 / t2_pcrel_9 | ||
|
||
@ CHECK: :[[#@LINE-4]]:1: error: unsupported relocation type | ||
@ CHECK: :[[#@LINE-4]]:1: error: unsupported relocation type | ||
@ CHECK: :[[#@LINE-4]]:1: error: unsupported relocation type |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
@ RUN: llvm-mc -filetype=obj -o %t %s -triple=armv8.2a-eabi | ||
@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=RELOC | ||
@ RUN: llvm-objdump -d --triple=armv8.2a-eabi --mattr=+fullfp16 %t | FileCheck %s --check-prefix=ARM_OFFSET | ||
@ RUN: llvm-mc -filetype=obj -o %t %s -triple=armebv8.2a-eabi | ||
@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=RELOC | ||
@ RUN: llvm-objdump -d --triple=armebv8.2a-eabi --mattr=+fullfp16 %t | FileCheck %s --check-prefix=ARM_OFFSET | ||
@ RUN: llvm-mc -filetype=obj -o %t %s -triple=thumbv8.2a-eabi | ||
@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=RELOC | ||
@ RUN: llvm-objdump -d --triple=thumbv8.2a-eabi --mattr=+fullfp16 %t | FileCheck %s --check-prefix=THUMB_OFFSET | ||
@ RUN: llvm-mc -filetype=obj -o %y %s -triple=thumbebv8.2a-eabi | ||
@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=RELOC | ||
@ RUN: llvm-objdump -d --triple=thumbebv8.2a-eabi --mattr=+fullfp16 %t | FileCheck %s --check-prefix=THUMB_OFFSET | ||
|
||
.arch_extension fp16 | ||
baz: | ||
.word 0x11223344, 0x55667788 | ||
label: | ||
|
||
vldr s0, foo @ arm_pcrel_10 / t2_pcrel_10 | ||
vldr d0, foo @ arm_pcrel_10 / t2_pcrel_10 | ||
vldr.16 s0, foo @ arm_pcrel_9 / t2_pcrel_9 | ||
vldr s0, bar-8 | ||
vldr d0, bar-8 | ||
vldr.16 s0, bar-8 | ||
vldr s0, baz | ||
vldr d0, baz | ||
vldr.16 s0, baz | ||
vldr s0, label-8 | ||
vldr d0, label-8 | ||
vldr.16 s0, label-8 | ||
|
||
foo: | ||
.word 0x11223344, 0x55667788 | ||
bar: | ||
|
||
@ RELOC: There are no relocations in this file. | ||
|
||
@ ARM_OFFSET: vldr s0, [pc, #40] @ 0x38 <foo> | ||
@ ARM_OFFSET: vldr d0, [pc, #36] @ 0x38 <foo> | ||
@ ARM_OFFSET: vldr.16 s0, [pc, #32] @ 0x38 <foo> | ||
@ ARM_OFFSET: vldr s0, [pc, #28] @ 0x38 <foo> | ||
@ ARM_OFFSET: vldr d0, [pc, #24] @ 0x38 <foo> | ||
@ ARM_OFFSET: vldr.16 s0, [pc, #20] @ 0x38 <foo> | ||
@ ARM_OFFSET: vldr s0, [pc, #-40] @ 0x0 <baz> | ||
@ ARM_OFFSET: vldr d0, [pc, #-44] @ 0x0 <baz> | ||
@ ARM_OFFSET: vldr.16 s0, [pc, #-48] @ 0x0 <baz> | ||
@ ARM_OFFSET: vldr s0, [pc, #-52] @ 0x0 <baz> | ||
@ ARM_OFFSET: vldr d0, [pc, #-56] @ 0x0 <baz> | ||
@ ARM_OFFSET: vldr.16 s0, [pc, #-60] @ 0x0 <baz> | ||
@ THUMB_OFFSET: vldr s0, [pc, #44] @ 0x38 <foo> | ||
@ THUMB_OFFSET: vldr d0, [pc, #40] @ 0x38 <foo> | ||
@ THUMB_OFFSET: vldr.16 s0, [pc, #36] @ 0x38 <foo> | ||
@ THUMB_OFFSET: vldr s0, [pc, #32] @ 0x38 <foo> | ||
@ THUMB_OFFSET: vldr d0, [pc, #28] @ 0x38 <foo> | ||
@ THUMB_OFFSET: vldr.16 s0, [pc, #24] @ 0x38 <foo> | ||
@ THUMB_OFFSET: vldr s0, [pc, #-36] @ 0x0 <baz> | ||
@ THUMB_OFFSET: vldr d0, [pc, #-40] @ 0x0 <baz> | ||
@ THUMB_OFFSET: vldr.16 s0, [pc, #-44] @ 0x0 <baz> | ||
@ THUMB_OFFSET: vldr s0, [pc, #-48] @ 0x0 <baz> | ||
@ THUMB_OFFSET: vldr d0, [pc, #-52] @ 0x0 <baz> | ||
@ THUMB_OFFSET: vldr.16 s0, [pc, #-56] @ 0x0 <baz> |
Uh oh!
There was an error while loading. Please reload this page.