On Linux, it was made possible by https://reviews.llvm.org/D38253 that __builtin_longjmp can jump between ARM mode and Thumb mode. However, it has been revealed that it does not work in some cases. This is because in Thumb mode __builtin_longjmp emits an assembly instruction ldr r11, [[BUFREG]] which is misassembled by the integrated assembler, leading to r11 (the frame pointer register in ARM mode) not being restored correctly.
The proposed change uses the instruction mov r11, r7 in place of ldr r11, [[BUFREG]]. Following ldr r7, [[BUFREG]], it should correctly restore r11.
clang-format: please reformat the code