File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1341,6 +1341,19 @@ void RewriteInstance::discoverFileObjects() {
1341
1341
}
1342
1342
}
1343
1343
}
1344
+
1345
+ // The linker may omit data markers for absolute long veneers. Introduce
1346
+ // those markers artificially to assist the disassembler.
1347
+ for (BinaryFunction &BF :
1348
+ llvm::make_second_range (BC->getBinaryFunctions ())) {
1349
+ if (BF.getOneName ().starts_with (" __AArch64AbsLongThunk_" ) &&
1350
+ BF.getSize () == 16 && !BF.getSizeOfDataInCodeAt (8 )) {
1351
+ BC->errs () << " BOLT-WARNING: missing data marker detected in veneer "
1352
+ << BF << ' \n ' ;
1353
+ BF.markDataAtOffset (8 );
1354
+ BC->AddressToConstantIslandMap [BF.getAddress () + 8 ] = &BF;
1355
+ }
1356
+ }
1344
1357
}
1345
1358
1346
1359
if (!BC->IsLinuxKernel ) {
Original file line number Diff line number Diff line change 6
6
# RUN: -fuse-ld=lld -Wl,-q
7
7
# RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=CHECK-INPUT %s
8
8
# RUN: llvm-objcopy --remove-section .rela.mytext %t.exe
9
- # RUN: llvm-bolt %t.exe -o %t.bolt --elim-link-veneers=true --lite=0
9
+ # RUN: llvm-bolt %t.exe -o %t.bolt
10
10
# RUN: llvm-objdump -d -j .text %t.bolt | \
11
11
# RUN: FileCheck --check-prefix=CHECK-OUTPUT %s
12
12
13
+ ## Occasionally, we see the linker not generating $d symbols for long veneers
14
+ ## causing BOLT to fail veneer elimination.
15
+ # RUN: llvm-objcopy --remove-symbol-prefix=\$d %t.exe %t.no-marker.exe
16
+ # RUN: llvm-bolt %t.no-marker.exe -o %t.no-marker.bolt \
17
+ # RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-BOLT
18
+ # RUN: llvm-objdump -d -j .text %t.no-marker.bolt | \
19
+ # RUN: FileCheck --check-prefix=CHECK-OUTPUT %s
20
+
21
+ # CHECK-BOLT-NOT: BOLT-WARNING: unable to disassemble instruction
22
+ # CHECK-BOLT: BOLT-WARNING: missing data marker detected in veneer __AArch64AbsLongThunk_far_function
23
+
13
24
.text
14
25
.balign 4
15
26
.global far_function
You can’t perform that action at this time.
0 commit comments