Messages in this thread | | | Subject | Re: [PATCH] x86, retpolines: raise limit for generating indirect calls from switch-case | From | Daniel Borkmann <> | Date | Thu, 21 Feb 2019 23:56:55 +0100 |
| |
On 02/21/2019 11:27 PM, Linus Torvalds wrote: > On Thu, Feb 21, 2019 at 2:20 PM Daniel Borkmann <daniel@iogearbox.net> wrote: >> >> In case of gcc, this setting is controlled by case-values-threshold >> which has an architecture global default that selects 4 or 5 ( > > Ack. For retpoline, that's much too low. > > Patch looks sane, although it would be good to verify just which > versions of gcc this works for. All versions with retpoline?
The feature was first added in gcc 4.7 [0], under "General Optimizer Improvements":
Support for a new parameter --param case-values-threshold=n was added to allow users to control the cutoff between doing switch statements as a series of if statements and using a jump table.
From what I can tell, original author (H.J. Lu) provided backports up to gcc 4.8 and distros seem to have pulled it from his github branch [1] as upstream gcc does not handle backports for stable versions that old.
Thanks, Daniel
[0] https://www.gnu.org/software/gcc/gcc-4.7/changes.html [1] https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1749261 https://github.com/hjl-tools/gcc/tree/hjl/indirect/gcc-4_8-branch/master
| |