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 @@ -2041,7 +2041,10 @@ class MCPlusBuilder {
20412041 return InstructionListType ();
20422042 }
20432043
2044- virtual InstructionListType createDummyReturnFunction (MCContext *Ctx) const {
2044+ // / Returns a function body that contains only a return instruction. An
2045+ // / example usage is a workaround for the '__bolt_fini_trampoline' of
2046+ // Instrumentation.
2047+ virtual InstructionListType createDummyReturn (MCContext *Ctx) const {
20452048 llvm_unreachable (" not implemented" );
20462049 return InstructionListType ();
20472050 }
Original file line number Diff line number Diff line change @@ -754,7 +754,7 @@ void Instrumentation::createAuxiliaryFunctions(BinaryContext &BC) {
754754 // with unknown symbol in runtime library. E.g. for static PIE
755755 // executable
756756 createSimpleFunction (" __bolt_fini_trampoline" ,
757- BC.MIB ->createDummyReturnFunction (BC.Ctx .get ()));
757+ BC.MIB ->createDummyReturn (BC.Ctx .get ()));
758758 }
759759 }
760760}
Original file line number Diff line number Diff line change @@ -1644,7 +1644,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
16441644 return Instrs;
16451645 }
16461646
1647- InstructionListType createDummyReturnFunction (MCContext *Ctx) const override {
1647+ InstructionListType createDummyReturn (MCContext *Ctx) const override {
16481648 InstructionListType Insts (1 );
16491649 createReturn (Insts[0 ]);
16501650 return Insts;
Original file line number Diff line number Diff line change @@ -3241,7 +3241,7 @@ class X86MCPlusBuilder : public MCPlusBuilder {
32413241 return Insts;
32423242 }
32433243
3244- InstructionListType createDummyReturnFunction (MCContext *Ctx) const override {
3244+ InstructionListType createDummyReturn (MCContext *Ctx) const override {
32453245 InstructionListType Insts (1 );
32463246 createReturn (Insts[0 ]);
32473247 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.
24
35REQUIRES: system-linux
46
57RUN: %clang %p/../Inputs/main.c -o %t -Wl,-q -static
68RUN: 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
810
911CHECK: 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.
22int foo () { return 0 ; }
33int main (int argc , char * * argv ) { return foo () + 1 ; }
You can’t perform that action at this time.
0 commit comments