Illegal subtraction in tmp-dive_1.s
Dennis Clarke
dclarke at blastwave.org
Thu Apr 16 03:51:22 CEST 2009
I hit this repeatedly on Solaris x86.
It looks like someone has done some assembly hacking and the result is in
files thus :
$ find ../../gmp-4.3.0 -type f -name dive_1.asm
../../gmp-4.3.0/mpn/x86_64/dive_1.asm
../../gmp-4.3.0/mpn/ia64/dive_1.asm
../../gmp-4.3.0/mpn/x86/k7/dive_1.asm
../../gmp-4.3.0/mpn/x86/p6/dive_1.asm
../../gmp-4.3.0/mpn/x86/pentium/dive_1.asm
../../gmp-4.3.0/mpn/x86/pentium4/sse2/dive_1.asm
../../gmp-4.3.0/mpn/x86/k6/mmx/dive_1.asm
../../gmp-4.3.0/mpn/x86/dive_1.asm
../../gmp-4.3.0/mpn/powerpc64/mode64/dive_1.asm
Which throws an error with Sun Studio 11 on Solaris x86. The Solaris Sparc
architecture builds just fine.
I did take note of this for Sparc :
$ ls ../../gmp-4.3.0/mpn/sparc32
README gmp-mparam.h rshift.asm submul_1.asm umul.asm
add_n.asm lshift.asm sparc-defs.m4 udiv.asm v8
addmul_1.asm mul_1.asm sub_n.asm udiv_nfp.asm v9
$ ls ../../gmp-4.3.0/mpn/sparc64
README copyi.asm mod_1.c sqr_diagonal.asm
add_n.asm dive_1.c mode1o.c sub_n.asm
addmul_1.asm divrem_1.c mul_1.asm submul_1.asm
addmul_2.asm gmp-mparam.h rshift.asm
copyd.asm lshift.asm sparc64.h
$
but then again, sparc builds are fine.
here comes the error :
/bin/bash ../libtool --mode=compile --tag=CC
../../../gmp-4.3.0/mpn/m4-ccas --m4="m4" /opt/studio/SOS11/SUNWspro/bin/cc
-c -DHAVE_CONFIG_H -I. -I../../../gmp-4.3.0/mpn -I.. -D__GMP_WITHIN_GMP
-I../../../gmp-4.3.0 -DOPERATION_`echo dive_1 | sed 's/_$//'`
-I/opt/csw/include -xstrconst -xildoff -xarch=pentium_pro -xnolibmil -Xa
-Kpic -xregs=no%frameptr -xnolibmopt -xlibmieee -g -D_REENTRANT -lthread
-Qy -xs -DSOLARIS2=8 -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE
`test -f 'dive_1.asm' || echo '../../../gmp-4.3.0/mpn/'`dive_1.asm
../../../gmp-4.3.0/mpn/m4-ccas --m4=m4 /opt/studio/SOS11/SUNWspro/bin/cc
-c -DHAVE_CONFIG_H -I. -I../../../gmp-4.3.0/mpn -I.. -D__GMP_WITHIN_GMP
-I../../../gmp-4.3.0 -DOPERATION_dive_1 -I/opt/csw/include -xstrconst
-xildoff -xarch=pentium_pro -xnolibmil -Xa -Kpic -xregs=no%frameptr
-xnolibmopt -xlibmieee -g -D_REENTRANT -lthread -Qy -xs -DSOLARIS2=8
-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE dive_1.asm -KPIC -DPIC
-o .libs/dive_1.o
m4 -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_dive_1 -D_REENTRANT
-DSOLARIS2=8 -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -DPIC
dive_1.asm >tmp-dive_1.s
/opt/studio/SOS11/SUNWspro/bin/cc -c -DHAVE_CONFIG_H -I.
-I../../../gmp-4.3.0/mpn -I.. -D__GMP_WITHIN_GMP -I../../../gmp-4.3.0
-DOPERATION_dive_1 -I/opt/csw/include -xstrconst -xildoff
-xarch=pentium_pro -xnolibmil -Xa -Kpic -xregs=no%frameptr -xnolibmopt
-xlibmieee -g -D_REENTRANT -lthread -Qy -xs -DSOLARIS2=8
-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE tmp-dive_1.s -KPIC -DPIC
-o .libs/dive_1.o
Assembler:
"tmp-dive_1.s", line 292 : Illegal subtraction in ... ".DOT-0 -
__gmp_binvert_limb_table"
cc: assembler failed for tmp-dive_1.s
gmake[2]: *** [dive_1.lo] Error 1
gmake[2]: Leaving directory
`/export/medusa/dclarke/build/libgmp/i386/gmp-4.3.0-build-i386/mpn'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory
`/export/medusa/dclarke/build/libgmp/i386/gmp-4.3.0-build-i386'
gmake: *** [all] Error 2
$
Here comes the ( mostly empty ) input assembly file :
$ cat -n ./mpn/tmp-dive_1.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 .text
72
73 .align 16
74 .globl __gmpn_divexact_1
75 .type __gmpn_divexact_1, at function
76
77 __gmpn_divexact_1:
78
79
80
81
82
83
84 movl 16(%esp), %eax
85 subl $20, %esp
86
87 movl %esi, 12(%esp)
88 movl 28(%esp), %esi
89
90 movl %ebx, 16(%esp)
91 movl 32(%esp), %ebx
92
93 bsfl %eax, %ecx
94
95 movl %ebp, 4(%esp)
96
97 shrl %cl, %eax
98
99 movl %eax, %edx
100 shrl %eax
101
102 movl %edx, 36(%esp)
103 andl $127, %eax
104
105
106
107
108
109 call .Lmovl_eip_ebp
110 addl $_GLOBAL_OFFSET_TABLE_, %ebp
111 movl __gmp_binvert_limb_table at GOT(%ebp), %ebp
112
113 movzbl (%eax,%ebp), %ebp
114
115
116 leal (%ebp,%ebp), %eax
117
118 imull %ebp, %ebp
119
120 movl %edi, 8(%esp)
121 movl 24(%esp), %edi
122
123 leal (%esi,%ebx,4), %esi
124
125 imull 36(%esp), %ebp
126
127 subl %ebp, %eax
128 leal (%eax,%eax), %ebp
129
130 imull %eax, %eax
131
132 leal (%edi,%ebx,4), %edi
133 negl %ebx
134
135 movl %edi, 24(%esp)
136
137 imull 36(%esp), %eax
138
139 subl %eax, %ebp
140
141
142
143 movl %ebp, (%esp)
144 movl (%esi,%ebx,4), %eax
145
146 orl %ecx, %ecx
147 jnz .Leven
148
149
150 jmp .Lodd_entry
151
152
153
154
155
156
157
158
159
160
161
162
163
164 .Lodd_top:
165
166
167
168
169
170
171
172
173 mull 36(%esp)
174
175 movl (%esi,%ebx,4), %eax
176 subl %ecx, %eax
177
178 sbbl %ecx, %ecx
179 subl %edx, %eax
180
181 sbbl $0, %ecx
182
183 .Lodd_entry:
184 imull (%esp), %eax
185
186 movl %eax, (%edi,%ebx,4)
187 negl %ecx
188
189 incl %ebx
190 jnz .Lodd_top
191
192
193 movl 12(%esp), %esi
194
195 movl 8(%esp), %edi
196
197 movl 4(%esp), %ebp
198
199 movl 16(%esp), %ebx
200 addl $20, %esp
201
202 ret
203
204
205
206
207 .Leven:
208
209
210
211
212
213
214
215
216 xorl %ebp, %ebp
217 xorl %edx, %edx
218
219 incl %ebx
220 jz .Leven_one
221
222 movl (%esi,%ebx,4), %edi
223
224 shrdl %edi, %eax
225
226 jmp .Leven_entry
227
228
229 .Leven_top:
230
231
232
233
234
235
236
237
238 movl (%esi,%ebx,4), %edi
239
240 mull 36(%esp)
241
242 movl -4(%esi,%ebx,4), %eax
243 shrdl %edi, %eax
244
245 subl %ebp, %eax
246
247 sbbl %ebp, %ebp
248 subl %edx, %eax
249
250 sbbl $0, %ebp
251
252 .Leven_entry:
253 imull (%esp), %eax
254
255 movl 24(%esp), %edi
256 negl %ebp
257
258 movl %eax, -4(%edi,%ebx,4)
259 incl %ebx
260 jnz .Leven_top
261
262
263
264 mull 36(%esp)
265
266 movl -4(%esi), %eax
267
268 .Leven_one:
269 shrl %cl, %eax
270 movl 12(%esp), %esi
271
272 subl %ebp, %eax
273 movl 4(%esp), %ebp
274
275 subl %edx, %eax
276 movl 16(%esp), %ebx
277
278 imull (%esp), %eax
279
280 movl %eax, -4(%edi)
281 movl 8(%esp), %edi
282 addl $20, %esp
283
284 ret
285
286
287
288
289 .Lmovl_eip_ebp:
290 movl (%esp), %ebp
291 ret
292 .size __gmp_binvert_limb_table,.-__gmp_binvert_limb_table
What is the trick to getting around this ?
--
Dennis Clarke
More information about the gmp-discuss
mailing list