resolve illegal instuction issue caused by -march=native

This commit is contained in:
Ralf Senderek 2022-03-04 21:40:36 +01:00
parent 655fc2b1e8
commit 1c529bdf11
5 changed files with 52 additions and 37 deletions

View File

@ -1,11 +0,0 @@
--- cl-original/makefile 2021-12-03 15:53:24.172492715 +0100
+++ cl-patched/makefile 2021-12-03 15:54:55.914497971 +0100
@@ -92,7 +92,7 @@
#
# Standard build flags
-CFLAGS = -c -D__UNIX__ -DNDEBUG -I.
+CFLAGS = -c -D__UNIX__ -DNDEBUG -I. $(ADDFLAGS)
CFLAGS_DEBUG = -c -D__UNIX__ -I. -g -O1
CFLAGS_DEBUGGCC = -c -D__UNIX__ -I. -ggdb3 -fno-omit-frame-pointer -O1

21
configpatch Normal file
View File

@ -0,0 +1,21 @@
--- cl-original/misc/config.h 2022-03-04 17:55:32.643896948 +0100
+++ cl-patched/misc/config.h 2022-03-04 19:46:36.843663542 +0100
@@ -218,7 +218,7 @@
/* Whether to build the Java/JNI interface or not */
-/* #define USE_JAVA */
+#define USE_JAVA
/* Whether to provide descriptive text messages for errors or not.
Disabling these can reduce code size, at the expense of making error
@@ -1327,4 +1327,9 @@
#undef USE_ERRMSGS
#endif /* 0 */
+#undef USE_IDEA
+#undef USE_OBSCURE_ALGORITHMS
+#undef USE_PATENTED_ALGORITHMS
+#define USE_SHA2_EXT
+
#endif /* _CONFIG_DEFINED */

View File

@ -1,32 +1,33 @@
%global includetests 0
%global includetests 1
# 0=no, 1=yes
%global cryptlibdir %{_libdir}/%{name}
%global withpython2 0
Name: cryptlib
Version: 3.4.6
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Security library and toolkit for encryption and authentication services
License: Sleepycat and OpenSSL
URL: https://www.cs.auckland.ac.nz/~pgut001/cryptlib
Source0: https://crypto-bone.com/fedora/cl346_fedora.zip
Source1: https://crypto-bone.com/fedora/cl346_fedora.zip.sig
Source0: https://senderek.ie/fedora/cl346_fedora.zip
Source1: https://senderek.ie/fedora/cl346_fedora.zip.sig
# for security reasons a public signing key should always be stored in distgit
# and never be used with a URL to make impersonation attacks harder
# (verified: https://senderek.ie/keys/codesigningkey)
Source2: gpgkey-3274CB29956498038A9C874BFBF6E2C28E9C98DD.asc
Source3: https://crypto-bone.com/fedora/README-manual
Source4: https://crypto-bone.com/fedora/cryptlib-tests.tar.gz
Source5: https://crypto-bone.com/fedora/cryptlib-perlfiles.tar.gz
Source3: https://senderek.ie/fedora/README-manual
Source4: https://senderek.ie/fedora/cryptlib-tests.tar.gz
Source5: https://senderek.ie/fedora/cryptlib-perlfiles.tar.gz
# soname is now libcl.so.3.4
Patch1: flagspatch
Patch2: javapatch
Patch2: configpatch
Patch3: errorpatch
Patch4: testpatch
Patch5: x86-64patch
ExclusiveArch: x86_64 aarch64 ppc64 ppc64le
ExclusiveArch: x86_64 aarch64 ppc64le
BuildRequires: gcc
BuildRequires: libbsd-devel
@ -145,6 +146,7 @@ cd %{name}-%{version}
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
# remove pre-build jar file
rm %{_builddir}/%{name}-%{version}/bindings/cryptlib.jar
@ -166,10 +168,10 @@ cp /etc/alternatives/java_sdk/include/jni.h .
cp /etc/alternatives/java_sdk/include/linux/jni_md.h .
make clean
make shared %{?_smp_mflags} ADDFLAGS="%{optflags}"
make shared ADDFLAGS="%{optflags}"
ln -s libcl.so.3.4.6 libcl.so
ln -s libcl.so libcl.so.3.4
make stestlib %{?_smp_mflags} ADDFLAGS="%{optflags}"
make stestlib ADDFLAGS="%{optflags}"
# build python modules
cd bindings
@ -259,12 +261,12 @@ tar xpzf %{SOURCE4}
# in KOJI tests must be disabled as there is no networking
%if %{includetests}
cd %{_builddir}/%{name}-%{version}
ln -s libcl.so.3.4.6 ./libcl.so.3.4
export LD_LIBRARY_PATH=.
echo "Running tests on the cryptlib library. This will take a few minutes."
echo "Network access is necessary to complete all tests!"
./stestlib > %{_builddir}/%{name}-%{version}/stestlib.log
cp %{_builddir}/%{name}-%{version}/stestlib.log %{buildroot}%{_docdir}/%{name}/stestlib.log
cp %{buildroot}%{cryptlibdir}/c/cryptlib-test.c .
sed -i '41s/<cryptlib\/cryptlib.h>/\".\/cryptlib.h\"/' cryptlib-test.c
gcc -o cryptlib-test cryptlib-test.c -L. libcl.so.3.4.6
./cryptlib-test
%endif
@ -311,6 +313,9 @@ tar xpzf %{SOURCE4}
%changelog
* Fri Mar 04 2022 Ralf Senderek <innovation@senderek.ie> - 3.4.6-6
- Define -march=x86-64
* Sat Feb 26 2022 Ralf Senderek <innovation@senderek.ie> - 3.4.6-5
- Correct date in test/cert.c

View File

@ -1,11 +0,0 @@
--- cl-original/misc/config.h 2021-12-03 16:43:09.959891808 +0100
+++ cl-patched/misc/config.h 2021-12-03 16:44:07.248896490 +0100
@@ -218,7 +218,7 @@
/* Whether to build the Java/JNI interface or not */
-/* #define USE_JAVA */
+#define USE_JAVA
/* Whether to provide descriptive text messages for errors or not.
Disabling these can reduce code size, at the expense of making error

11
x86-64patch Normal file
View File

@ -0,0 +1,11 @@
--- cl-original/tools/ccopts.sh 2022-03-04 19:32:14.642320216 +0100
+++ cl-patched/tools/ccopts.sh 2022-03-04 19:45:06.169944941 +0100
@@ -897,7 +897,7 @@
if [ $GENERICBUILD -gt 0 ] ; then
echo " (Enabling lowest-common-denominator build options for cross-platform library)." >&2 ;
else
- CCARGS="$CCARGS -march=native -mtune=generic" ;
+ CCARGS="$CCARGS -march=x86-64 -mtune=generic" ;
fi
if [ "$ARCH" = "x86_64" ] ; then
CCARGS="$CCARGS -fPIC" ;