| Date | Mon, 07 Oct 2019 10:44:43 +0200 | From | Peter Zijlstra <> | Subject | [RFC][PATCH 0/9] Variable size jump_label support |
| |
These here patches are something I've been poking at for a while, enabling jump_label to use 2 byte jumps/nops.
It _almost_ works :-/
That is, you can build some kernels with it (x86_64-defconfig for example works just fine).
The problem comes when GCC generates a branch into another section, mostly .text.unlikely. At that point GAS just gives up and throws a fit (more details in the last patch).
Aside from anyone coming up with a really clever GAS trick, I don't see how we can do this other than:
- get binutils/gas 'fixed', for this there's two possible approaches:
* add some extra operators such that something like:
.set disp %[l_yes] ~ 1b ? (%[l_yes] - (1b + 2)) : 128
works, where the new '~' infix operator would indicate left and right hand operands are from the same section, and the ?: conditional operator would be added to make it all work.
* add a 'fake' mnemonic for x86 that directly generates the right NOP:
nojmp{.d8,d32} %target
which would completely mirror how the existing 'jmp{.d8,d32} %target' works, except it would emit single instruction NOP2/NOP5.
- use 'jmp' and get objtool to rewrite the text. Steven has earlier proposed something like that (using recordmcount) and Linus hated that.
|