File tree Expand file tree Collapse file tree 6 files changed +14
-8
lines changed Expand file tree Collapse file tree 6 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -2034,7 +2034,10 @@ class MCPlusBuilder {
2034
2034
return InstructionListType ();
2035
2035
}
2036
2036
2037
- virtual InstructionListType createDummyReturnFunction (MCContext *Ctx) const {
2037
+ // / Returns a function body that contains only a return instruction. An
2038
+ // / example usage is a workaround for the '__bolt_fini_trampoline' of
2039
+ // Instrumentation.
2040
+ virtual InstructionListType createDummyReturn (MCContext *Ctx) const {
2038
2041
llvm_unreachable (" not implemented" );
2039
2042
return InstructionListType ();
2040
2043
}
Original file line number Diff line number Diff line change @@ -755,7 +755,7 @@ void Instrumentation::createAuxiliaryFunctions(BinaryContext &BC) {
755
755
// with unknown symbol in runtime library. E.g. for static PIE
756
756
// executable
757
757
createSimpleFunction (" __bolt_fini_trampoline" ,
758
- BC.MIB ->createDummyReturnFunction (BC.Ctx .get ()));
758
+ BC.MIB ->createDummyReturn (BC.Ctx .get ()));
759
759
}
760
760
}
761
761
}
Original file line number Diff line number Diff line change @@ -1607,7 +1607,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
1607
1607
return Instrs;
1608
1608
}
1609
1609
1610
- InstructionListType createDummyReturnFunction (MCContext *Ctx) const override {
1610
+ InstructionListType createDummyReturn (MCContext *Ctx) const override {
1611
1611
InstructionListType Insts (1 );
1612
1612
createReturn (Insts[0 ]);
1613
1613
return Insts;
Original file line number Diff line number Diff line change @@ -3271,7 +3271,7 @@ class X86MCPlusBuilder : public MCPlusBuilder {
3271
3271
return Insts;
3272
3272
}
3273
3273
3274
- InstructionListType createDummyReturnFunction (MCContext *Ctx) const override {
3274
+ InstructionListType createDummyReturn (MCContext *Ctx) const override {
3275
3275
InstructionListType Insts (1 );
3276
3276
createReturn (Insts[0 ]);
3277
3277
return Insts;
Original file line number Diff line number Diff line change 1
- // Tests that AArch64 is able to instrument static binaries in relocation mode.
1
+ // Tests that AArch64 is able to instrument static binaries in relocation mode,
2
+ // by checking that '__bolt_fini_trampoline' is generated and contains a 'ret'
3
+ // instruction.
2
4
3
5
REQUIRES: system-linux
4
6
5
7
RUN: %clang %p/../Inputs/main.c -o %t -Wl,-q -static
6
8
RUN: llvm-bolt -instrument -instrumentation-sleep-time=1 %t -o %t.instr 2>&1 | FileCheck %s
7
- RUN: llvm-nm -n %t.instr | FileCheck %s -check-prefix=CHECK-SYM
9
+ RUN: llvm-objdump --disassemble-symbols=__bolt_fini_trampoline %t.instr -D | FileCheck %s -check-prefix=CHECK-ASM
8
10
9
11
CHECK: BOLT-INFO: output linked against instrumentation runtime library
10
- CHECK-SYM: __bolt_fini_trampoline
12
+ CHECK-ASM: <__bolt_fini_trampoline>:
13
+ CHECK-ASM-NEXT: ret
Original file line number Diff line number Diff line change 1
- // dummy function just for emitting relocations to the linker.
1
+ // dummy function just for emitting relocations to the linker.
2
2
int foo () { return 0 ; }
3
3
int main (int argc , char * * argv ) { return foo () + 1 ; }
You can’t perform that action at this time.
0 commit comments