This patch adds getFirstInstructionOffset method for BinaryFunction which is used to properly handle cases where data is at zero offset in a function. The main change is that we add basic block at first instruction offset when disassembling, which prevents assertion failures in buildCFG. Reviewed By: yota9, rafauler Differential Revision: https://reviews.llvm.org/D127111
18 lines
414 B
C
18 lines
414 B
C
// RUN: %clang %cflags -O2 -fPIE -Wl,-q -pie %s -o %t.exe
|
|
// RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
|
|
// CHECK-NOT: BOLT-WARNING: unable to disassemble instruction at offset
|
|
|
|
void extra_space() {
|
|
asm volatile(".rept 256\n"
|
|
" .byte 0xff\n"
|
|
".endr\n");
|
|
return;
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
void (*fn)(void);
|
|
fn = extra_space + 256;
|
|
fn();
|
|
return 0;
|
|
}
|