Index: bolt/lib/Core/Relocation.cpp =================================================================== --- bolt/lib/Core/Relocation.cpp +++ bolt/lib/Core/Relocation.cpp @@ -352,7 +352,7 @@ assert(isInt<28>(Value) && "only PC +/- 128MB is allowed for direct call"); // Immediate goes in bits 25:0 of BL. // OP 1001_01 goes in bits 31:26 of BL. - Value = (Value >> 2) | 0x94000000ULL; + Value = ((Value >> 2) & 0x3ffffff) | 0x94000000ULL; break; } return Value; Index: bolt/test/AArch64/reloc-call26.s =================================================================== --- bolt/test/AArch64/reloc-call26.s +++ bolt/test/AArch64/reloc-call26.s @@ -6,24 +6,30 @@ # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \ # RUN: %s -o %t.o # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -# RUN: llvm-bolt %t.exe -o %t.bolt --funcs=func1 +# RUN: llvm-bolt %t.exe -o %t.bolt --funcs=func1,func2 --force-patch # RUN: llvm-objdump -d --disassemble-symbols='_start' %t.bolt | \ # RUN: FileCheck %s # CHECK: {{.*}} bl {{.*}} +# CHECK: {{.*}} bl {{.*}} .text .align 4 + .global func1 + .type func1, %function +func1: + ret + .size func1, .-func1 .global _start .type _start, %function _start: bl func1 + bl func2 mov w8, #93 svc #0 .size _start, .-_start - - .global func1 - .type func1, %function -func1: + .global func2 + .type func2, %function +func2: ret - .size func1, .-func1 + .size func2, .-func2