diff --git a/Makefile.mk b/Makefile.mk index aef546398..b7b16e09a 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -164,7 +164,7 @@ CFLAGS_WERROR ?= -Werror CFLAGS_WFATAL_ERRORS ?= -Wfatal-errors # Optimizations -CFLAGS_OPTIMIZE ?= -O2 -flto +CFLAGS_OPTIMIZE ?= -O3 -flto CFLAGS_NO_OPTIMIZE ?= -O0 LDFLAGS_OPTIMIZE ?= LDFLAGS_NO_OPTIMIZE ?= diff --git a/src/libruntime/jerry-libc.c b/src/libruntime/jerry-libc.c index f0e14c802..bf862755c 100644 --- a/src/libruntime/jerry-libc.c +++ b/src/libruntime/jerry-libc.c @@ -37,6 +37,19 @@ extern void *memset(void *s, int c, size_t n); */ extern void *memmove(void *s1, const void*s2, size_t n); +#ifdef __GNUC__ +/* + * Making GCC not to replace: + * - __memcpy -> call to memcpy; + * - __memset -> call to memset; + * - __memmove -> call to memmove. + */ +CALL_PRAGMA(GCC diagnostic push) +CALL_PRAGMA(GCC diagnostic ignored "-Wpragmas") +CALL_PRAGMA(GCC push_options) +CALL_PRAGMA(GCC optimize ("-fno-tree-loop-distribute-patterns")) +#endif /* __GNUC__ */ + /** * memcpy alias to __memcpy (for compiler usage) */ @@ -66,6 +79,12 @@ void* memmove(void *s1, /**< destination*/ { return __memmove(s1, s2, n); } /* memmove */ + +#ifdef __GNUC__ +CALL_PRAGMA(GCC pop_options) +CALL_PRAGMA(GCC diagnostic pop) +#endif /* __GNUC__ */ + #endif /* LIBC_MUSL */ /**