HACKS revision 1.1 1 1.1 lukem # $NetBSD: HACKS,v 1.1 2002/09/21 08:17:37 lukem Exp $
2 1.1 lukem #
3 1.1 lukem # This file is intended to document workarounds for currently unsolved
4 1.1 lukem # (mostly) compiler bugs.
5 1.1 lukem #
6 1.1 lukem # Format:
7 1.1 lukem # hack title
8 1.1 lukem # cdate creation date
9 1.1 lukem # mdate mod date
10 1.1 lukem # who responsible developer
11 1.1 lukem # port ...
12 1.1 lukem # affected ports, space separated, if not "all"
13 1.1 lukem # file affected file : revision : line from : line to
14 1.1 lukem # affected files and revision and line numbers describing hack
15 1.1 lukem # multiple lines if necessary.
16 1.1 lukem # pr NNNN ...
17 1.1 lukem # problem reports this hack works around, if known. Space
18 1.1 lukem # separated.
19 1.1 lukem # regress src/regress/directory/where/test/found
20 1.1 lukem # regression test directories, if available.
21 1.1 lukem # descr
22 1.1 lukem # insert short informal description (multi-line). (Longer ones
23 1.1 lukem # should be in the PR database. More formal descriptions might
24 1.1 lukem # be in the regress tree. See above).
25 1.1 lukem # kcah
26 1.1 lukem # closing bracket.
27 1.1 lukem #
28 1.1 lukem # this is a comment.
29 1.1 lukem
30 1.1 lukem hack specific knowledge of xterm escapes in curses code
31 1.1 lukem cdate Wed, 11 Sep 2002 18:23:25 +0300
32 1.1 lukem who jdc
33 1.1 lukem port all
34 1.1 lukem file lib/libcurses/setterm.c : 1.33
35 1.1 lukem descr
36 1.1 lukem Recognise that "\E[m" will turn off all attributes for xterm-like
37 1.1 lukem terminals. Without this hack, we can't tell when turning off one
38 1.1 lukem attribute affects another (which we check by comparing sequences).
39 1.1 lukem kcah
40 1.1 lukem
41 1.1 lukem hack gcc 2.95/vax cannot handle __builtin_ffs()
42 1.1 lukem cdate Fri Aug 23 21:31:15 CEST 2002
43 1.1 lukem who ragge
44 1.1 lukem port vax
45 1.1 lukem file sys/lib/libkern/libkern.h : 1.42
46 1.1 lukem descr
47 1.1 lukem __builtin_ffs() is ifdef'd away if __vax__. Matt Thomas has added
48 1.1 lukem this feature to GCC 3 so it can be removed when switching.
49 1.1 lukem kcah
50 1.1 lukem
51 1.1 lukem hack gcc 2.95.3 -O2 bug
52 1.1 lukem cdate Sun Jan 6 23:17:28 UTC 2002
53 1.1 lukem who lukem
54 1.1 lukem port alpha
55 1.1 lukem file sbin/newfs/mkfs.c : (all?)
56 1.1 lukem pr 15156
57 1.1 lukem descr
58 1.1 lukem newfs built with gcc -O2 dumps core part-way through.
59 1.1 lukem using -O1 avoids the problem
60 1.1 lukem kcah
61 1.1 lukem
62 1.1 lukem hack binutil-2.11-sparc64-pltrela
63 1.1 lukem mdate 14 Aug 2001
64 1.1 lukem who eeh
65 1.1 lukem port sparc64
66 1.1 lukem file libexec/ld.elf_so/reloc.c: 1.41 : 597 : 619
67 1.1 lukem descr
68 1.1 lukem The first for PLT entries are reserved. There is some disagreement
69 1.1 lukem whether they should have associated relocation entries. Both the
70 1.1 lukem SPARC 32-bit and 64-bit ELF specifications say that they should have
71 1.1 lukem relocation entries, but the 32-bit SPARC binutils do not generate
72 1.1 lukem them, and now the 64-bit SPARC binutils have stopped generating them
73 1.1 lukem too.
74 1.1 lukem
75 1.1 lukem To provide binary compatibility, we will check the first entry, if it
76 1.1 lukem is reserved it should not be of the type JMP_SLOT. If it is JMP_SLOT,
77 1.1 lukem then the 4 reserved entries were not generated and our index is 4
78 1.1 lukem entries too far, so we frob the rela pointer.
79 1.1 lukem kcah
80 1.1 lukem
81 1.1 lukem hack gcc-arm32-schedule
82 1.1 lukem mdate 04 May 2000
83 1.1 lukem who is
84 1.1 lukem file lib/libc/stdlib/strtoull.c : 1.3 : 78 : 81
85 1.1 lukem file lib/libc/stdlib/strtouq.c : 1.15 : 73 : 76
86 1.1 lukem pr 9613
87 1.1 lukem descr
88 1.1 lukem strtoull() was returning a wrong result for small numbers with bit 31
89 1.1 lukem set. This is a gcc/arm32 compiler bug in gcc < 2.95.2. Adding
90 1.1 lukem (void)&acc; works around it.
91 1.1 lukem kcah
92 1.1 lukem
93 1.1 lukem hack gcc-sparc64-memorysize
94 1.1 lukem mdate 17 Sep 2000
95 1.1 lukem who mrg
96 1.1 lukem port sparc64
97 1.1 lukem file lib/libc/hash/sha1.c : 1.6 : 78 : 129 : 162 : 189
98 1.1 lukem file sys/lib/libkern/sha1.c : 1.6 : 78 : 129 : 162 : 189
99 1.1 lukem file usr.sbin/bind/lib/Makefile : 1.14 : 87 : 91
100 1.1 lukem descr
101 1.1 lukem the normal SHA1Transform() function causes the sparc64 compiler to
102 1.1 lukem use excessive amounts of memory attempting to optimise this function.
103 1.1 lukem using no optimisation allows the function to build. this hack
104 1.1 lukem splits the mathematical functions inside SHA1Transform() into 4
105 1.1 lukem separate functions, which avoids the optimiser explosion.
106 1.1 lukem kcah
107 1.1 lukem
108 1.1 lukem hack gcc-sparc64-double-arguments
109 1.1 lukem mdate 18 Sep 2000
110 1.1 lukem who mrg
111 1.1 lukem port sparc64
112 1.1 lukem file xsrc/xc/lib/fonts/Type1/type1.c : 1.2 : 1461 : 1507 : 1702 : 1709
113 1.1 lukem descr
114 1.1 lukem in passing 17 "double" arguments to a function, gcc incorrectly tries
115 1.1 lukem to use a register that doesn't exist, causing an internal error. this
116 1.1 lukem hack changes the way arguments are passed to the function, such that
117 1.1 lukem a pointer to a "double" (really an array) is passed, and the old
118 1.1 lukem arguments are assigned within the function.
119 1.1 lukem kcah
120 1.1 lukem
121 1.1 lukem hack gcc-sparc64-gawk
122 1.1 lukem mdate 28 Oct 2000
123 1.1 lukem who mrg
124 1.1 lukem port sparc64
125 1.1 lukem file gnu/usr.bin/gawk/Makefile : 1.11 : 21 : 24
126 1.1 lukem descr
127 1.1 lukem gcc fails to build gawk properly, due to double floating point bugs.
128 1.1 lukem this simple test program will fail to print ``ab'':
129 1.1 lukem BEGIN { f = "abc"; print substr(f, 1, 2); exit }
130 1.1 lukem the work around is simple: use -msoft-quad-float.
131 1.1 lukem kcah
132 1.1 lukem
133 1.1 lukem hack gcc-sparc64-libgcc
134 1.1 lukem mdate 01 Dec 2001
135 1.1 lukem who jmc
136 1.1 lukem port sparc64
137 1.1 lukem file gnu/lib/libgcc/Makefile : 1.29 : 24 : 27
138 1.1 lukem descr
139 1.1 lukem gcc fails to do double -> int conversions correctly without
140 1.1 lukem soft-quad-float. Add it in there for the internal conversion
141 1.1 lukem routines. This appears to be more than likely emulations bugs than
142 1.1 lukem compiler bugs as the assembly looks correct on the surface.
143 1.1 lukem
144 1.1 lukem kcah
145 1.1 lukem
146 1.1 lukem hack gcc-sparc64-iostat-systat
147 1.1 lukem mdate 04 Feb 2001
148 1.1 lukem who mrg
149 1.1 lukem port sparc64
150 1.1 lukem file usr.sbin/iostat/Makefile : 1.17 : 7 : 10
151 1.1 lukem file usr.bin/systat/Makefile : 1.23 : 6 : 9
152 1.1 lukem descr
153 1.1 lukem gcc fails to build iostat properly, due to double floating point bugs.
154 1.1 lukem results will include "Inf" and other garbage.
155 1.1 lukem the work around is simple: use -msoft-quad-float.
156 1.1 lukem kcah
157 1.1 lukem
158 1.1 lukem hack gcc-sparc64-nawk
159 1.1 lukem mdate 25 Oct 2001
160 1.1 lukem who martin
161 1.1 lukem port sparc64
162 1.1 lukem file usr.bin/awk/Makefile : 1.3 : 13 : 15
163 1.1 lukem descr
164 1.1 lukem Don't use long double on sparc64.
165 1.1 lukem kcah
166 1.1 lukem
167 1.1 lukem hack gcc-sparc64-ntp
168 1.1 lukem mdate 12 Nov 2000
169 1.1 lukem who martin
170 1.1 lukem port sparc64
171 1.1 lukem file usr.sbin/ntp/Makefile.inc : 1.5 : 17 : 19
172 1.1 lukem descr
173 1.1 lukem gcc fails to build ntpd properly, due to double floating point bugs.
174 1.1 lukem Ntpd will fail to decode incoming packets; ntpdc -s will report
175 1.1 lukem a delay, offset and dispersion of 0.0000 for all peers.
176 1.1 lukem the work around is simple: use -msoft-quad-float.
177 1.1 lukem kcah
178 1.1 lukem
179 1.1 lukem hack gcc-sparc64-x_dhclient
180 1.1 lukem mdate 27 Dec 2000
181 1.1 lukem who mrg
182 1.1 lukem port sparc64
183 1.1 lukem file distrib/utils/x_dhclient/Makefile : 1.6 : 28 : 30
184 1.1 lukem descr
185 1.1 lukem gcc fails with an ICE while building dhclient's parse.c with -O2
186 1.1 lukem and -Os. the work around is simple: don't use -Os.
187 1.1 lukem kcah
188 1.1 lukem
189 1.1 lukem hack lint-no-long-double
190 1.1 lukem mdate 17 Aug 2001
191 1.1 lukem who eeh
192 1.1 lukem port sparc64
193 1.1 lukem file usr.bin/xlint/lint1/param.h: 1.14 :
194 1.1 lukem descr
195 1.1 lukem Don't use long double on sparc64.
196 1.1 lukem kcah
197 1.1 lukem
198 1.1 lukem hack netstat ieee1394 address printing.
199 1.1 lukem mdate 14 Nov 2000
200 1.1 lukem who matt
201 1.1 lukem file lib/libc/net/getnameinfo.c : 1.32 : 497 : 503
202 1.1 lukem descr
203 1.1 lukem Because the current implementation of IP over IEEE1394, the
204 1.1 lukem fw device address contains more than just the IEEE1394 EUI-64.
205 1.1 lukem So when printing out IEEE1394 addresses, ignore the extra stuff.
206 1.1 lukem kcah
207 1.1 lukem
208 1.1 lukem hack xterm vs. libterm
209 1.1 lukem mdate 01 Aug 2000
210 1.1 lukem who jdc
211 1.1 lukem file xsrc/xc/programs/xterm/main.c : 1.2 : 3609 : 3614
212 1.1 lukem pr 10383
213 1.1 lukem descr
214 1.1 lukem In order to extend the termcap string over 1023 bytes, a ZZ entry was
215 1.1 lukem introduced to point to a memory location containing the full entry.
216 1.1 lukem Without this hack, xterm will export a termcap containing the ZZ
217 1.1 lukem entry, which will then be ignored by libterm. As xterm modifies the
218 1.1 lukem exported termcap, this would cause those modifications to be ignored.
219 1.1 lukem kcah
220 1.1 lukem
221 1.1 lukem hack gcc-3-libtelnet
222 1.1 lukem mdate 29 Jan 2002
223 1.1 lukem who thorpej
224 1.1 lukem file lib/libtelnet/Makefile : 1.14 : 14 : 17
225 1.1 lukem descr
226 1.1 lukem GCC 3.x issues a spurious warning when compiling a Duff's Device
227 1.1 lukem with optimization, even though it compiles the file correctly.
228 1.1 lukem GCC PR optimization/5230. kerberos.c contains a Duff's Device
229 1.1 lukem in the checksum routine. Hack is to build libtelnet w/o optimization
230 1.1 lukem if HAVE_GCC3 is set.
231 1.1 lukem kcah
232 1.1 lukem
233 1.1 lukem hack gcc-sh3-sed
234 1.1 lukem mdate 23 Apr 2002
235 1.1 lukem who thorpej
236 1.1 lukem file usr.bin/sed/Makefile : 1.9 : 9 : 13
237 1.1 lukem descr
238 1.1 lukem The in-tree GCC 2.95.3-based compiler ICEs when building
239 1.1 lukem with optimization for SuperH. Hack is to biuld with -O0.
240 1.1 lukem kcah
241 1.1 lukem
242 1.1 lukem hack gcc-unsigned-compare
243 1.1 lukem cdate 09 Mar 2002
244 1.1 lukem mdate 18 Mar 2002
245 1.1 lukem who bjh21
246 1.1 lukem port arm
247 1.1 lukem file dist/bind/lib/nameser/ns_parse.c : 1.3
248 1.1 lukem file dist/dhcp/minires/ns_parse.c : 1.3
249 1.1 lukem file dist/dhcp/omapip/result.c : 1.2
250 1.1 lukem file dist/dhcp/server/failover.c : 1.3
251 1.1 lukem file gnu/dist/gawk/eval.c : 1.4
252 1.1 lukem file gnu/dist/toolchain/bfd/bfd.c : 1.2
253 1.1 lukem file gnu/dist/toolchain/bfd/format.c : 1.2
254 1.1 lukem file gnu/dist/toolchain/gdb/target.c : 1.2
255 1.1 lukem file sys/kern/vfs_subr.c : 1.172
256 1.1 lukem descr When checking that a potentially-unsigned enum is >= 0, assign it
257 1.1 lukem to an int first. This is necessary to avoid "comparison is always
258 1.1 lukem true" warnings with -fshort-enums. Casting to an int really should
259 1.1 lukem be enough, but turns out not to be.
260 1.1 lukem kcah
261 1.1 lukem
262 1.1 lukem hack wi-at-big-endian-bus
263 1.1 lukem cdate 15 Mar 2002
264 1.1 lukem who martin
265 1.1 lukem file dev/ic/wireg.h
266 1.1 lukem descr Add an option to access the underlying bus in big endian byte order
267 1.1 lukem to work around deficiencies in bus_space_{read,write}_* macros.
268 1.1 lukem Those don't allow the implementation of a proper pcmcia bus space
269 1.1 lukem tag.
270 1.1 lukem kcah
271 1.1 lukem
272 1.1 lukem hack gcc 2.95.3 -O2 (-fgcse) bug
273 1.1 lukem cdate Sun May 5 18:36:04 UTC 2002
274 1.1 lukem who tsutsui
275 1.1 lukem port macppc
276 1.1 lukem file sys/arch/macppc/dev/adb_direct.c: 1.24 : 1895 : 1896
277 1.1 lukem pr 16678
278 1.1 lukem descr
279 1.1 lukem gcc-2.95.3 does generates wrong code on optimization
280 1.1 lukem by gcc -O2 (-fgcse), and adb_read_date_time() returns
281 1.1 lukem wrong value on cuda system.
282 1.1 lukem A null asm statement has been added to avoid this for workaround.
283 1.1 lukem kcah
284 1.1 lukem
285 1.1 lukem hack gcc-vax-libbz2
286 1.1 lukem mdate 27 Jun 2002
287 1.1 lukem who thorpej
288 1.1 lukem port vax
289 1.1 lukem file lib/libbz2/Makefile
290 1.1 lukem descr
291 1.1 lukem libbz2 is mis-compiled with optimization with GCC 2.95.3
292 1.1 lukem on VAX. -O0 works around this problem.
293 1.1 lukem kcah
294 1.1 lukem
295 1.1 lukem hack egcs-pc532-ip6_mroute
296 1.1 lukem cdate 09 Jul 2002
297 1.1 lukem who simonb
298 1.1 lukem port pc532
299 1.1 lukem file sys/arch/pc532/conf/Makefile.pc532 : 1.70
300 1.1 lukem file sys/arch/pc532/conf/files.pc532 : 1.47
301 1.1 lukem descr
302 1.1 lukem egcs 1.1.2 gets an "internal error--insn does not satisfy its
303 1.1 lukem constraints" error compiling ip6_mroute.c with -O2 or greater.
304 1.1 lukem -O1 works around this problem.
305 1.1 lukem kcah
306 1.1 lukem
307 1.1 lukem hack SuperH SH5 Toolchain Bugs
308 1.1 lukem cdate 11 Jul 2002
309 1.1 lukem who scw
310 1.1 lukem port sh5
311 1.1 lukem file usr.sbin/ndbootd/ndbootd.c : 1.6
312 1.1 lukem file usr.sbin/traceroute/traceroute.c : 1.48
313 1.1 lukem descr
314 1.1 lukem The SuperH SH5 toolchain (2.97-sh5-010522) gets an internal
315 1.1 lukem compiler error when assigning a bit-wise inverted value
316 1.1 lukem under some circumstances.
317 1.1 lukem Work around it by splitting the statement into two.
318 1.1 lukem kcah
319