Fixed Asan and UBsan detection code. It appears GCC package maintainers are not going to fix the missing libraries

pull/136/head
Jeffrey Walton 2016-02-02 13:44:49 -05:00
parent 4b5677dcfa
commit 82d8c4a8b5
2 changed files with 22 additions and 7 deletions

View File

@ -12,6 +12,19 @@
USING_NAMESPACE(CryptoPP)
USING_NAMESPACE(std)
// Used for testing the compiler and linker in cryptest.sh
#if defined(CRYPTOPP_ADHOC_MAIN)
int main(int argc, char *argv[])
{
CRYPTOPP_UNUSED(argc), CRYPTOPP_UNUSED(argv);
return 0;
}
// Classic use of adhoc to setup calling convention
#else
extern int (*AdhocTest)(int argc, char *argv[]);
int MyAdhocTest(int argc, char *argv[])
@ -21,3 +34,5 @@ int MyAdhocTest(int argc, char *argv[])
}
static int s_i = (AdhocTest = &MyAdhocTest, 0);
#endif

View File

@ -75,7 +75,7 @@ if [ -z "$TMP" ]; then
TMP=/tmp
fi
$CXX -x c++ -Wno-deprecated-declarations adhoc.cpp.proto -c -o $TMP/adhoc > /dev/null 2>&1
$CXX -x c++ -DCRYPTOPP_ADHOC_MAIN -Wno-deprecated-declarations adhoc.cpp.proto -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
ADD_CXXFLAGS="$ADD_CXXFLAGS -Wno-deprecated-declarations"
fi
@ -97,7 +97,7 @@ else
fi
# Set to 0 if you don't have UBsan
$CXX -x c++ -fsanitize=undefined adhoc.cpp.proto -c -o $TMP/adhoc > /dev/null 2>&1
$CXX -x c++ -DCRYPTOPP_ADHOC_MAIN -fsanitize=undefined adhoc.cpp.proto -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ] && [ "$IS_X86" -ne "0" ]; then
HAVE_UBSAN=1
else
@ -105,7 +105,7 @@ else
fi
# Set to 0 if you don't have Asan
$CXX -x c++ -fsanitize=address adhoc.cpp.proto -c -o $TMP/adhoc > /dev/null 2>&1
$CXX -x c++ -DCRYPTOPP_ADHOC_MAIN -fsanitize=address adhoc.cpp.proto -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ] && [ "$IS_X86" -ne "0" ]; then
HAVE_ASAN=1
else
@ -121,7 +121,7 @@ fi
# Set to 0 if you don't have Intel multiarch
HAVE_INTEL_MULTIARCH=0
if [ "$IS_DARWIN" -ne "0" ] && [ "$IS_X86" -ne "0" ]; then
$CXX -x c++ -arch i386 -arch x86_64 -c adhoc.cpp.proto -c -o $TMP/adhoc > /dev/null 2>&1
$CXX -x c++ -DCRYPTOPP_ADHOC_MAIN -arch i386 -arch x86_64 -c adhoc.cpp.proto -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
HAVE_INTEL_MULTIARCH=1
fi
@ -130,7 +130,7 @@ fi
# Set to 0 if you don't have PPC multiarch
HAVE_PPC_MULTIARCH=0
if [ "$IS_DARWIN" -ne "0" ] && [ "$IS_PPC" -ne "0" ]; then
$CXX -x c++ -arch ppc -arch ppc64 -c adhoc.cpp.proto -c -o $TMP/adhoc > /dev/null 2>&1
$CXX -x -DCRYPTOPP_ADHOC_MAIN c++ -arch ppc -arch ppc64 adhoc.cpp.proto -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
HAVE_PPC_MULTIARCH=1
fi
@ -138,7 +138,7 @@ fi
HAVE_X32=0
if [ "$IS_X64" -ne "0" ]; then
$CXX -x c++ -mx32 -c adhoc.cpp.proto -c -o $TMP/adhoc > /dev/null 2>&1
$CXX -x -DCRYPTOPP_ADHOC_MAIN c++ -mx32 adhoc.cpp.proto -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
HAVE_X32=1
fi
@ -1683,7 +1683,7 @@ fi
if [ "$CXX" == "g++" ]; then
CLANG_COMPILER=$(which clang++)
"$CLANG_COMPILER" -x c++ -c adhoc.cpp.proto -c -o $TMP/adhoc > /dev/null 2>&1
"$CLANG_COMPILER" -x c++ -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
############################################