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
13 changes: 8 additions & 5 deletions bolt/lib/Rewrite/RewriteInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,6 @@ void RewriteInstance::discoverFileObjects() {
bool IsData = false;
uint64_t LastAddr = 0;
for (const auto &SymInfo : SortedSymbols) {
if (LastAddr == SymInfo.Address) // don't repeat markers
continue;

MarkerSymType MarkerType = BC->getMarkerType(SymInfo.Symbol);

// Treat ST_Function as code.
Expand All @@ -929,8 +926,14 @@ void RewriteInstance::discoverFileObjects() {
if (IsData) {
Expected<StringRef> NameOrError = SymInfo.Symbol.getName();
consumeError(NameOrError.takeError());
BC->errs() << "BOLT-WARNING: function symbol " << *NameOrError
<< " lacks code marker\n";
if (LastAddr == SymInfo.Address) {
BC->errs() << "BOLT-WARNING: ignoring data marker conflicting with "
"function symbol "
<< *NameOrError << '\n';
} else {
BC->errs() << "BOLT-WARNING: function symbol " << *NameOrError
<< " lacks code marker\n";
}
}
MarkerType = MarkerSymType::CODE;
}
Expand Down
17 changes: 0 additions & 17 deletions bolt/test/AArch64/data-at-0-offset.c

This file was deleted.

23 changes: 23 additions & 0 deletions bolt/test/AArch64/function-data-marker.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Check that if a data marker is present at the start of a function, the
## underlying bytes are still treated as code.

# RUN: %clang %cflags %s -o %t.exe
# RUN: llvm-bolt %t.exe -o %t.bolt --print-cfg 2>&1 | FileCheck %s

# CHECK: BOLT-WARNING: ignoring data marker conflicting with function symbol _start

.text
.balign 4

## Data marker is emitted because ".long" directive is used instead of ".inst".
.global _start
.type _start, %function
_start:
.long 0xcec08000 // sha512su0 v0.2d, v0.2d
ret
.size _start, .-_start

# CHECK-LABEL: Binary Function "_start"
# CHECK: Entry Point
# CHECK-NEXT: sha512su0 v0.2d, v0.2d

Loading