1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-11 13:06:59 +03:00
This commit is contained in:
Rui Ueyama 2023-07-28 10:58:28 +09:00
parent be2e1b17cd
commit 163f5db0d1
2 changed files with 6 additions and 7 deletions

View File

@ -638,13 +638,13 @@ void RangeExtensionThunk<E>::copy_buf(Context<E> &ctx) {
// It has two entry points: +0 for Thumb and +4 for ARM.
const u8 entry[] = {
// .thumb
0xfc, 0x46, // mov ip, pc
0x60, 0x47, // bx ip # jumps to the following `ldr` insn
0x78, 0x47, // bx pc # jumps to 1f
0xc0, 0x46, // nop
// .arm
0x04, 0xc0, 0x9f, 0xe5, // ldr ip, 2f
0x0f, 0xc0, 0x8c, 0xe0, // 1: add ip, ip, pc
0x04, 0xc0, 0x9f, 0xe5, // 1: ldr ip, 3f
0x0f, 0xc0, 0x8c, 0xe0, // 2: add ip, ip, pc
0x1c, 0xff, 0x2f, 0xe1, // bx ip
0x00, 0x00, 0x00, 0x00, // 2: .word sym - 1b
0x00, 0x00, 0x00, 0x00, // 3: .word sym - 2b
};
static_assert(E::thunk_hdr_size == sizeof(hdr));

View File

@ -22,6 +22,5 @@ $CC -B. -o $t/exe $t/a.o \
$OBJDUMP -dr $t/exe | grep -F -A7 '<fn1$thunk>:' > $t/log
grep -Eq 'mov\s+ip, pc' $t/log
grep -Eq 'bx\s+ip' $t/log
grep -Eq 'bx\s+pc' $t/log
grep -Eq 'add\s+ip, ip, pc' $t/log