-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into issue-101754
- Loading branch information
Showing
2,946 changed files
with
190,330 additions
and
84,052 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
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
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,12 @@ | ||
// This test checks that IFUNC trampoline is properly recognised by BOLT | ||
|
||
static void foo() {} | ||
static void bar() {} | ||
|
||
extern int use_foo; | ||
|
||
static void *resolver_foo(void) { return use_foo ? foo : bar; } | ||
|
||
__attribute__((ifunc("resolver_foo"))) void ifoo(); | ||
|
||
void _start() { ifoo(); } |
File renamed without changes.
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,47 @@ | ||
// Check if BOLT can process ifunc symbols from .plt section | ||
// RUN: %clang %cflags -nostdlib -no-pie %p/../Inputs/ifunc.c -fuse-ld=lld \ | ||
// RUN: -o %t.exe -Wl,-q | ||
// RUN: llvm-bolt %t.exe -o %t.bolt.exe \ | ||
// RUN: --print-disasm --print-only=_start | \ | ||
// RUN: FileCheck --check-prefix=CHECK %s | ||
// RUN: llvm-readelf -aW %t.bolt.exe | \ | ||
// RUN: FileCheck --check-prefix=REL_CHECK %s | ||
|
||
// Check if BOLT can process ifunc symbols from .plt section in non-pie static | ||
// executable case. | ||
// RUN: %clang %cflags -nostdlib %p/../Inputs/ifunc.c -fuse-ld=lld -no-pie \ | ||
// RUN: -o %t.nopie.exe -Wl,-q | ||
// RUN: llvm-readelf -l %t.nopie.exe | \ | ||
// RUN: FileCheck --check-prefix=NON_DYN_CHECK %s | ||
// RUN: llvm-bolt %t.nopie.exe -o %t.nopie.bolt.exe \ | ||
// RUN: --print-disasm --print-only=_start | \ | ||
// RUN: FileCheck --check-prefix=CHECK %s | ||
// RUN: llvm-readelf -aW %t.nopie.bolt.exe | \ | ||
// RUN: FileCheck --check-prefix=REL_CHECK %s | ||
|
||
// Check if BOLT can process ifunc symbols from .plt section in pie executable | ||
// case. | ||
// RUN: %clang %cflags -nostdlib %p/../Inputs/ifunc.c -fuse-ld=lld -fPIC -pie \ | ||
// RUN: -o %t.pie.exe -Wl,-q | ||
// RUN: llvm-bolt %t.pie.exe -o %t.pie.bolt.exe \ | ||
// RUN: --print-disasm --print-only=_start | \ | ||
// RUN: FileCheck --check-prefix=CHECK %s | ||
// RUN: llvm-readelf -aW %t.pie.bolt.exe | \ | ||
// RUN: FileCheck --check-prefix=REL_CHECK %s | ||
|
||
// Check that IPLT trampoline located in .plt section are normally handled by | ||
// BOLT. The gnu-ld linker doesn't use separate .iplt section. | ||
// RUN: %clang %cflags -nostdlib %p/../Inputs/ifunc.c -fuse-ld=lld -fPIC -pie \ | ||
// RUN: -T %p/../Inputs/iplt.ld -o %t.iplt_pie.exe -Wl,-q | ||
// RUN: llvm-bolt %t.iplt_pie.exe -o %t.iplt_pie.bolt.exe \ | ||
// RUN: --print-disasm --print-only=_start | \ | ||
// RUN: FileCheck --check-prefix=CHECK %s | ||
// RUN: llvm-readelf -aW %t.iplt_pie.bolt.exe | \ | ||
// RUN: FileCheck --check-prefix=REL_CHECK %s | ||
|
||
// NON_DYN_CHECK-NOT: DYNAMIC | ||
|
||
// CHECK: callq "resolver_foo/1@PLT" | ||
|
||
// REL_CHECK: R_X86_64_IRELATIVE [[#%x,REL_SYMB_ADDR:]] | ||
// REL_CHECK: [[#REL_SYMB_ADDR]] {{.*}} FUNC {{.*}} resolver_foo |
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,29 @@ | ||
## Check that --print-only flag works with sections. | ||
|
||
# REQUIRES: system-linux | ||
|
||
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o | ||
# RUN: ld.lld %t.o -o %t.exe | ||
# RUN: llvm-bolt %t.exe -o %t.out --print-cfg --print-only=unused_code 2>&1 \ | ||
# RUN: | FileCheck %s | ||
|
||
# CHECK: Binary Function "foo" | ||
# CHECK-NOT: Binary Function "_start" | ||
|
||
.text | ||
.globl _start | ||
.type _start, %function | ||
_start: | ||
.cfi_startproc | ||
ret | ||
.cfi_endproc | ||
.size _start, .-_start | ||
|
||
.section unused_code,"ax",@progbits | ||
.globl foo | ||
.type foo, %function | ||
foo: | ||
.cfi_startproc | ||
ret | ||
.cfi_endproc | ||
.size foo, .-foo |
Oops, something went wrong.