Remove old versions of OpenSSL.
[dragonfly.git] / crypto / openssl-0.9 / crypto / perlasm / x86asm.pl
blob5979122158fd0d14e25ecb29f8c86f063e1a401b
1 #!/usr/local/bin/perl
3 # require 'x86asm.pl';
4 # &asm_init("cpp","des-586.pl");
5 # XXX
6 # XXX
7 # main'asm_finish
9 sub main'asm_finish
11 &file_end();
12 &asm_finish_cpp() if $cpp;
13 print &asm_get_output();
16 sub main'asm_init
18 ($type,$fn,$i386)=@_;
19 $filename=$fn;
21 $elf=$cpp=$coff=$aout=$win32=$netware=$mwerks=0;
22 if ( ($type eq "elf"))
23 { $elf=1; require "x86unix.pl"; }
24 elsif ( ($type eq "a.out"))
25 { $aout=1; require "x86unix.pl"; }
26 elsif ( ($type eq "coff" or $type eq "gaswin"))
27 { $coff=1; require "x86unix.pl"; }
28 elsif ( ($type eq "cpp"))
29 { $cpp=1; require "x86unix.pl"; }
30 elsif ( ($type eq "win32"))
31 { $win32=1; require "x86ms.pl"; }
32 elsif ( ($type eq "win32n"))
33 { $win32=1; require "x86nasm.pl"; }
34 elsif ( ($type eq "nw-nasm"))
35 { $netware=1; require "x86nasm.pl"; }
36 elsif ( ($type eq "nw-mwasm"))
37 { $netware=1; $mwerks=1; require "x86nasm.pl"; }
38 else
40 print STDERR <<"EOF";
41 Pick one target type from
42 elf - Linux, FreeBSD, Solaris x86, etc.
43 a.out - OpenBSD, DJGPP, etc.
44 coff - GAS/COFF such as Win32 targets
45 win32 - Windows 95/Windows NT
46 win32n - Windows 95/Windows NT NASM format
47 nw-nasm - NetWare NASM format
48 nw-mwasm- NetWare Metrowerks Assembler
49 EOF
50 exit(1);
53 $pic=0;
54 for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); }
56 &asm_init_output();
58 &comment("Don't even think of reading this code");
59 &comment("It was automatically generated by $filename");
60 &comment("Which is a perl program used to generate the x86 assember for");
61 &comment("any of ELF, a.out, COFF, Win32, ...");
62 &comment("eric <eay\@cryptsoft.com>");
63 &comment("");
65 $filename =~ s/\.pl$//;
66 &file($filename);
69 sub asm_finish_cpp
71 return unless $cpp;
73 local($tmp,$i);
74 foreach $i (&get_labels())
76 $tmp.="#define $i _$i\n";
78 print <<"EOF";
79 /* Run the C pre-processor over this file with one of the following defined
80 * ELF - elf object files,
81 * OUT - a.out object files,
82 * BSDI - BSDI style a.out object files
83 * SOL - Solaris style elf
86 #define TYPE(a,b) .type a,b
87 #define SIZE(a,b) .size a,b
89 #if defined(OUT) || (defined(BSDI) && !defined(ELF))
90 $tmp
91 #endif
93 #ifdef OUT
94 #define OK 1
95 #define ALIGN 4
96 #if defined(__CYGWIN__) || defined(__DJGPP__) || (__MINGW32__)
97 #undef SIZE
98 #undef TYPE
99 #define SIZE(a,b)
100 #define TYPE(a,b) .def a; .scl 2; .type 32; .endef
101 #endif /* __CYGWIN || __DJGPP */
102 #endif
104 #if defined(BSDI) && !defined(ELF)
105 #define OK 1
106 #define ALIGN 4
107 #undef SIZE
108 #undef TYPE
109 #define SIZE(a,b)
110 #define TYPE(a,b)
111 #endif
113 #if defined(ELF) || defined(SOL)
114 #define OK 1
115 #define ALIGN 16
116 #endif
118 #ifndef OK
119 You need to define one of
120 ELF - elf systems - linux-elf, NetBSD and DG-UX
121 OUT - a.out systems - linux-a.out and FreeBSD
122 SOL - solaris systems, which are elf with strange comment lines
123 BSDI - a.out with a very primative version of as.
124 #endif
126 /* Let the Assembler begin :-) */