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() {
13411341 }
13421342 }
13431343 }
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+ }
13441357 }
13451358
13461359 if (!BC->IsLinuxKernel ) {
Original file line number Diff line number Diff line change 66# RUN: -fuse-ld=lld -Wl,-q
77# RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=CHECK-INPUT %s
88# 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
1010# RUN: llvm-objdump -d -j .text %t.bolt | \
1111# RUN: FileCheck --check-prefix=CHECK-OUTPUT %s
1212
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+
1324.text
1425.balign 4
1526.global far_function
You can’t perform that action at this time.
0 commit comments