Re: [PATCH v2 3/6] powerpc/module: Optimise nearby branches in ELF V2 ABI stub
From: Benjamin Gray <hidden>
Date: 2022-09-27 03:13:27
From: Benjamin Gray <hidden>
Date: 2022-09-27 03:13:27
On Mon, 2022-09-26 at 14:49 +0000, Christophe Leroy wrote:
quoted
+ /* Replace indirect branch sequence with direct branch where possible */ + if (!create_branch(&direct, jump_seq_addr, addr, 0)) + if (patch_instruction(jump_seq_addr, direct))Why not use patch_branch() ?
I didn't think of it at the time. To get the same abort-if-patch-failed
semantics then the following should work
int err;
...
/* Replace indirect branch sequence with direct branch where
* possible
*/
err = patch_branch(&entry->jump[PPC64_STUB_MTCTR_OFFSET], addr, 0);
if (err && err != -ERANGE)
return 0;