Introduce MBEDTLS_OPTIMIZE_ALWAYS

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-06-15 18:42:59 +01:00
parent 7fdfd70b19
commit b055f75c3d

View file

@ -201,4 +201,11 @@ inline void mbedtls_xor(unsigned char *r, const unsigned char *a, const unsigned
#define MBEDTLS_COMPILER_IS_GCC
#endif
/* If -Os is specified, override with -O2 for a given function */
#if defined(MBEDTLS_COMPILER_IS_GCC) && defined(__OPTIMIZE_SIZE__)
#define MBEDTLS_OPTIMIZE_ALWAYS __attribute__((optimize("-O2")))
#else
#define MBEDTLS_OPTIMIZE_ALWAYS
#endif
#endif /* MBEDTLS_LIBRARY_COMMON_H */