Skip to content

Commit e6a6646

Browse files
Merge branch 'llvm:main' into main
2 parents ad86002 + c35ea62 commit e6a6646

File tree

2,047 files changed

+136432
-62461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,047 files changed

+136432
-62461
lines changed

.github/new-prs-labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,3 +1008,8 @@ bazel:
10081008

10091009
offload:
10101010
- offload/**
1011+
1012+
tablegen:
1013+
- llvm/include/TableGen/**
1014+
- llvm/lib/TableGen/**
1015+
- llvm/utils/TableGen/**

bolt/include/bolt/Core/BinaryBasicBlock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "bolt/Core/MCPlus.h"
2020
#include "llvm/ADT/GraphTraits.h"
2121
#include "llvm/ADT/StringRef.h"
22+
#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
2223
#include "llvm/MC/MCInst.h"
2324
#include "llvm/MC/MCSymbol.h"
2425
#include "llvm/Support/ErrorOr.h"

bolt/include/bolt/Rewrite/RewriteInstance.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -510,12 +510,11 @@ class RewriteInstance {
510510
};
511511

512512
/// Different types of X86-64 PLT sections.
513-
const PLTSectionInfo X86_64_PLTSections[4] = {
514-
{ ".plt", 16 },
515-
{ ".plt.got", 8 },
516-
{ ".plt.sec", 8 },
517-
{ nullptr, 0 }
518-
};
513+
const PLTSectionInfo X86_64_PLTSections[5] = {{".plt", 16},
514+
{".plt.got", 8},
515+
{".plt.sec", 8},
516+
{".iplt", 16},
517+
{nullptr, 0}};
519518

520519
/// AArch64 PLT sections.
521520
const PLTSectionInfo AArch64_PLTSections[4] = {

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ void RewriteInstance::createPLTBinaryFunction(uint64_t TargetAddress,
15331533

15341534
MCSymbol *Symbol = Rel->Symbol;
15351535
if (!Symbol) {
1536-
if (!BC->isAArch64() || !Rel->Addend || !Rel->isIRelative())
1536+
if (BC->isRISCV() || !Rel->Addend || !Rel->isIRelative())
15371537
return;
15381538

15391539
// IFUNC trampoline without symbol
Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// This test checks that IFUNC trampoline is properly recognised by BOLT
2-
31
// With -O0 indirect call is performed on IPLT trampoline. IPLT trampoline
42
// has IFUNC symbol.
5-
// RUN: %clang %cflags -nostdlib -O0 -no-pie %s -fuse-ld=lld \
3+
// RUN: %clang %cflags -nostdlib -O0 -no-pie %p/../Inputs/ifunc.c -fuse-ld=lld \
64
// RUN: -o %t.O0.exe -Wl,-q
75
// RUN: llvm-bolt %t.O0.exe -o %t.O0.bolt.exe \
86
// RUN: --print-disasm --print-only=_start | \
@@ -12,7 +10,7 @@
1210

1311
// Non-pie static executable doesn't generate PT_DYNAMIC, check relocation
1412
// is readed successfully and IPLT trampoline has been identified by bolt.
15-
// RUN: %clang %cflags -nostdlib -O3 %s -fuse-ld=lld -no-pie \
13+
// RUN: %clang %cflags -nostdlib -O3 %p/../Inputs/ifunc.c -fuse-ld=lld -no-pie \
1614
// RUN: -o %t.O3_nopie.exe -Wl,-q
1715
// RUN: llvm-readelf -l %t.O3_nopie.exe | \
1816
// RUN: FileCheck --check-prefix=NON_DYN_CHECK %s
@@ -25,7 +23,7 @@
2523
// With -O3 direct call is performed on IPLT trampoline. IPLT trampoline
2624
// doesn't have associated symbol. The ifunc symbol has the same address as
2725
// IFUNC resolver function.
28-
// RUN: %clang %cflags -nostdlib -O3 %s -fuse-ld=lld -fPIC -pie \
26+
// RUN: %clang %cflags -nostdlib -O3 %p/../Inputs/ifunc.c -fuse-ld=lld -fPIC -pie \
2927
// RUN: -o %t.O3_pie.exe -Wl,-q
3028
// RUN: llvm-bolt %t.O3_pie.exe -o %t.O3_pie.bolt.exe \
3129
// RUN: --print-disasm --print-only=_start | \
@@ -35,8 +33,8 @@
3533

3634
// Check that IPLT trampoline located in .plt section are normally handled by
3735
// BOLT. The gnu-ld linker doesn't use separate .iplt section.
38-
// RUN: %clang %cflags -nostdlib -O3 %s -fuse-ld=lld -fPIC -pie \
39-
// RUN: -T %p/Inputs/iplt.ld -o %t.iplt_O3_pie.exe -Wl,-q
36+
// RUN: %clang %cflags -nostdlib -O3 %p/../Inputs/ifunc.c -fuse-ld=lld -fPIC -pie \
37+
// RUN: -T %p/../Inputs/iplt.ld -o %t.iplt_O3_pie.exe -Wl,-q
4038
// RUN: llvm-bolt %t.iplt_O3_pie.exe -o %t.iplt_O3_pie.bolt.exe \
4139
// RUN: --print-disasm --print-only=_start | \
4240
// RUN: FileCheck --check-prefix=CHECK %s
@@ -49,14 +47,3 @@
4947

5048
// REL_CHECK: R_AARCH64_IRELATIVE [[#%x,REL_SYMB_ADDR:]]
5149
// REL_CHECK: [[#REL_SYMB_ADDR]] {{.*}} FUNC {{.*}} resolver_foo
52-
53-
static void foo() {}
54-
static void bar() {}
55-
56-
extern int use_foo;
57-
58-
static void *resolver_foo(void) { return use_foo ? foo : bar; }
59-
60-
__attribute__((ifunc("resolver_foo"))) void ifoo();
61-
62-
void _start() { ifoo(); }

bolt/test/Inputs/ifunc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This test checks that IFUNC trampoline is properly recognised by BOLT
2+
3+
static void foo() {}
4+
static void bar() {}
5+
6+
extern int use_foo;
7+
8+
static void *resolver_foo(void) { return use_foo ? foo : bar; }
9+
10+
__attribute__((ifunc("resolver_foo"))) void ifoo();
11+
12+
void _start() { ifoo(); }
File renamed without changes.

bolt/test/X86/ifunc.test

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Check if BOLT can process ifunc symbols from .plt section
2+
// RUN: %clang %cflags -nostdlib -no-pie %p/../Inputs/ifunc.c -fuse-ld=lld \
3+
// RUN: -o %t.exe -Wl,-q
4+
// RUN: llvm-bolt %t.exe -o %t.bolt.exe \
5+
// RUN: --print-disasm --print-only=_start | \
6+
// RUN: FileCheck --check-prefix=CHECK %s
7+
// RUN: llvm-readelf -aW %t.bolt.exe | \
8+
// RUN: FileCheck --check-prefix=REL_CHECK %s
9+
10+
// Check if BOLT can process ifunc symbols from .plt section in non-pie static
11+
// executable case.
12+
// RUN: %clang %cflags -nostdlib %p/../Inputs/ifunc.c -fuse-ld=lld -no-pie \
13+
// RUN: -o %t.nopie.exe -Wl,-q
14+
// RUN: llvm-readelf -l %t.nopie.exe | \
15+
// RUN: FileCheck --check-prefix=NON_DYN_CHECK %s
16+
// RUN: llvm-bolt %t.nopie.exe -o %t.nopie.bolt.exe \
17+
// RUN: --print-disasm --print-only=_start | \
18+
// RUN: FileCheck --check-prefix=CHECK %s
19+
// RUN: llvm-readelf -aW %t.nopie.bolt.exe | \
20+
// RUN: FileCheck --check-prefix=REL_CHECK %s
21+
22+
// Check if BOLT can process ifunc symbols from .plt section in pie executable
23+
// case.
24+
// RUN: %clang %cflags -nostdlib %p/../Inputs/ifunc.c -fuse-ld=lld -fPIC -pie \
25+
// RUN: -o %t.pie.exe -Wl,-q
26+
// RUN: llvm-bolt %t.pie.exe -o %t.pie.bolt.exe \
27+
// RUN: --print-disasm --print-only=_start | \
28+
// RUN: FileCheck --check-prefix=CHECK %s
29+
// RUN: llvm-readelf -aW %t.pie.bolt.exe | \
30+
// RUN: FileCheck --check-prefix=REL_CHECK %s
31+
32+
// Check that IPLT trampoline located in .plt section are normally handled by
33+
// BOLT. The gnu-ld linker doesn't use separate .iplt section.
34+
// RUN: %clang %cflags -nostdlib %p/../Inputs/ifunc.c -fuse-ld=lld -fPIC -pie \
35+
// RUN: -T %p/../Inputs/iplt.ld -o %t.iplt_pie.exe -Wl,-q
36+
// RUN: llvm-bolt %t.iplt_pie.exe -o %t.iplt_pie.bolt.exe \
37+
// RUN: --print-disasm --print-only=_start | \
38+
// RUN: FileCheck --check-prefix=CHECK %s
39+
// RUN: llvm-readelf -aW %t.iplt_pie.bolt.exe | \
40+
// RUN: FileCheck --check-prefix=REL_CHECK %s
41+
42+
// NON_DYN_CHECK-NOT: DYNAMIC
43+
44+
// CHECK: callq "resolver_foo/1@PLT"
45+
46+
// REL_CHECK: R_X86_64_IRELATIVE [[#%x,REL_SYMB_ADDR:]]
47+
// REL_CHECK: [[#REL_SYMB_ADDR]] {{.*}} FUNC {{.*}} resolver_foo

clang-tools-extra/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ add_subdirectory(clang-move)
2727
add_subdirectory(clang-query)
2828
add_subdirectory(include-cleaner)
2929
add_subdirectory(pp-trace)
30-
add_subdirectory(pseudo)
3130
add_subdirectory(tool-template)
3231

3332
option(CLANG_TOOLS_EXTRA_INCLUDE_DOCS "Generate build targets for the Clang Extra Tools docs."

clang-tools-extra/CODE_OWNERS.TXT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ D: clang-tidy
2323

2424
N: Manuel Klimek
2525
26-
D: clang-rename, all parts of clang-tools-extra not covered by someone else
26+
D: all parts of clang-tools-extra not covered by someone else
2727

2828
N: Sam McCall
2929

0 commit comments

Comments
 (0)