python3 rebuild
[packages/openssl.git] / pic.patch
1 Index: openssl-1.0.1c/crypto/des/asm/desboth.pl
2 ===================================================================
3 --- openssl-1.0.1c.orig/crypto/des/asm/desboth.pl       2001-10-24 23:20:56.000000000 +0200
4 +++ openssl-1.0.1c/crypto/des/asm/desboth.pl    2012-07-29 14:15:26.000000000 +0200
5 @@ -16,6 +16,11 @@
6  
7         &push("edi");
8  
9 +       &call   (&label("pic_point0"));
10 +       &set_label("pic_point0");
11 +       &blindpop("ebp");
12 +       &add    ("ebp", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point0") . "]");
13 +
14         &comment("");
15         &comment("Load the data words");
16         &mov($L,&DWP(0,"ebx","",0));
17 @@ -47,15 +52,21 @@
18         &mov(&swtmp(2), (DWC(($enc)?"1":"0")));
19         &mov(&swtmp(1), "eax");
20         &mov(&swtmp(0), "ebx");
21 -       &call("DES_encrypt2");
22 +       &exch("ebx", "ebp");
23 +       &call("DES_encrypt2\@PLT");
24 +       &exch("ebx", "ebp");
25         &mov(&swtmp(2), (DWC(($enc)?"0":"1")));
26         &mov(&swtmp(1), "edi");
27         &mov(&swtmp(0), "ebx");
28 -       &call("DES_encrypt2");
29 +       &exch("ebx", "ebp");
30 +       &call("DES_encrypt2\@PLT");
31 +       &exch("ebx", "ebp");
32         &mov(&swtmp(2), (DWC(($enc)?"1":"0")));
33         &mov(&swtmp(1), "esi");
34         &mov(&swtmp(0), "ebx");
35 -       &call("DES_encrypt2");
36 +       &exch("ebx", "ebp");
37 +       &call("DES_encrypt2\@PLT");
38 +       &exch("ebx", "ebp");
39  
40         &stack_pop(3);
41         &mov($L,&DWP(0,"ebx","",0));
42 Index: openssl-1.0.1c/crypto/perlasm/cbc.pl
43 ===================================================================
44 --- openssl-1.0.1c.orig/crypto/perlasm/cbc.pl   2011-07-13 08:22:46.000000000 +0200
45 +++ openssl-1.0.1c/crypto/perlasm/cbc.pl        2012-07-29 14:15:26.000000000 +0200
46 @@ -122,7 +122,11 @@
47         &mov(&DWP($data_off,"esp","",0),        "eax"); # put in array for call
48         &mov(&DWP($data_off+4,"esp","",0),      "ebx"); #
49  
50 -       &call($enc_func);
51 +       &call   (&label("pic_point0"));
52 +       &set_label("pic_point0");
53 +       &blindpop("ebx");
54 +       &add    ("ebx", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point0") . "]");
55 +       &call("$enc_func\@PLT");
56  
57         &mov("eax",     &DWP($data_off,"esp","",0));
58         &mov("ebx",     &DWP($data_off+4,"esp","",0));
59 @@ -185,7 +189,11 @@
60         &mov(&DWP($data_off,"esp","",0),        "eax"); # put in array for call
61         &mov(&DWP($data_off+4,"esp","",0),      "ebx"); #
62  
63 -       &call($enc_func);
64 +       &call   (&label("pic_point1"));
65 +       &set_label("pic_point1");
66 +       &blindpop("ebx");
67 +       &add    ("ebx", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point1") . "]");
68 +       &call("$enc_func\@PLT");
69  
70         &mov("eax",     &DWP($data_off,"esp","",0));
71         &mov("ebx",     &DWP($data_off+4,"esp","",0));
72 @@ -218,7 +226,11 @@
73         &mov(&DWP($data_off,"esp","",0),        "eax"); # put back
74         &mov(&DWP($data_off+4,"esp","",0),      "ebx"); #
75  
76 -       &call($dec_func);
77 +       &call   (&label("pic_point2"));
78 +       &set_label("pic_point2");
79 +       &blindpop("ebx");
80 +       &add    ("ebx", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point2") . "]");
81 +       &call("$dec_func\@PLT");
82  
83         &mov("eax",     &DWP($data_off,"esp","",0));    # get return
84         &mov("ebx",     &DWP($data_off+4,"esp","",0));  #
85 @@ -261,7 +273,11 @@
86         &mov(&DWP($data_off,"esp","",0),        "eax"); # put back
87         &mov(&DWP($data_off+4,"esp","",0),      "ebx"); #
88  
89 -       &call($dec_func);
90 +       &call   (&label("pic_point3"));
91 +       &set_label("pic_point3");
92 +       &blindpop("ebx");
93 +       &add    ("ebx", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point3") . "]");
94 +       &call("$dec_func\@PLT");
95  
96         &mov("eax",     &DWP($data_off,"esp","",0));    # get return
97         &mov("ebx",     &DWP($data_off+4,"esp","",0));  #
98 Index: openssl-1.0.1c/crypto/perlasm/x86gas.pl
99 ===================================================================
100 --- openssl-1.0.1c.orig/crypto/perlasm/x86gas.pl        2011-12-09 20:16:35.000000000 +0100
101 +++ openssl-1.0.1c/crypto/perlasm/x86gas.pl     2012-07-29 14:15:26.000000000 +0200
102 @@ -161,6 +161,7 @@
103         if ($::macosx)  { push (@out,"$tmp,2\n"); }
104         elsif ($::elf)  { push (@out,"$tmp,4\n"); }
105         else            { push (@out,"$tmp\n"); }
106 +       if ($::elf)     { push (@out,".hidden\tOPENSSL_ia32cap_P\n"); }
107      }
108      push(@out,$initseg) if ($initseg);
109  }
110 @@ -218,8 +219,23 @@
111      elsif ($::elf)
112      {  $initseg.=<<___;
113  .section       .init
114 +___
115 +        if ($::pic)
116 +       {   $initseg.=<<___;
117 +       pushl   %ebx
118 +       call    .pic_point0
119 +.pic_point0:
120 +       popl    %ebx
121 +       addl    \$_GLOBAL_OFFSET_TABLE_+[.-.pic_point0],%ebx
122 +       call    $f\@PLT
123 +       popl    %ebx
124 +___
125 +       }
126 +       else
127 +       {   $initseg.=<<___;
128         call    $f
129  ___
130 +       }
131      }
132      elsif ($::coff)
133      {   $initseg.=<<___;       # applies to both Cygwin and Mingw
134 Index: openssl-1.0.1c/crypto/x86cpuid.pl
135 ===================================================================
136 --- openssl-1.0.1c.orig/crypto/x86cpuid.pl      2012-02-28 15:20:34.000000000 +0100
137 +++ openssl-1.0.1c/crypto/x86cpuid.pl   2012-07-29 14:15:26.000000000 +0200
138 @@ -8,6 +8,8 @@
139  
140  for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
141  
142 +push(@out, ".hidden OPENSSL_ia32cap_P\n");
143 +
144  &function_begin("OPENSSL_ia32_cpuid");
145         &xor    ("edx","edx");
146         &pushf  ();
147 @@ -139,9 +141,7 @@
148  &set_label("nocpuid");
149  &function_end("OPENSSL_ia32_cpuid");
150  
151 -&external_label("OPENSSL_ia32cap_P");
152 -
153 -&function_begin_B("OPENSSL_rdtsc","EXTRN\t_OPENSSL_ia32cap_P:DWORD");
154 +&function_begin_B("OPENSSL_rdtsc");
155         &xor    ("eax","eax");
156         &xor    ("edx","edx");
157         &picmeup("ecx","OPENSSL_ia32cap_P");
158 @@ -155,7 +155,7 @@
159  # This works in Ring 0 only [read DJGPP+MS-DOS+privileged DPMI host],
160  # but it's safe to call it on any [supported] 32-bit platform...
161  # Just check for [non-]zero return value...
162 -&function_begin_B("OPENSSL_instrument_halt","EXTRN\t_OPENSSL_ia32cap_P:DWORD");
163 +&function_begin_B("OPENSSL_instrument_halt");
164         &picmeup("ecx","OPENSSL_ia32cap_P");
165         &bt     (&DWP(0,"ecx"),4);
166         &jnc    (&label("nohalt"));     # no TSC
167 @@ -222,7 +222,7 @@
168         &ret    ();
169  &function_end_B("OPENSSL_far_spin");
170  
171 -&function_begin_B("OPENSSL_wipe_cpu","EXTRN\t_OPENSSL_ia32cap_P:DWORD");
172 +&function_begin_B("OPENSSL_wipe_cpu");
173         &xor    ("eax","eax");
174         &xor    ("edx","edx");
175         &picmeup("ecx","OPENSSL_ia32cap_P");
This page took 0.049256 seconds and 3 git commands to generate.