aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-04-17 16:06:56 +0000
committerlloyd <[email protected]>2013-04-17 16:06:56 +0000
commit77f0c643c0a575842fda1891f68bebc4bb8d2697 (patch)
treed066a4075efd5450e25780392f6b32e7f85a2c9a /src
parentf1d38d7a08b3939148b3426d00244bad89d23948 (diff)
Always include modules requiring ISA extensions as long as the
compiler and target platform might support it. For instance the AES SSSE3 code is now always in any x86 build, with just that specific file being compiled with -mssse3. Since we'll only call that code if cpuid confirms it works at runtime, we don't have portability issues, and it can be safely included in generic builds (eg for distributions). Tweak how machine specific compiler flags are generated to be a bit easier to maintain.
Diffstat (limited to 'src')
-rw-r--r--src/build-data/arch/arm.txt7
-rw-r--r--src/build-data/arch/ppc32.txt6
-rw-r--r--src/build-data/arch/ppc64.txt6
-rw-r--r--src/build-data/arch/x86_32.txt14
-rw-r--r--src/build-data/arch/x86_64.txt26
-rw-r--r--src/build-data/buildh.in2
-rw-r--r--src/build-data/cc/clang.txt21
-rw-r--r--src/build-data/cc/gcc.txt37
-rw-r--r--src/build-data/cc/xlc.txt2
-rw-r--r--src/build-data/makefile/unix.in21
-rw-r--r--src/build-data/makefile/unix_shr.in26
-rw-r--r--src/simd/simd_altivec/simd_altivec.h2
-rw-r--r--src/simd/simd_sse2/simd_sse2.h2
-rw-r--r--src/utils/cpuid.h7
14 files changed, 94 insertions, 85 deletions
diff --git a/src/build-data/arch/arm.txt b/src/build-data/arch/arm.txt
index b822fe130..627ccf25c 100644
--- a/src/build-data/arch/arm.txt
+++ b/src/build-data/arch/arm.txt
@@ -38,6 +38,7 @@ cortex-a8 -> armv7-a
cortex-a9 -> armv7-a
</submodel_aliases>
-<isa_extn>
-neon:armv7-a
-</isa_extn>
+<isa_extensions>
+neon
+</isa_extensions>
+
diff --git a/src/build-data/arch/ppc32.txt b/src/build-data/arch/ppc32.txt
index e33c8ff24..2f4ca6723 100644
--- a/src/build-data/arch/ppc32.txt
+++ b/src/build-data/arch/ppc32.txt
@@ -25,6 +25,6 @@ g4 -> ppc7450
powerpcspe -> e500v2 # for Debian
</submodel_aliases>
-<isa_extn>
-altivec:ppc7400,ppc7450
-</isa_extn>
+<isa_extensions>
+altivec
+</isa_extensions>
diff --git a/src/build-data/arch/ppc64.txt b/src/build-data/arch/ppc64.txt
index 954d9181e..07436c19d 100644
--- a/src/build-data/arch/ppc64.txt
+++ b/src/build-data/arch/ppc64.txt
@@ -24,6 +24,6 @@ cellppu
cellbroadbandengine -> cellppu
</submodel_aliases>
-<isa_extn>
-altivec:cellppu,ppc970,power6,power7
-</isa_extn>
+<isa_extensions>
+altivec
+</isa_extensions>
diff --git a/src/build-data/arch/x86_32.txt b/src/build-data/arch/x86_32.txt
index 482a53057..4562050af 100644
--- a/src/build-data/arch/x86_32.txt
+++ b/src/build-data/arch/x86_32.txt
@@ -61,8 +61,12 @@ intelcput2600 -> prescott
intelcput2700 -> prescott
</submodel_aliases>
-<isa_extn>
-sse2:pentium4,prescott,pentium-m,atom32
-ssse3:atom32
-movbe:atom32
-</isa_extn>
+<isa_extensions>
+sse2
+ssse3
+sse4.1
+sse4.2
+avx2
+aes-ni
+clmul
+</isa_extensions>
diff --git a/src/build-data/arch/x86_64.txt b/src/build-data/arch/x86_64.txt
index 8d74a193e..608249101 100644
--- a/src/build-data/arch/x86_64.txt
+++ b/src/build-data/arch/x86_64.txt
@@ -12,12 +12,11 @@ x64
<submodels>
k8
-k10
+barcelona
atom
nocona
core2
-nehalem
-westmere
+corei7
sandybridge
ivybridge
</submodels>
@@ -27,18 +26,21 @@ core2duo -> core2
intelcore2 -> core2
intelcore2duo -> core2
+nehalem -> corei7
+westmere -> corei7
+
sledgehammer -> k8
opteron -> k8
amdopteron -> k8
athlon64 -> k8
-barcelona -> k10
-
-corei5cpum520 -> westmere
-corei7cpu860 -> nehalem
</submodel_aliases>
-<isa_extn>
-sse2:all
-ssse3:core2,nehalem,westmere,atom,sandybridge,ivybridge
-aes-ni:westmere,sandybridge,ivybridge
-</isa_extn>
+<isa_extensions>
+sse2
+ssse3
+sse4.1
+sse4.2
+avx2
+aes-ni
+clmul
+</isa_extensions>
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in
index 8be48c295..4e206b192 100644
--- a/src/build-data/buildh.in
+++ b/src/build-data/buildh.in
@@ -7,7 +7,7 @@
* %{user}@%{hostname} running '%{command_line}'
*
* Target
-* - Compiler: %{cc} %{lib_opt} %{mach_opt}
+* - Compiler: %{cc} %{lib_opt}
* - Arch: %{submodel}/%{arch}
* - OS: %{os}
*/
diff --git a/src/build-data/cc/clang.txt b/src/build-data/cc/clang.txt
index 40bdb0a0b..0af44768b 100644
--- a/src/build-data/cc/clang.txt
+++ b/src/build-data/cc/clang.txt
@@ -1,5 +1,3 @@
-# Largely copied from the gcc config
-
macro_name CLANG
binary_name clang++
@@ -11,15 +9,15 @@ add_lib_dir_option -L
add_lib_option -l
lang_flags "-D_REENTRANT -std=c++11"
-warning_flags "-W -Wall"
+warning_flags "-Wextra -Wall"
makefile_style unix
lib_opt_flags "-O3"
check_opt_flags "-O2"
shared_flags "-fPIC"
-debug_flags -g
-no_debug_flags "-finline-functions"
+debug_flags "-g -fno-inline-functions"
+no_debug_flags ""
visibility_build_flags "-fvisibility=hidden"
visibility_attribute '__attribute__((visibility("default")))'
@@ -31,10 +29,17 @@ default -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME)"
darwin -> "$(CXX) -dynamiclib -fPIC -install_name $(LIBDIR)/$(SONAME)"
</so_link_flags>
+<isa_flags>
+"aes-ni" -> "-maes"
+"ssse3" -> "-mssse3"
+"sse2" -> "-msse2"
+</isa_flags>
+
<mach_opt>
-x86_64 -> "-march=SUBMODEL"
-nehalem -> "-march=corei7"
-westmere -> "-march=corei7 -maes"
+x86_64 -> "-march=SUBMODEL"
+nehalem -> "-march=corei7"
+sandybridge -> "-march=corei7-avx"
+ivybridge -> "-march=core-avx-i"
</mach_opt>
<mach_abi_linking>
diff --git a/src/build-data/cc/gcc.txt b/src/build-data/cc/gcc.txt
index 59e9671f5..cfa223098 100644
--- a/src/build-data/cc/gcc.txt
+++ b/src/build-data/cc/gcc.txt
@@ -16,8 +16,7 @@ maintainer_warning_flags "-Werror -Wall -Wextra -Wstrict-aliasing -Wstrict-overf
lib_opt_flags "-O3"
check_opt_flags "-O2"
shared_flags "-fPIC"
-debug_flags -g
-no_debug_flags "-finline-functions"
+debug_flags "-g -fno-inline-functions"
visibility_build_flags "-fvisibility=hidden"
visibility_attribute '__attribute__((visibility("default")))'
@@ -39,22 +38,25 @@ hpux -> "$(CXX) -shared -fPIC -Wl,+h,$(SONAME)"
solaris -> "$(CXX) -shared -fPIC -Wl,-h,$(SONAME)"
</so_link_flags>
+<isa_flags>
+"sse2" -> "-msse2"
+"ssse3" -> "-mssse3"
+"sse4.1" -> "-msse4.1"
+"sse4.2" -> "-msse4.2"
+"avx" -> "-mavx"
+"aes-ni" -> "-maes"
+</isa_flags>
+
<mach_opt>
# Avoid using -march=i[345]86, instead tune for generic
-i386 -> "-mtune=generic -momit-leaf-frame-pointer"
-i486 -> "-mtune=generic -momit-leaf-frame-pointer"
-i586 -> "-mtune=generic -momit-leaf-frame-pointer"
+i386 -> "-mtune=generic"
+i486 -> "-mtune=generic"
+i586 -> "-mtune=generic"
# Translate to GCC-speak
-nehalem -> "-march=corei7 -momit-leaf-frame-pointer"
-westmere -> "-march=corei7 -maes -momit-leaf-frame-pointer"
-
-#nehalem -> "-march=core2 -msse4.1 -msse4.2 -momit-leaf-frame-pointer"
-#westmere -> "-march=core2 -msse4.1 -msse4.2 -maes -momit-leaf-frame-pointer"
-
-sandybridge -> "-march=corei7-avx -momit-leaf-frame-pointer"
-ivybridge -> "-march=core-avx-i -momit-leaf-frame-pointer"
-atom32 -> "-march=atom -momit-leaf-frame-pointer"
+nehalem -> "-march=corei7"
+sandybridge -> "-march=corei7-avx"
+ivybridge -> "-march=core-avx-i"
ppc601 -> "-mpowerpc -mcpu=601"
cellppu -> "-mcpu=cell"
@@ -83,8 +85,11 @@ ppc32 -> "-mcpu=SUBMODEL" ppc
ppc64 -> "-mcpu=SUBMODEL" ppc
sparc32 -> "-mcpu=SUBMODEL -Wa,-xarch=v8plus" sparc32-
sparc64 -> "-mcpu=v9 -mtune=SUBMODEL"
-x86_32 -> "-march=SUBMODEL -momit-leaf-frame-pointer"
-x86_64 -> "-march=SUBMODEL -momit-leaf-frame-pointer"
+x86_32 -> "-march=SUBMODEL"
+x86_64 -> "-march=SUBMODEL"
+
+all_x86_32 -> "-momit-leaf-frame-pointer"
+all_x86_64 -> "-momit-leaf-frame-pointer"
</mach_opt>
# The 'linking' bit means "use this for both compiling *and* linking"
diff --git a/src/build-data/cc/xlc.txt b/src/build-data/cc/xlc.txt
index 87b32746b..609439243 100644
--- a/src/build-data/cc/xlc.txt
+++ b/src/build-data/cc/xlc.txt
@@ -21,8 +21,6 @@ cellppu -> "-qarch=cell"
ppc970 -> "-qarch=ppc970"
power4 -> "-qarch=pwr4"
power5 -> "-qarch=pwr5"
-
-cellppu -> "-qarch=cell"
</mach_opt>
<so_link_flags>
diff --git a/src/build-data/makefile/unix.in b/src/build-data/makefile/unix.in
index 5290beda8..ca881d65d 100644
--- a/src/build-data/makefile/unix.in
+++ b/src/build-data/makefile/unix.in
@@ -7,6 +7,9 @@ LANG_FLAGS = %{lang_flags}
WARN_FLAGS = %{warn_flags}
LINK_TO = %{link_to}
+LIB_FLAGS = $(LIB_OPT) $(MACH_OPT) $(LANG_FLAGS) $(WARN_FLAGS)
+CHECK_FLAGS = $(CHECK_OPT) $(LANG_FLAGS) $(WARN_FLAGS)
+
# Version Numbers
VERSION = %{version}
SERIES = %{version_major}.%{version_minor}
@@ -38,6 +41,14 @@ RANLIB = %{ranlib_command}
RM = @rm -f
RM_R = @rm -rf
+# Targets
+LIBRARIES = $(STATIC_LIB)
+
+LIBNAME = %{lib_prefix}libbotan
+STATIC_LIB = $(LIBNAME)-$(SERIES).a
+
+all: $(LIBRARIES)
+
# File Lists
CHECK = %{check_prefix}check
@@ -47,16 +58,6 @@ LIBOBJS = %{lib_objs}
CHECKOBJS = %{check_objs}
-LIB_FLAGS = $(LIB_OPT) $(MACH_OPT) $(LANG_FLAGS) $(WARN_FLAGS)
-CHECK_FLAGS = $(CHECK_OPT) $(LANG_FLAGS) $(WARN_FLAGS)
-
-LIBRARIES = $(STATIC_LIB)
-
-LIBNAME = %{lib_prefix}libbotan
-STATIC_LIB = $(LIBNAME)-$(SERIES).a
-
-all: $(LIBRARIES)
-
# Build Commands
%{lib_build_cmds}
diff --git a/src/build-data/makefile/unix_shr.in b/src/build-data/makefile/unix_shr.in
index 31060afbb..806969a00 100644
--- a/src/build-data/makefile/unix_shr.in
+++ b/src/build-data/makefile/unix_shr.in
@@ -2,13 +2,15 @@
CXX = %{cc}
LIB_OPT = %{lib_opt}
CHECK_OPT = %{check_opt}
-MACH_OPT = %{mach_opt}
LANG_FLAGS = %{lang_flags}
WARN_FLAGS = %{warn_flags}
SO_OBJ_FLAGS = %{shared_flags}
SO_LINK_CMD = %{so_link}
LINK_TO = %{link_to}
+LIB_FLAGS = $(LIB_OPT) $(LANG_FLAGS) $(WARN_FLAGS) $(SO_OBJ_FLAGS)
+CHECK_FLAGS = $(CHECK_OPT) $(LANG_FLAGS) $(WARN_FLAGS)
+
# Version Numbers
VERSION = %{version}
SERIES = %{version_major}.%{version_minor}
@@ -40,18 +42,7 @@ RANLIB = %{ranlib_command}
RM = @rm -f
RM_R = @rm -rf
-# File Lists
-CHECK = %{check_prefix}check
-
-HEADERS = %{include_files}
-
-LIBOBJS = %{lib_objs}
-
-CHECKOBJS = %{check_objs}
-
-LIB_FLAGS = $(LIB_OPT) $(MACH_OPT) $(LANG_FLAGS) $(WARN_FLAGS) $(SO_OBJ_FLAGS)
-CHECK_FLAGS = $(CHECK_OPT) $(LANG_FLAGS) $(WARN_FLAGS)
-
+# Targets
LIBRARIES = $(STATIC_LIB) $(SHARED_LIB)
LIBNAME = %{lib_prefix}libbotan
@@ -64,6 +55,15 @@ SYMLINK = $(LIBNAME)-$(SERIES).%{so_suffix}
all: $(LIBRARIES)
+# File Lists
+CHECK = %{check_prefix}check
+
+HEADERS = %{include_files}
+
+LIBOBJS = %{lib_objs}
+
+CHECKOBJS = %{check_objs}
+
# Build Commands
%{lib_build_cmds}
diff --git a/src/simd/simd_altivec/simd_altivec.h b/src/simd/simd_altivec/simd_altivec.h
index 4c412ddec..f675587bc 100644
--- a/src/simd/simd_altivec/simd_altivec.h
+++ b/src/simd/simd_altivec/simd_altivec.h
@@ -8,7 +8,7 @@
#ifndef BOTAN_SIMD_ALTIVEC_H__
#define BOTAN_SIMD_ALTIVEC_H__
-#if defined(BOTAN_TARGET_CPU_HAS_ALTIVEC)
+#if defined(BOTAN_TARGET_SUPPORTS_ALTIVEC)
#include <botan/loadstor.h>
#include <botan/cpuid.h>
diff --git a/src/simd/simd_sse2/simd_sse2.h b/src/simd/simd_sse2/simd_sse2.h
index 61fce99a9..6cbed1df8 100644
--- a/src/simd/simd_sse2/simd_sse2.h
+++ b/src/simd/simd_sse2/simd_sse2.h
@@ -8,7 +8,7 @@
#ifndef BOTAN_SIMD_SSE_H__
#define BOTAN_SIMD_SSE_H__
-#if defined(BOTAN_TARGET_CPU_HAS_SSE2)
+#if defined(BOTAN_TARGET_SUPPORTS_SSE2)
#include <botan/cpuid.h>
#include <emmintrin.h>
diff --git a/src/utils/cpuid.h b/src/utils/cpuid.h
index cdc6417ec..14ac6ad39 100644
--- a/src/utils/cpuid.h
+++ b/src/utils/cpuid.h
@@ -77,12 +77,6 @@ class BOTAN_DLL CPUID
{ return x86_processor_flags_has(CPUID_PCMUL_BIT); }
/**
- * Check if the processor supports MOVBE
- */
- static bool has_movbe()
- { return x86_processor_flags_has(CPUID_MOVBE_BIT); }
-
- /**
* Check if the processor supports RDRAND
*/
static bool has_rdrand()
@@ -100,7 +94,6 @@ class BOTAN_DLL CPUID
CPUID_SSSE3_BIT = 41,
CPUID_SSE41_BIT = 51,
CPUID_SSE42_BIT = 52,
- CPUID_MOVBE_BIT = 54,
CPUID_AESNI_BIT = 57,
CPUID_AVX_BIT = 60,
CPUID_RDRAND_BIT = 62