-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[llvm-objdump][ARM] Find ELF file PLT entries for arm, thumb #130764
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8787a61
[llvm-objdump][ARM] Find ELF file PLT entries for arm, thumb
dzhidzhoev 30a96bf
Addressed @MaskRay comments
dzhidzhoev def15be
Addressed @MaskRay comments
dzhidzhoev f8563f9
Move instructionsMatch closer to it's caller
dzhidzhoev 52f97da
Early exit
dzhidzhoev 195284d
Don't run cross project test if configuration is unsupported
dzhidzhoev 5e249ee
Remove unused flags
dzhidzhoev 51fba01
Rename test variables
dzhidzhoev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,2 @@ | ||
if "ARM" not in config.targets_to_build: | ||
config.unsupported = True |
This file contains hidden or 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,245 @@ | ||
// Test PLT section parsing on arm. | ||
|
||
// REQUIRES: ld.lld | ||
|
||
// RUN: %clang --target=armv6a-none-linux-gnueabi -fuse-ld=lld \ | ||
// RUN: -nostdlib -nostdinc -shared %s -o %t.v6a | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v6a | FileCheck %s --check-prefixes=CHECK,LE | ||
|
||
// Test PLT section parsing on armeb. | ||
|
||
// RUN: %clang --target=armv6aeb-none-linux-gnueabi -fuse-ld=lld \ | ||
// RUN: -nostdlib -nostdinc -shared %s -o %t.v6aeb | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v6aeb | FileCheck %s --check-prefixes=CHECK,BE | ||
// RUN: obj2yaml %t.v6aeb | FileCheck %s --check-prefixes=NOBE8 | ||
|
||
// Test PLT section parsing on armeb with be8. | ||
|
||
// RUN: %clang --target=armv7aeb-none-linux-gnueabi -fuse-ld=lld \ | ||
// RUN: -nostdlib -nostdinc -shared %s -o %t.v7aeb | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v7aeb | FileCheck %s --check-prefixes=CHECK,BE | ||
// RUN: obj2yaml %t.v7aeb | FileCheck %s --check-prefixes=BE8 | ||
|
||
// LE: file format elf32-littlearm | ||
// BE: file format elf32-bigarm | ||
// NOBE8-NOT: EF_ARM_BE8 | ||
// BE8: EF_ARM_BE8 | ||
|
||
// CHECK: Disassembly of section .text: | ||
// CHECK-EMPTY: | ||
// CHECK-NEXT: <_start>: | ||
// CHECK-NEXT: push {r11, lr} | ||
// CHECK-NEXT: mov r11, sp | ||
// CHECK-NEXT: bl {{.*}} <func1@plt> | ||
// CHECK-NEXT: bl {{.*}} <func2@plt> | ||
// CHECK-NEXT: bl {{.*}} <func3@plt> | ||
|
||
// CHECK: Disassembly of section .plt: | ||
// CHECK: <func1@plt>: | ||
// CHECK-NEXT: add r12, pc, #0, #12 | ||
// CHECK-NEXT: add r12, r12, #32, #20 | ||
// CHECK-NEXT: ldr pc, [r12, #132]! | ||
// CHECK-NEXT: .word 0xd4d4d4d4 | ||
// CHECK-EMPTY: | ||
// CHECK-NEXT: <func2@plt>: | ||
// CHECK-NEXT: add r12, pc, #0, #12 | ||
// CHECK-NEXT: add r12, r12, #32, #20 | ||
// CHECK-NEXT: ldr pc, [r12, #120]! | ||
// CHECK-NEXT: .word 0xd4d4d4d4 | ||
// CHECK-EMPTY: | ||
// CHECK-NEXT: <func3@plt>: | ||
// CHECK-NEXT: add r12, pc, #0, #12 | ||
// CHECK-NEXT: add r12, r12, #32, #20 | ||
// CHECK-NEXT: ldr pc, [r12, #108]! | ||
// CHECK-NEXT: .word 0xd4d4d4d4 | ||
|
||
// Test PLT section parsing on thumb. | ||
|
||
// RUN: %clang --target=thumbv8.1m.main-none-linux-eabi \ | ||
// RUN: -c %s -o %t.v8.o | ||
// RUN: ld.lld --shared %t.v8.o -o %t.v8 | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v8 | FileCheck %s --check-prefixes=THUMB,LE | ||
|
||
// Test PLT section parsing on thumbeb. | ||
|
||
// RUN: %clang --target=thumbebv8.1m.main-none-linux-eabi \ | ||
// RUN: -c %s -o %t.v8eb.o | ||
// RUN: ld.lld --shared %t.v8eb.o -o %t.v8eb | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v8eb | FileCheck %s --check-prefixes=THUMB,BE | ||
// RUN: obj2yaml %t.v8eb | FileCheck %s --check-prefixes=NOBE8 | ||
|
||
// Test PLT section parsing on thumbeb with be8. | ||
|
||
// RUN: %clang --target=thumbebv8.1m.main-none-linux-eabi \ | ||
// RUN: -c %s -o %t.v8eb.be8.o | ||
// RUN: ld.lld --shared --be8 %t.v8eb.be8.o -o %t.v8eb.be8 | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v8eb.be8 | FileCheck %s --check-prefixes=THUMB,BE | ||
// RUN: obj2yaml %t.v8eb.be8 | FileCheck %s --check-prefixes=BE8 | ||
|
||
// THUMB: Disassembly of section .text: | ||
// THUMB-EMPTY: | ||
// THUMB-NEXT: <_start>: | ||
// THUMB-NEXT: push {r7, lr} | ||
// THUMB-NEXT: mov r7, sp | ||
// THUMB-NEXT: bl {{.*}} <func1@plt> | ||
// THUMB-NEXT: bl {{.*}} <func2@plt> | ||
// THUMB-NEXT: bl {{.*}} <func3@plt> | ||
|
||
// THUMB: Disassembly of section .plt: | ||
// THUMB-EMPTY: | ||
// THUMB: <func1@plt>: | ||
// THUMB-NEXT: movw r12, #136 | ||
// THUMB-NEXT: movt r12, #2 | ||
// THUMB-NEXT: add r12, pc | ||
// THUMB-NEXT: ldr.w pc, [r12] | ||
// THUMB-NEXT: b 0x | ||
// THUMB-EMPTY: | ||
// THUMB-NEXT: <func2@plt>: | ||
// THUMB-NEXT: movw r12, #124 | ||
// THUMB-NEXT: movt r12, #2 | ||
// THUMB-NEXT: add r12, pc | ||
// THUMB-NEXT: ldr.w pc, [r12] | ||
// THUMB-NEXT: b 0x | ||
// THUMB-EMPTY: | ||
// THUMB-NEXT: <func3@plt>: | ||
// THUMB-NEXT: movw r12, #112 | ||
// THUMB-NEXT: movt r12, #2 | ||
// THUMB-NEXT: add r12, pc | ||
// THUMB-NEXT: ldr.w pc, [r12] | ||
// THUMB-NEXT: b 0x | ||
|
||
// Test PLT section with long entries parsing on arm. | ||
|
||
// RUN: echo "SECTIONS { \ | ||
// RUN: .text 0x1000 : { *(.text) } \ | ||
// RUN: .plt 0x2000 : { *(.plt) *(.plt.*) } \ | ||
// RUN: .got.plt 0x9000000 : { *(.got.plt) } \ | ||
// RUN: }" > %t.long.script | ||
|
||
// RUN: %clang --target=armv6a-none-linux-gnueabi -fuse-ld=lld \ | ||
// RUN: -Xlinker --script=%t.long.script -nostdlib -nostdinc \ | ||
// RUN: -shared %s -o %t.v6a.long | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v6a.long | FileCheck %s --check-prefixes=CHECKLONG,LE | ||
|
||
// Test PLT section with long entries parsing on armeb. | ||
|
||
// RUN: %clang --target=armv6aeb-none-linux-gnueabi -fuse-ld=lld \ | ||
// RUN: -Xlinker --script=%t.long.script -nostdlib -nostdinc \ | ||
// RUN: -shared %s -o %t.v6aeb.long | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v6aeb.long | FileCheck %s --check-prefixes=CHECKLONG,BE | ||
// RUN: obj2yaml %t.v6aeb.long | FileCheck %s --check-prefixes=NOBE8 | ||
|
||
// Test PLT section with long entries parsing on armeb with be8. | ||
|
||
// RUN: %clang --target=armv7aeb-none-linux-gnueabi -fuse-ld=lld \ | ||
// RUN: -Xlinker --script=%t.long.script -nostdlib -nostdinc \ | ||
// RUN: -shared %s -o %t.v7aeb.long | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v7aeb.long | FileCheck %s --check-prefixes=CHECKLONG,BE | ||
// RUN: obj2yaml %t.v7aeb.long | FileCheck %s --check-prefixes=BE8 | ||
|
||
// CHECKLONG: Disassembly of section .text: | ||
// CHECKLONG-EMPTY: | ||
// CHECKLONG-NEXT: <_start>: | ||
// CHECKLONG-NEXT: push {r11, lr} | ||
// CHECKLONG-NEXT: mov r11, sp | ||
// CHECKLONG-NEXT: bl 0x2020 <func1@plt> | ||
// CHECKLONG-NEXT: bl 0x2030 <func2@plt> | ||
// CHECKLONG-NEXT: bl 0x2040 <func3@plt> | ||
|
||
// CHECKLONG: Disassembly of section .plt: | ||
// CHECKLONG: 00002020 <func1@plt>: | ||
// CHECKLONG-NEXT: ldr r12, [pc, #4] | ||
// CHECKLONG-NEXT: add r12, r12, pc | ||
// CHECKLONG-NEXT: ldr pc, [r12] | ||
// CHECKLONG-NEXT: .word 0x08ffdfe0 | ||
// CHECKLONG-EMPTY: | ||
// CHECKLONG-NEXT: 00002030 <func2@plt>: | ||
// CHECKLONG-NEXT: ldr r12, [pc, #4] | ||
// CHECKLONG-NEXT: add r12, r12, pc | ||
// CHECKLONG-NEXT: ldr pc, [r12] | ||
// CHECKLONG-NEXT: .word 0x08ffdfd4 | ||
// CHECKLONG-EMPTY: | ||
// CHECKLONG-NEXT: 00002040 <func3@plt>: | ||
// CHECKLONG-NEXT: ldr r12, [pc, #4] | ||
// CHECKLONG-NEXT: add r12, r12, pc | ||
// CHECKLONG-NEXT: ldr pc, [r12] | ||
// CHECKLONG-NEXT: .word 0x08ffdfc8 | ||
|
||
// Test PLT section with mixed long and short entries parsing on arm. | ||
|
||
// RUN: echo "SECTIONS { \ | ||
// RUN: .text 0x1000 : { *(.text) } \ | ||
// RUN: .plt 0x2000 : { *(.plt) *(.plt.*) } \ | ||
// RUN: .got.plt 0x8002020 : { *(.got.plt) } \ | ||
// RUN: }" > %t.mix.script | ||
|
||
// RUN: %clang --target=armv6a-none-linux-gnueabi -fuse-ld=lld \ | ||
// RUN: -Xlinker --script=%t.mix.script -nostdlib -nostdinc \ | ||
// RUN: -shared %s -o %t.v6a.mix | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v6a.mix | FileCheck %s --check-prefixes=CHECKMIX,LE | ||
|
||
// Test PLT section with mixed long and short entries parsing on armeb. | ||
|
||
// RUN: %clang --target=armv6aeb-none-linux-gnueabi -fuse-ld=lld \ | ||
// RUN: -Xlinker --script=%t.mix.script -nostdlib -nostdinc \ | ||
// RUN: -shared %s -o %t.v6aeb.mix | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v6aeb.mix | FileCheck %s --check-prefixes=CHECKMIX,BE | ||
// RUN: obj2yaml %t.v6aeb.mix | FileCheck %s --check-prefixes=NOBE8 | ||
|
||
// Test PLT section with mixed long and short entries parsing on armeb with be8. | ||
|
||
// RUN: %clang --target=armv7aeb-none-linux-gnueabi -fuse-ld=lld \ | ||
// RUN: -Xlinker --script=%t.mix.script -nostdlib -nostdinc \ | ||
// RUN: -shared %s -o %t.v7aeb.mix | ||
// RUN: llvm-objdump --no-show-raw-insn --no-print-imm-hex \ | ||
// RUN: -d %t.v7aeb.mix | FileCheck %s --check-prefixes=CHECKMIX,BE | ||
// RUN: obj2yaml %t.v7aeb.mix | FileCheck %s --check-prefixes=BE8 | ||
|
||
// CHECKMIX: Disassembly of section .text: | ||
// CHECKMIX-EMPTY: | ||
// CHECKMIX-NEXT: <_start>: | ||
// CHECKMIX-NEXT: push {r11, lr} | ||
// CHECKMIX-NEXT: mov r11, sp | ||
// CHECKMIX-NEXT: bl 0x2020 <func1@plt> | ||
// CHECKMIX-NEXT: bl 0x2030 <func2@plt> | ||
// CHECKMIX-NEXT: bl 0x2040 <func3@plt> | ||
|
||
// CHECKMIX: Disassembly of section .plt: | ||
// CHECKMIX: 00002020 <func1@plt>: | ||
// CHECKMIX-NEXT: ldr r12, [pc, #4] | ||
// CHECKMIX-NEXT: add r12, r12, pc | ||
// CHECKMIX-NEXT: ldr pc, [r12] | ||
// CHECKMIX-NEXT: .word 0x08000000 | ||
// CHECKMIX-EMPTY: | ||
// CHECKMIX-NEXT: 00002030 <func2@plt>: | ||
// CHECKMIX-NEXT: add r12, pc, #133169152 | ||
// CHECKMIX-NEXT: add r12, r12, #1044480 | ||
// CHECKMIX-NEXT: ldr pc, [r12, #4088]! | ||
// CHECKMIX-NEXT: .word 0xd4d4d4d4 | ||
// CHECKMIX-EMPTY: | ||
// CHECKMIX-NEXT: 00002040 <func3@plt>: | ||
// CHECKMIX-NEXT: add r12, pc, #133169152 | ||
// CHECKMIX-NEXT: add r12, r12, #1044480 | ||
// CHECKMIX-NEXT: ldr pc, [r12, #4076]! | ||
// CHECKMIX-NEXT: .word 0xd4d4d4d4 | ||
|
||
extern void *func1(); | ||
extern void *func2(); | ||
extern void *func3(); | ||
|
||
void _start() { | ||
func1(); | ||
func2(); | ||
func3(); | ||
} |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tet tests v6a/v8m & LE/BE. Perhaps use a more meaningful executable name, say,
%tv6
%tv6.be
than%t1
.