Skip to content

Commit

Permalink
Add compatibility with GCC <= 11.2
Browse files Browse the repository at this point in the history
GCC versions prior to 11.3 do not support the "mwait" target attribute.
This change adds compiler version checks to the pragmas using this
attribute, enabling builds with GCC 11.1 & 11.2.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #4
  • Loading branch information
andreittr authored and unikraft-bot committed Aug 15, 2023
1 parent 23be826 commit a125e40
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include-gcc/mwaitintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
#ifndef _MWAITINTRIN_H_INCLUDED
#define _MWAITINTRIN_H_INCLUDED

#if ((__GNUC__ >= 12) || (__GNUC__ == 11 && __GNUC_MINOR__ >= 3))
#ifndef __MWAIT__
#pragma GCC push_options
#pragma GCC target("mwait")
#define __DISABLE_MWAIT__
#endif /* __MWAIT__ */
#endif /* GCC >= 11.3 */

extern __inline void
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
Expand Down

0 comments on commit a125e40

Please sign in to comment.