I finally was able to clear some time and deep dive this issue.
The answer to "will they be fix" is Yes.
There are four or five issues in play. Three or four stem from LLVM and the integrated assembler. The last is undecided, but I *think* it has to do with the incompatibility discussed
http://clang.llvm.org/compatibility.html#inline-asm.
Regarding the integrated assembler, there are two assemblers available: one is the integrated assembler built into Clang. The second is the traditional assembler, like GNU AS (GAS). The former is giving us the trouble at the moment (not the latter)
Issue 1: Crypto++ misidentifies the opportunity to provide ASM implementation because Clang returns an error rather than a version string. You see the misidentification by way of -DCRYPTOPP_DISABLE_ASM. A bug report was filed at
https://llvm.org/bugs/show_bug.cgi?id=24200. This will become an issue in the future, but its OK for now.
Issue 2: LLVM Bug 18916 - "don't err on '.att_syntax prefix'",
https://llvm.org/bugs/show_bug.cgi?id=18916. Right now we are keying on a config.h define called WORKAROUND_LLVM_BUG_18916. We use it to fixup the string literals with the {prefix|noprefix} part. This issue is effectively cleared now.
Issue 3: We have no way to tell when the integrated assembler is being used at the source level (think preprocessor macros). That's going to create problems later, when the 18916 bug is fixed. Right now we are keying on a config.h define called WORKAROUND_LLVM_BUG_18916. I have an idea of how to fix it. I'll take it to the list when the time is right.
Issue 4: the integrated assembler requires each ASM statement to be on a separate line; while GCC effectively allows them to be concatenated with a semi-colon. Remember WORKAROUND_LLVM_BUG_18916? When it get fixed and WORKAROUND_LLVM_BUG_18916 goes away, we won't know when to add the newlines. This issue is effectively cleared now.
Issue 5: I suspect this issue is related to
http://clang.llvm.org/compatibility.html#inline-asm. With the other issues cleared, that's all I have remaining to clear and then we can review and check-in. The issues are like the following, and produce an "Illegal operand size" or similar.
movd rdi, mmx0
**********
Related to issue (1), we can do this to tame use of DCRYPTOPP_DISABLE_ASM because `GAS210_OR_LATER ?= ...` allows an environment or command line override. Its kind of a hack, but it will be addressed properly in the future.
This will get you into the ASM code paths:
make GAS210_OR_LATER=1 GAS217_OR_LATER=1 GAS219_OR_LATER=1
$ cat GNUmakefile.diff
diff --git a/GNUmakefile b/GNUmakefile
index 2b5bcc2..3f48cc5 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -25,9 +25,9 @@ ifeq ($(PREFIX),)
PREFIX = /usr
endif
-# Sadly, we can't actually use GCC_PRAGMA_AWARE because of GCC bug 53431.
-# Its a shame because GCC has so much to offer by the way of analysis.
-#
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431+# Sadly, we can't actually use GCC_PRAGMA_AWARE with GCC because of GCC bug 53431.
+# Its a shame because GCC has so much to offer by the way of analysis. Clang works
+# as expected, though.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431 ifneq ($(CLANG_COMPILER),0)
CXXFLAGS += -Wall
endif
@@ -36,26 +36,41 @@ ifeq ($(IS_X86),1)
GCC42_OR_LATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "^gcc version (4.[2-9]|[5-9])")
ICC111_OR_LATER = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\) ([2-9][0-9]|1[2-9]|11\.[1-9])")
-GAS210_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-9]|[3-9])")
-GAS217_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
-GAS219_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
+GAS210_OR_LATER ?= $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-9]|[3-9])")
+GAS217_OR_LATER ?= $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
+GAS219_OR_LATER ?= $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
# Enable PIC for x86_64 targets
ifneq ($(IS_X86_64),0)
CXXFLAGS += -fPIC
endif # PIC for x86_64 targets
-# Undefined Behavior Sanitzier (Clang and G++)
+# Undefined Behavior Sanitizer (Clang 3.2 and GCC 4.8 and above)
ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
CXXFLAGS += -fsanitize=undefined
-# CXXFLAGS += -fsanitize-undefined-trap-on-error
+# CXXFLAGS += -fsanitize-undefined-trap-on-error
endif # UBsan
-# Address Sanitzier (Clang and G++)
+# Address Sanitizer (Clang 3.2 and GCC 4.8 and above)
ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
CXXFLAGS += -fsanitize=address
endif # Asan
+# Test CXXFLAGS in case the user passed the flags directly through it
+ASAN = 0
+UBSAN = 0
+ifeq ($(findstring -fsanitize=address,$(CXXFLAGS)),-fsanitize=address)
+ASAN = 1
+endif
+ifeq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),-fsanitize=undefined)
+UBSAN = 1
+endif
+
+# Enforce Sanitizer business logic...
+ifeq ($(ASAN)$(UBSAN),11)
+$(error Asan and UBsan are mutually exclusive)
+endif
+
# Cygwin work arounds
ifneq ($(IS_CYGWIN),0)
**********
Jeff