Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bolt/lib/Core/BinaryFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ void BinaryFunction::print(raw_ostream &OS, std::string Annotation) {
if (!IslandOffset)
return;

// Print label if it exists at this offset.
if (const BinaryData *BD =
BC.getBinaryDataAtAddress(getAddress() + *IslandOffset))
OS << BD->getName() << ":\n";

const size_t IslandSize = getSizeOfDataInCodeAt(*IslandOffset);
BC.printData(OS, BC.extractData(getAddress() + *IslandOffset, IslandSize),
*IslandOffset);
Expand Down Expand Up @@ -1066,7 +1071,7 @@ size_t BinaryFunction::getSizeOfDataInCodeAt(uint64_t Offset) const {
auto Iter = Islands->CodeOffsets.upper_bound(Offset);
if (Iter != Islands->CodeOffsets.end())
return *Iter - Offset;
return getSize() - Offset;
return getMaxSize() - Offset;
}

std::optional<uint64_t>
Expand Down
10 changes: 8 additions & 2 deletions bolt/test/AArch64/data-in-code.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
## Check disassembly of BOLT input.
# RUN: llvm-objdump %t.exe -d | FileCheck %s

# RUN: llvm-bolt %t.exe -o %t.bolt --print-disasm | FileCheck %s
# RUN: llvm-bolt %t.exe -o %t.bolt --print-disasm \
# RUN: | FileCheck %s --check-prefixes CHECK,CHECK-BOLT-ONLY

.text
.balign 4
Expand All @@ -16,16 +17,21 @@
.type _start, %function
_start:
mov x0, #0x0
ldr x1, .L1
.word 0x4f82e010
ret
.size _start, .-_start
.L1:
.byte 0x0, 0xff, 0x42
# CHECK-LABEL: _start
# CHECK: mov x0, #0x0
# CHECK-NEXT: ldr x1
# CHECK-BOLT-ONLY-SAME: ISLANDat[[ADDR:]]
# CHECK-NEXT: .word 0x4f82e010
# CHECK-NEXT: ret
# CHECK-BOLT-ONLY-NEXT: ISLANDat[[ADDR]]
# CHECK-NEXT: .short 0xff00
# CHECK-NEXT: .byte 0x42
.size _start, .-_start

## Force relocation mode.
.reloc 0, R_AARCH64_NONE