lkml.org 
[lkml]   [2015]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] x86: Align jump targets to 1 byte boundaries
    On 2015.04.10 at 14:50 +0200, Denys Vlasenko wrote:
    > New-ish versions of gcc allow people to specify optimization
    > options per function:
    >
    > https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function-Attributes
    >
    > optimize
    > The optimize attribute is used to specify that a function is to be compiled
    > with different optimization options than specified on the command line.
    > Arguments can either be numbers or strings. Numbers are assumed to be an
    > optimization level. Strings that begin with O are assumed to be an
    > optimization option, while other options are assumed to be used with
    > a -f prefix.
    >
    > How about not aligning code by default, and using
    >
    > #define hot_func __attribute__((optimize("O2","align-functions=16","align-jumps=16")))
    > ...
    >
    > void hot_func super_often_called_func(...) {...}
    >
    > in hot code paths?

    __attribute__((optimize)) is meant for compiler debugging only (to help
    folks to reduce their testcases to a single function).
    It should _not_ be used in production code, because the implementation
    is very buggy.

    --
    Markus


    \
     
     \ /
      Last update: 2015-04-11 16:21    [W:3.080 / U:0.144 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site