• Huacai Chen's avatar
    LoongArch: Mark __xchg() and __cmpxchg() as __always_inline · ddf50271
    Huacai Chen authored
    Commit ac7c3e4f ("compiler: enable CONFIG_OPTIMIZE_INLINING
    forcibly") allows compiler to uninline functions marked as 'inline'.
    In case of __xchg()/__cmpxchg() this would cause to reference
    BUILD_BUG(), which is an error case for catching bugs and will not
    happen for correct code, if __xchg()/__cmpxchg() is inlined.
    
    This bug can be produced with CONFIG_DEBUG_SECTION_MISMATCH enabled,
    and the solution is similar to below commits:
    46f16195 ("MIPS: include: Mark __xchg as __always_inline"),
    88356d09 ("MIPS: include: Mark __cmpxchg as __always_inline").
    Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
    ddf50271
cmpxchg.h 4.93 KB