RFC Variable size jump_label support
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest9 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | jump_label, x86: Strip ASM jump_label supportarch/ arch/ | +5 | 0 replies | |
| 2/9 | jump_label, x86: Factor out the __jump_table generationarch/ | +12 | 0 replies | |
| 3/9 | jump_label, x86: Remove init NOP optimizationarch/ | +4 | 0 replies | |
| 4/9 | jump_label, x86: Improve error when we fail expected textarch/ | +10 | 0 replies | |
| 5/9 | jump_label, x86: Introduce jump_entry_size()arch/ arch/ include/ +1 more | +17 | 0 replies | |
| 6/9 | jump_label, x86: Add variable length patching supportarch/ arch/ arch/ | +45 | 0 replies | |
| 7/9 | jump_label,objtool: Validate variable size jump labelstools/ | +25 | 0 replies | |
| 8/9 | jump_label,objtool: Generate possible statisticstools/ | +41 | 0 replies | |
| 9/9 | jump_label, x86: Enable JMP8/NOP2 supportarch/ arch/ arch/ | +62 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [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.