[CRIU] [PATCH 1/3] arm: rm -Wa from CFLAGS

Kir Kolyshkin kir at openvz.org
Thu Nov 3 16:39:39 PDT 2016


Somehow clang doesn't always like -Wa flags, for example when making
dependencies (see commit 9303ed3 ("Makefiles: move -Wa,--noexecstack
out of CFLAGS"), which causes build break, scary error messages, and
even hair loss.

There are many ways to solve this. This patch employs the one
that is simple and clean.

The -Wa,-mimplicit-it=always flag was added by commit 79c4b74
("arm: fix compilation on ARMv7"). The reason is, ARM needs an IT
instruction before certain conditionals. Those IT instructions are
almost always automatically generated by assembler itself, but in some
cases a special assembler flag (like the one above) is needed.

As there is only one place in the code that need IT, it's easy to patch
it (add explicit IT) and remove the flag. Note that "IT" generates
no machine code per se, so there should not be any functional change
(although I haven't checked it).

For more info on IT, see http://tinyurl.com/z3ldsdr

Hope for a review from our ARM experts.

Cc: Christopher Covington <cov at codeaurora.org>
Cc: Dmitry Safonov <dsafonov at virtuozzo.com>
Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 Makefile                             | 2 --
 include/common/arch/arm/asm/atomic.h | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 4055fc8..5e15e75 100644
--- a/Makefile
+++ b/Makefile
@@ -61,8 +61,6 @@ ifeq ($(ARCH),arm)
         ARMV		:= $(shell echo $(UNAME-M) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
         DEFINES		:= -DCONFIG_ARMV$(ARMV)
 
-        USERCFLAGS += -Wa,-mimplicit-it=always
-
         ifeq ($(ARMV),6)
                 USERCFLAGS += -march=armv6
         endif
diff --git a/include/common/arch/arm/asm/atomic.h b/include/common/arch/arm/asm/atomic.h
index 95a8b70..062411d 100644
--- a/include/common/arch/arm/asm/atomic.h
+++ b/include/common/arch/arm/asm/atomic.h
@@ -27,6 +27,7 @@ static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
 		"ldrex	%1, [%3]\n"
 		"mov	%0, #0\n"
 		"teq	%1, %4\n"
+		"it	eq\n"
 		"strexeq %0, %5, [%3]\n"
 		    : "=&r" (res), "=&r" (oldval), "+Qo" (ptr->counter)
 		    : "r" (&ptr->counter), "Ir" (old), "r" (new)
-- 
2.7.4



More information about the CRIU mailing list