summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2003-01-03 17:37:53 +0000
committerAndy Polyakov <appro@openssl.org>2003-01-03 17:37:53 +0000
commit3cc9a89dda7165f9363f06db3559c5dea043bb73 (patch)
tree0920468b8b2b0a951d32107856055d6007ff6875 /crypto
parent46a0d4fbcb7577dd97e223e90d0a34044d4595d6 (diff)
Unified targets for ELF assembler modules. Tested on Linux, Solaris and
FreeBSD. Goal is to extend support even to SCO5, UnixWare/OpenUnix...
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bf/Makefile.ssl12
-rw-r--r--crypto/bn/Makefile.ssl29
-rw-r--r--crypto/cast/Makefile.ssl12
-rw-r--r--crypto/des/Makefile.ssl31
-rw-r--r--crypto/des/asm/crypt586.pl5
-rw-r--r--crypto/des/asm/des-586.pl5
-rw-r--r--crypto/md5/Makefile.ssl20
-rw-r--r--crypto/perlasm/x86asm.pl7
-rw-r--r--crypto/perlasm/x86unix.pl26
-rw-r--r--crypto/rc4/Makefile.ssl12
-rw-r--r--crypto/rc5/Makefile.ssl12
-rw-r--r--crypto/ripemd/Makefile.ssl12
-rw-r--r--crypto/sha/Makefile.ssl12
13 files changed, 67 insertions, 128 deletions
diff --git a/crypto/bf/Makefile.ssl b/crypto/bf/Makefile.ssl
index bd3cedc4f8..bb14a0ee82 100644
--- a/crypto/bf/Makefile.ssl
+++ b/crypto/bf/Makefile.ssl
@@ -49,14 +49,8 @@ lib: $(LIBOBJ)
@touch lib
# elf
-asm/bx86-elf.o: asm/bx86unix.cpp
- $(CPP) -DELF -x c asm/bx86unix.cpp | as -o asm/bx86-elf.o
-
-# solaris
-asm/bx86-sol.o: asm/bx86unix.cpp
- $(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s
- as -o asm/bx86-sol.o asm/bx86-sol.s
- rm -f asm/bx86-sol.s
+asm/bx86-elf.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
+ (cd asm; $(PERL) bf-586.pl elf $(CFLAGS) $(PROCESSOR) > bx86-elf.s)
# a.out
asm/bx86-out.o: asm/bx86unix.cpp
@@ -103,7 +97,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f asm/bx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f asm/bx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/bn/Makefile.ssl b/crypto/bn/Makefile.ssl
index b709c84adc..c109411d4b 100644
--- a/crypto/bn/Makefile.ssl
+++ b/crypto/bn/Makefile.ssl
@@ -23,14 +23,6 @@ BN_ASM= bn_asm.o
CFLAGS= $(INCLUDES) $(CFLAG)
-# We let the C compiler driver to take care of .s files. This is done in
-# order to be excused from maintaining a separate set of architecture
-# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
-# gcc, then the driver will automatically translate it to -xarch=v8plus
-# and pass it down to assembler.
-AS=$(CC) -c
-ASFLAGS=$(CFLAGS)
-
GENERAL=Makefile
TEST=bntest.c exptest.c
APPS=
@@ -75,22 +67,11 @@ lib: $(LIBOBJ)
@touch lib
# elf
-asm/bn86-elf.o: asm/bn86unix.cpp
- $(CPP) -DELF -x c asm/bn86unix.cpp | as -o asm/bn86-elf.o
-
-asm/co86-elf.o: asm/co86unix.cpp
- $(CPP) -DELF -x c asm/co86unix.cpp | as -o asm/co86-elf.o
-
-# solaris
-asm/bn86-sol.o: asm/bn86unix.cpp
- $(CC) -E -DSOL asm/bn86unix.cpp | sed 's/^#.*//' > asm/bn86-sol.s
- as -o asm/bn86-sol.o asm/bn86-sol.s
- rm -f asm/bn86-sol.s
+asm/bn86-elf.s: asm/bn-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) bn-586.pl elf $(CFLAGS) > bn86-elf.s)
-asm/co86-sol.o: asm/co86unix.cpp
- $(CC) -E -DSOL asm/co86unix.cpp | sed 's/^#.*//' > asm/co86-sol.s
- as -o asm/co86-sol.o asm/co86-sol.s
- rm -f asm/co86-sol.s
+asm/co86-elf.s: asm/co-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) co-586.pl elf $(CFLAGS) > co86-elf.s)
# a.out
asm/bn86-out.o: asm/bn86unix.cpp
@@ -180,7 +161,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f asm/co86unix.cpp asm/bn86unix.cpp *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff bn_asm.s
+ rm -f asm/co86unix.cpp asm/bn86unix.cpp asm/*-elf.* *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff bn_asm.s
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/cast/Makefile.ssl b/crypto/cast/Makefile.ssl
index c18d86845e..70c47bf8e6 100644
--- a/crypto/cast/Makefile.ssl
+++ b/crypto/cast/Makefile.ssl
@@ -52,14 +52,8 @@ lib: $(LIBOBJ)
@touch lib
# elf
-asm/cx86-elf.o: asm/cx86unix.cpp
- $(CPP) -DELF -x c asm/cx86unix.cpp | as -o asm/cx86-elf.o
-
-# solaris
-asm/cx86-sol.o: asm/cx86unix.cpp
- $(CC) -E -DSOL asm/cx86unix.cpp | sed 's/^#.*//' > asm/cx86-sol.s
- as -o asm/cx86-sol.o asm/cx86-sol.s
- rm -f asm/cx86-sol.s
+asm/cx86-elf.s: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
+ (cd asm; $(PERL) cast-586.pl elf $(CLAGS) $(PROCESSOR) > cx86-elf.s)
# a.out
asm/cx86-out.o: asm/cx86unix.cpp
@@ -104,7 +98,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f asm/cx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f asm/cx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/des/Makefile.ssl b/crypto/des/Makefile.ssl
index 93979d497a..149d5a81ec 100644
--- a/crypto/des/Makefile.ssl
+++ b/crypto/des/Makefile.ssl
@@ -77,30 +77,11 @@ asm/des_enc-sparc.S: asm/des_enc.m4
m4 -B 8192 asm/des_enc.m4 > asm/des_enc-sparc.S
# elf
-asm/dx86-elf.o: asm/dx86unix.cpp
- $(CPP) -DELF \
- `(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC; exit 0`\
- -x c asm/dx86unix.cpp | as -o asm/dx86-elf.o
-
-asm/yx86-elf.o: asm/yx86unix.cpp
- $(CPP) -DELF \
- `(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC; exit 0`\
- -x c asm/yx86unix.cpp | as -o asm/yx86-elf.o
-
-# solaris
-asm/dx86-sol.o: asm/dx86unix.cpp
- $(CC) -E -DSOL \
- `(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC; exit 0`\
- asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s
- as -o asm/dx86-sol.o asm/dx86-sol.s
- rm -f asm/dx86-sol.s
-
-asm/yx86-sol.o: asm/yx86unix.cpp
- $(CC) -E -DSOL \
- `(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC; exit 0`\
- asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s
- as -o asm/yx86-sol.o asm/yx86-sol.s
- rm -f asm/yx86-sol.s
+asm/dx86-elf.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
+ (cd asm; $(PERL) des-586.pl elf $(CFLAGS) > dx86-elf.s)
+
+asm/yx86-elf.s: asm/crypt586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
+ (cd asm; $(PERL) crypt586.pl elf $(CFLAGS) > yx86-elf.s)
# a.out
asm/dx86-out.o: asm/dx86unix.cpp
@@ -156,7 +137,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f asm/dx86unix.cpp asm/yx86unix.cpp *.o asm/*.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f asm/dx86unix.cpp asm/yx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/des/asm/crypt586.pl b/crypto/des/asm/crypt586.pl
index 51fb3ddf26..1d04ed6def 100644
--- a/crypto/des/asm/crypt586.pl
+++ b/crypto/des/asm/crypt586.pl
@@ -32,8 +32,9 @@ sub fcrypt_body
&xor( $R, $R);
# PIC-ification:-)
- if ($cpp) { &picmeup("edx","DES_SPtrans"); }
- else { &lea("edx",&DWP("DES_SPtrans")); }
+ &picmeup("edx","DES_SPtrans");
+ #if ($cpp) { &picmeup("edx","DES_SPtrans"); }
+ #else { &lea("edx",&DWP("DES_SPtrans")); }
&push("edx"); # becomes &swtmp(1)
#
&mov($trans,&wparam(1)); # reloaded with DES_SPtrans in D_ENCRYPT
diff --git a/crypto/des/asm/des-586.pl b/crypto/des/asm/des-586.pl
index 7a58869289..b75d3c6b3a 100644
--- a/crypto/des/asm/des-586.pl
+++ b/crypto/des/asm/des-586.pl
@@ -73,8 +73,9 @@ sub DES_encrypt
}
# PIC-ification:-)
- if ($cpp) { &picmeup($trans,"DES_SPtrans"); }
- else { &lea($trans,&DWP("DES_SPtrans")); }
+ &picmeup($trans,"DES_SPtrans");
+ #if ($cpp) { &picmeup($trans,"DES_SPtrans"); }
+ #else { &lea($trans,&DWP("DES_SPtrans")); }
&mov( "ecx", &wparam(1) );
&cmp("ebx","0");
diff --git a/crypto/md5/Makefile.ssl b/crypto/md5/Makefile.ssl
index e28bb92451..56cab5d882 100644
--- a/crypto/md5/Makefile.ssl
+++ b/crypto/md5/Makefile.ssl
@@ -21,14 +21,6 @@ MD5_ASM_OBJ=
CFLAGS= $(INCLUDES) $(CFLAG)
-# We let the C compiler driver to take care of .s files. This is done in
-# order to be excused from maintaining a separate set of architecture
-# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
-# gcc, then the driver will automatically translate it to -xarch=v8plus
-# and pass it down to assembler.
-AS=$(CC) -c
-ASFLAGS=$(CFLAGS)
-
GENERAL=Makefile
TEST=md5test.c
APPS=
@@ -55,14 +47,8 @@ lib: $(LIBOBJ)
@touch lib
# elf
-asm/mx86-elf.o: asm/mx86unix.cpp
- $(CPP) -DELF -x c asm/mx86unix.cpp | as -o asm/mx86-elf.o
-
-# solaris
-asm/mx86-sol.o: asm/mx86unix.cpp
- $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s
- as -o asm/mx86-sol.o asm/mx86-sol.s
- rm -f asm/mx86-sol.s
+asm/mx86-elf.s: asm/md5-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) md5-586.pl elf $(CFLAGS) > mx86-elf.s)
# a.out
asm/mx86-out.o: asm/mx86unix.cpp
@@ -125,7 +111,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f asm/mx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f asm/mx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/perlasm/x86asm.pl b/crypto/perlasm/x86asm.pl
index 9a3d85b098..888c656f93 100644
--- a/crypto/perlasm/x86asm.pl
+++ b/crypto/perlasm/x86asm.pl
@@ -18,9 +18,9 @@ sub main'asm_init
($type,$fn,$i386)=@_;
$filename=$fn;
- $cpp=$sol=$aout=$win32=$gaswin=0;
+ $elf=$cpp=$sol=$aout=$win32=$gaswin=0;
if ( ($type eq "elf"))
- { require "x86unix.pl"; }
+ { $elf=1; require "x86unix.pl"; }
elsif ( ($type eq "a.out"))
{ $aout=1; require "x86unix.pl"; }
elsif ( ($type eq "gaswin"))
@@ -47,6 +47,9 @@ EOF
exit(1);
}
+ $pic=0;
+ for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); }
+
&asm_init_output();
&comment("Don't even think of reading this code");
diff --git a/crypto/perlasm/x86unix.pl b/crypto/perlasm/x86unix.pl
index 3ad889ffd6..b1c87037dd 100644
--- a/crypto/perlasm/x86unix.pl
+++ b/crypto/perlasm/x86unix.pl
@@ -426,6 +426,11 @@ sub main'swtmp
sub main'comment
{
+ if ($main'elf) # GNU and SVR4 as'es use different comment delimiters,
+ { # so we just skip comments...
+ push(@out,"\n");
+ return;
+ }
foreach (@_)
{
if (/^\s*$/)
@@ -546,7 +551,9 @@ sub popvars
sub main'picmeup
{
local($dst,$sym)=@_;
- local($tmp)=<<___;
+ if ($main'cpp)
+ {
+ local($tmp)=<<___;
#if (defined(ELF) || defined(SOL)) && defined(PIC)
.align 8
call 1f
@@ -557,7 +564,22 @@ sub main'picmeup
leal $sym,$regs{$dst}
#endif
___
- push(@out,$tmp);
+ push(@out,$tmp);
+ }
+ elsif ($main'pic && $main'elf)
+ {
+ push(@out,"\t.align\t8\n");
+ &main'call(&main'label("PIC_me_up"));
+ &main'set_label("PIC_me_up");
+ &main'blindpop($dst);
+ &main'add($dst,"\$_GLOBAL_OFFSET_TABLE_+[.-" .
+ &main'label("PIC_me_up") . "]");
+ &main'mov($dst,&main'DWP("$under$sym\@GOT",$dst));
+ }
+ else
+ {
+ &main'lea($dst,&main'DWP("$under$sym"));
+ }
}
sub main'blindpop { &out1("popl",@_); }
diff --git a/crypto/rc4/Makefile.ssl b/crypto/rc4/Makefile.ssl
index a1eb79fd08..b210b42f8f 100644
--- a/crypto/rc4/Makefile.ssl
+++ b/crypto/rc4/Makefile.ssl
@@ -52,14 +52,8 @@ lib: $(LIBOBJ)
@touch lib
# elf
-asm/rx86-elf.o: asm/rx86unix.cpp
- $(CPP) -DELF -x c asm/rx86unix.cpp | as -o asm/rx86-elf.o
-
-# solaris
-asm/rx86-sol.o: asm/rx86unix.cpp
- $(CC) -E -DSOL asm/rx86unix.cpp | sed 's/^#.*//' > asm/rx86-sol.s
- as -o asm/rx86-sol.o asm/rx86-sol.s
- rm -f asm/rx86-sol.s
+asm/rx86-elf.s: asm/rc4-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) rc4-586.pl elf $(CFLAGS) > rx86-elf.s)
# a.out
asm/rx86-out.o: asm/rx86unix.cpp
@@ -104,7 +98,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f asm/rx86unix.cpp *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o
+ rm -f asm/rx86unix.cpp asm/*-elf.* *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/rc5/Makefile.ssl b/crypto/rc5/Makefile.ssl
index bb4704d5f5..3ad6655946 100644
--- a/crypto/rc5/Makefile.ssl
+++ b/crypto/rc5/Makefile.ssl
@@ -49,14 +49,8 @@ lib: $(LIBOBJ)
@touch lib
# elf
-asm/r586-elf.o: asm/r586unix.cpp
- $(CPP) -DELF -x c asm/r586unix.cpp | as -o asm/r586-elf.o
-
-# solaris
-asm/r586-sol.o: asm/r586unix.cpp
- $(CC) -E -DSOL asm/r586unix.cpp | sed 's/^#.*//' > asm/r586-sol.s
- as -o asm/r586-sol.o asm/r586-sol.s
- rm -f asm/r586-sol.s
+asm/r586-elf.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
+ (cd asm; $(PERL) rc5-586.pl elf $(CFLAGS) > r586-elf.s)
# a.out
asm/r586-out.o: asm/r586unix.cpp
@@ -101,7 +95,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f asm/r586unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f asm/r586unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/ripemd/Makefile.ssl b/crypto/ripemd/Makefile.ssl
index 6f1a9c59a2..3583dfdcaf 100644
--- a/crypto/ripemd/Makefile.ssl
+++ b/crypto/ripemd/Makefile.ssl
@@ -47,14 +47,8 @@ lib: $(LIBOBJ)
@touch lib
# elf
-asm/rm86-elf.o: asm/rm86unix.cpp
- $(CPP) -DELF -x c asm/rm86unix.cpp | as -o asm/rm86-elf.o
-
-# solaris
-asm/rm86-sol.o: asm/rm86unix.cpp
- $(CC) -E -DSOL asm/rm86unix.cpp | sed 's/^#.*//' > asm/rm86-sol.s
- as -o asm/rm86-sol.o asm/rm86-sol.s
- rm -f asm/rm86-sol.s
+asm/rm86-elf.s: asm/rmd-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) rmd-586.pl elf $(CFLAGS) > rm86-elf.s)
# a.out
asm/rm86-out.o: asm/rm86unix.cpp
@@ -99,7 +93,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f asm/rm86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f asm/rm86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/sha/Makefile.ssl b/crypto/sha/Makefile.ssl
index 64873976a4..864645c8b5 100644
--- a/crypto/sha/Makefile.ssl
+++ b/crypto/sha/Makefile.ssl
@@ -47,14 +47,8 @@ lib: $(LIBOBJ)
@touch lib
# elf
-asm/sx86-elf.o: asm/sx86unix.cpp
- $(CPP) -DELF -x c asm/sx86unix.cpp | as -o asm/sx86-elf.o
-
-# solaris
-asm/sx86-sol.o: asm/sx86unix.cpp
- $(CC) -E -DSOL asm/sx86unix.cpp | sed 's/^#.*//' > asm/sx86-sol.s
- as -o asm/sx86-sol.o asm/sx86-sol.s
- rm -f asm/sx86-sol.s
+asm/sx86-elf.s: asm/sha1-586.pl ../perlasm/x86asm.pl
+ (cd asm; $(PERL) sha1-586.pl elf $(CFLAGS) $(PROCESSOR) > sx86-elf.s)
# a.out
asm/sx86-out.o: asm/sx86unix.cpp
@@ -99,7 +93,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f asm/sx86unix.cpp *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o
+ rm -f asm/sx86unix.cpp asm/*-elf.* *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o
# DO NOT DELETE THIS LINE -- make depend depends on it.