Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: LGPL-2.1-only OR MIT */
0002 /*
0003  * rseq/compiler.h
0004  *
0005  * Work-around asm goto compiler bugs.
0006  *
0007  * (C) Copyright 2021 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
0008  */
0009 
0010 #ifndef RSEQ_COMPILER_H
0011 #define RSEQ_COMPILER_H
0012 
0013 /*
0014  * gcc prior to 4.8.2 miscompiles asm goto.
0015  * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
0016  *
0017  * gcc prior to 8.1.0 miscompiles asm goto at O1.
0018  * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103908
0019  *
0020  * clang prior to version 13.0.1 miscompiles asm goto at O2.
0021  * https://github.com/llvm/llvm-project/issues/52735
0022  *
0023  * Work around these issues by adding a volatile inline asm with
0024  * memory clobber in the fallthrough after the asm goto and at each
0025  * label target.  Emit this for all compilers in case other similar
0026  * issues are found in the future.
0027  */
0028 #define rseq_after_asm_goto()   asm volatile ("" : : : "memory")
0029 
0030 #endif  /* RSEQ_COMPILER_H_ */