forked from ROCm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I03a7c2468660104117e64b9080946a4ffc763806
- Loading branch information
Showing
309 changed files
with
8,802 additions
and
1,605 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
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,9 @@ | ||
SECTIONS | ||
{ | ||
PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS; | ||
.note.gnu.build-id (0x400400): | ||
{ | ||
build_id_note = ABSOLUTE(.); | ||
*(.note.gnu.build-id) | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
bolt/test/AArch64/Inputs/got_end_of_section_symbol.lld_script
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,6 @@ | ||
SECTIONS { | ||
PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS; | ||
.data : { *(.data) *(.array) } | ||
.text : { *(.text) } | ||
.got : { *(.got) *(.igot) } | ||
} |
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,25 @@ | ||
// This test checks that referencing build_id through GOT table | ||
// would result in GOT access after disassembly, not directly | ||
// to build_id address. | ||
|
||
// RUN: %clang %cflags -fuse-ld=lld -Wl,-T,%S/Inputs/build_id.ldscript -Wl,-q \ | ||
// RUN: -Wl,--no-relax -Wl,--build-id=sha1 %s -o %t.exe | ||
// RUN: llvm-bolt -print-disasm --print-only=get_build_id %t.exe -o %t.bolt | \ | ||
// RUN: FileCheck %s | ||
|
||
// CHECK: adrp [[REG:x[0-28]+]], __BOLT_got_zero | ||
// CHECK: ldr x{{.*}}, [[[REG]], :lo12:__BOLT_got_zero{{.*}}] | ||
|
||
struct build_id_note { | ||
char pad[16]; | ||
char hash[20]; | ||
}; | ||
|
||
extern const struct build_id_note build_id_note; | ||
|
||
__attribute__((noinline)) char get_build_id() { return build_id_note.hash[0]; } | ||
|
||
int main() { | ||
get_build_id(); | ||
return 0; | ||
} |
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,28 @@ | ||
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \ | ||
# RUN: %s -o %t.o | ||
# RUN: %clang %cflags -nostartfiles -nodefaultlibs -static -Wl,--no-relax \ | ||
# RUN: -Wl,-q -Wl,-T %S/Inputs/got_end_of_section_symbol.lld_script \ | ||
# RUN: %t.o -o %t.exe | ||
# RUN: not llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s | ||
|
||
# CHECK: BOLT-ERROR: GOT table contains currently unsupported section end | ||
# CHECK-SAME: symbol array_end | ||
|
||
.section .array, "a", @progbits | ||
.globl array_start | ||
.globl array_end | ||
array_start: | ||
.word 0 | ||
array_end: | ||
|
||
.section .text | ||
.globl _start | ||
.type _start, %function | ||
_start: | ||
adrp x1, #:got:array_start | ||
ldr x1, [x1, #:got_lo12:array_start] | ||
adrp x0, #:got:array_end | ||
ldr x0, [x0, #:got_lo12:array_end] | ||
adrp x2, #:got:_start | ||
ldr x2, [x2, #:got_lo12:_start] | ||
ret |
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 @@ | ||
// This test checks whether BOLT can correctly handle relocations against weak symbols. | ||
|
||
// RUN: %clang %cflags -Wl,-z,notext -shared -Wl,-q %s -o %t.so | ||
// RUN: llvm-bolt %t.so -o %t.so.bolt | ||
// RUN: llvm-nm -n %t.so.bolt > %t.out.txt | ||
// RUN: llvm-objdump -dj .rodata %t.so.bolt >> %t.out.txt | ||
// RUN: FileCheck %s --input-file=%t.out.txt | ||
|
||
# CHECK: w func_1 | ||
# CHECK: {{0+}}[[#%x,ADDR:]] W func_2 | ||
|
||
# CHECK: {{.*}} <.rodata>: | ||
# CHECK-NEXT: {{.*}} .word 0x00000000 | ||
# CHECK-NEXT: {{.*}} .word 0x00000000 | ||
# CHECK-NEXT: {{.*}} .word 0x{{[0]+}}[[#ADDR]] | ||
# CHECK-NEXT: {{.*}} .word 0x00000000 | ||
|
||
.text | ||
.weak func_2 | ||
.weak func_1 | ||
.global wow | ||
.type wow, %function | ||
wow: | ||
bl func_1 | ||
bl func_2 | ||
ret | ||
.type func_2, %function | ||
func_2: | ||
ret | ||
.section .rodata | ||
.LC0: | ||
.xword func_1 | ||
.LC1: | ||
.xword func_2 |
Oops, something went wrong.