• Vasily Gorbik's avatar
    s390/nospec: add an option to use thunk-extern · 1d2ad084
    Vasily Gorbik authored
    Currently with -mindirect-branch=thunk and -mfunction-return=thunk compiler
    options expoline thunks are put into individual COMDAT group sections. s390
    is the only architecture which has group sections and it has implications
    for kpatch and objtool tools support.
    
    Using -mindirect-branch=thunk-extern and -mfunction-return=thunk-extern
    is an alternative, which comes with a need to generate all required
    expoline thunks manually. Unfortunately modules area is too far away from
    the kernel image, and expolines from the kernel image cannon be used.
    But since all new distributions (except Debian) build kernels for machine
    generations newer than z10, where "exrl" instruction is available, that
    leaves only 16 expolines thunks possible.
    
    Provide an option to build the kernel with
    -mindirect-branch=thunk-extern and -mfunction-return=thunk-extern for
    z10 or newer. This also requires to postlink expoline thunks into all
    modules explicitly. Currently modules already contain most expolines
    anyhow.
    
    Unfortunately -mindirect-branch=thunk-extern and
    -mfunction-return=thunk-extern options support is broken in gcc <= 11.2.
    Additional compile test is required to verify proper gcc support.
    Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
    Co-developed-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
    Signed-off-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
    Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
    1d2ad084
gcc-thunk-extern.sh 553 Bytes