HACKS revision 1.20 1 1.20 skrll # $NetBSD: HACKS,v 1.20 2003/10/28 20:12:00 skrll 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 gcc 2.95/vax cannot handle __builtin_ffs()
31 1.1 lukem cdate Fri Aug 23 21:31:15 CEST 2002
32 1.1 lukem who ragge
33 1.1 lukem port vax
34 1.1 lukem file sys/lib/libkern/libkern.h : 1.42
35 1.1 lukem descr
36 1.1 lukem __builtin_ffs() is ifdef'd away if __vax__. Matt Thomas has added
37 1.1 lukem this feature to GCC 3 so it can be removed when switching.
38 1.1 lukem kcah
39 1.1 lukem
40 1.1 lukem hack binutil-2.11-sparc64-pltrela
41 1.1 lukem mdate 14 Aug 2001
42 1.1 lukem who eeh
43 1.1 lukem port sparc64
44 1.1 lukem file libexec/ld.elf_so/reloc.c: 1.41 : 597 : 619
45 1.1 lukem descr
46 1.1 lukem The first for PLT entries are reserved. There is some disagreement
47 1.1 lukem whether they should have associated relocation entries. Both the
48 1.1 lukem SPARC 32-bit and 64-bit ELF specifications say that they should have
49 1.1 lukem relocation entries, but the 32-bit SPARC binutils do not generate
50 1.1 lukem them, and now the 64-bit SPARC binutils have stopped generating them
51 1.1 lukem too.
52 1.1 lukem
53 1.1 lukem To provide binary compatibility, we will check the first entry, if it
54 1.1 lukem is reserved it should not be of the type JMP_SLOT. If it is JMP_SLOT,
55 1.1 lukem then the 4 reserved entries were not generated and our index is 4
56 1.1 lukem entries too far, so we frob the rela pointer.
57 1.1 lukem kcah
58 1.1 lukem
59 1.1 lukem hack netstat ieee1394 address printing.
60 1.1 lukem mdate 14 Nov 2000
61 1.1 lukem who matt
62 1.1 lukem file lib/libc/net/getnameinfo.c : 1.32 : 497 : 503
63 1.1 lukem descr
64 1.1 lukem Because the current implementation of IP over IEEE1394, the
65 1.1 lukem fw device address contains more than just the IEEE1394 EUI-64.
66 1.1 lukem So when printing out IEEE1394 addresses, ignore the extra stuff.
67 1.1 lukem kcah
68 1.1 lukem
69 1.1 lukem hack xterm vs. libterm
70 1.1 lukem mdate 01 Aug 2000
71 1.1 lukem who jdc
72 1.1 lukem file xsrc/xc/programs/xterm/main.c : 1.2 : 3609 : 3614
73 1.1 lukem pr 10383
74 1.1 lukem descr
75 1.1 lukem In order to extend the termcap string over 1023 bytes, a ZZ entry was
76 1.1 lukem introduced to point to a memory location containing the full entry.
77 1.1 lukem Without this hack, xterm will export a termcap containing the ZZ
78 1.1 lukem entry, which will then be ignored by libterm. As xterm modifies the
79 1.1 lukem exported termcap, this would cause those modifications to be ignored.
80 1.1 lukem kcah
81 1.1 lukem
82 1.1 lukem hack gcc-sh3-sed
83 1.1 lukem mdate 23 Apr 2002
84 1.1 lukem who thorpej
85 1.1 lukem file usr.bin/sed/Makefile : 1.9 : 9 : 13
86 1.1 lukem descr
87 1.1 lukem The in-tree GCC 2.95.3-based compiler ICEs when building
88 1.1 lukem with optimization for SuperH. Hack is to biuld with -O0.
89 1.1 lukem kcah
90 1.1 lukem
91 1.1 lukem hack gcc-unsigned-compare
92 1.1 lukem cdate 09 Mar 2002
93 1.1 lukem mdate 18 Mar 2002
94 1.1 lukem who bjh21
95 1.1 lukem port arm
96 1.1 lukem file dist/bind/lib/nameser/ns_parse.c : 1.3
97 1.1 lukem file dist/dhcp/minires/ns_parse.c : 1.3
98 1.1 lukem file dist/dhcp/omapip/result.c : 1.2
99 1.1 lukem file dist/dhcp/server/failover.c : 1.3
100 1.1 lukem file gnu/dist/gawk/eval.c : 1.4
101 1.1 lukem file gnu/dist/toolchain/bfd/bfd.c : 1.2
102 1.1 lukem file gnu/dist/toolchain/bfd/format.c : 1.2
103 1.1 lukem file gnu/dist/toolchain/gdb/target.c : 1.2
104 1.1 lukem file sys/kern/vfs_subr.c : 1.172
105 1.1 lukem descr When checking that a potentially-unsigned enum is >= 0, assign it
106 1.1 lukem to an int first. This is necessary to avoid "comparison is always
107 1.1 lukem true" warnings with -fshort-enums. Casting to an int really should
108 1.1 lukem be enough, but turns out not to be.
109 1.1 lukem kcah
110 1.1 lukem
111 1.1 lukem hack wi-at-big-endian-bus
112 1.1 lukem cdate 15 Mar 2002
113 1.1 lukem who martin
114 1.1 lukem file dev/ic/wireg.h
115 1.1 lukem descr Add an option to access the underlying bus in big endian byte order
116 1.1 lukem to work around deficiencies in bus_space_{read,write}_* macros.
117 1.1 lukem Those don't allow the implementation of a proper pcmcia bus space
118 1.1 lukem tag.
119 1.1 lukem kcah
120 1.1 lukem
121 1.1 lukem hack gcc-vax-libbz2
122 1.1 lukem mdate 27 Jun 2002
123 1.1 lukem who thorpej
124 1.1 lukem port vax
125 1.1 lukem file lib/libbz2/Makefile
126 1.1 lukem descr
127 1.1 lukem libbz2 is mis-compiled with optimization with GCC 2.95.3
128 1.1 lukem on VAX. -O0 works around this problem.
129 1.1 lukem kcah
130 1.1 lukem
131 1.1 lukem hack egcs-pc532-ip6_mroute
132 1.1 lukem cdate 09 Jul 2002
133 1.1 lukem who simonb
134 1.1 lukem port pc532
135 1.1 lukem file sys/arch/pc532/conf/Makefile.pc532 : 1.70
136 1.1 lukem file sys/arch/pc532/conf/files.pc532 : 1.47
137 1.1 lukem descr
138 1.1 lukem egcs 1.1.2 gets an "internal error--insn does not satisfy its
139 1.1 lukem constraints" error compiling ip6_mroute.c with -O2 or greater.
140 1.1 lukem -O1 works around this problem.
141 1.1 lukem kcah
142 1.1 lukem
143 1.1 lukem hack SuperH SH5 Toolchain Bugs
144 1.1 lukem cdate 11 Jul 2002
145 1.1 lukem who scw
146 1.1 lukem port sh5
147 1.1 lukem file usr.sbin/ndbootd/ndbootd.c : 1.6
148 1.1 lukem file usr.sbin/traceroute/traceroute.c : 1.48
149 1.1 lukem descr
150 1.1 lukem The SuperH SH5 toolchain (2.97-sh5-010522) gets an internal
151 1.1 lukem compiler error when assigning a bit-wise inverted value
152 1.1 lukem under some circumstances.
153 1.1 lukem Work around it by splitting the statement into two.
154 1.2 he kcah
155 1.2 he
156 1.2 he hack vax Toolchain bug
157 1.2 he cdate 28 Mar 2003
158 1.2 he who he
159 1.2 he port vax
160 1.2 he file sys/arch/vax/vax/intvec.S : 1.5
161 1.2 he descr
162 1.2 he Workaround for PR toolchain/20924. The assembler apparently
163 1.2 he tries to range-check byte offsets when it doesn't have
164 1.2 he sufficient information to make that decision.
165 1.2 he Workaround uses `brw' instead of `brb' instruction.
166 1.3 jdc kcah
167 1.3 jdc
168 1.3 jdc hack specific knowledge of colours in curses code
169 1.3 jdc cdate Sun Apr 6 11:05:24 BST 2003
170 1.3 jdc who jdc
171 1.3 jdc port all
172 1.3 jdc file lib/libcurses/color.c : r1.24
173 1.3 jdc descr
174 1.3 jdc Swap red/blue and yellow/cyan colours for COLOR_OTHER.
175 1.3 jdc Fix is to enhance libtermcap to understand terminfo-style % sequences.
176 1.3 jdc See also:
177 1.5 salo http://mail-index.NetBSD.org/tech-userlevel/2003/04/06/0000.html
178 1.4 scw kcah
179 1.4 scw
180 1.4 scw hack SuperH SH5 Toolchain Bugs
181 1.4 scw cdate 17 May 2003
182 1.4 scw who scw
183 1.4 scw port sh5
184 1.4 scw file lib/libpthread/pthread_lock.c : 1.7
185 1.4 scw descr
186 1.4 scw The SuperH SH5 toolchain generates incorrect PIC code when faced
187 1.4 scw with a symbol which is declared extern, but has local scope due
188 1.4 scw to being defined within an asm() statement (without being declared
189 1.4 scw .globl in that statement). Work around it by adding the .globl.
190 1.7 he kcah
191 1.7 he
192 1.7 he hack Compensation for differing types of LINUX_USRSTACK and USRSTACK
193 1.7 he cdate 21 Aug 2003
194 1.7 he who he
195 1.7 he file sys/miscfs/procfs/procfs_linux.c : 1.14
196 1.7 he descr
197 1.7 he Not all ports have LINUX_USRSTACK and/or USRSTACK defined as
198 1.7 he literals/constants, but refer to variables of a type which is
199 1.7 he not "unsigned long", causing compilation of procfs_linux.c to
200 1.7 he fail with "makes integer from pointer without a cast". This
201 1.7 he is observed on e.g. the sun3 port. Ideally the "types" for
202 1.7 he symbols should be consistent across all ports.
203 1.11 lukem kcah
204 1.11 lukem
205 1.11 lukem hack gcc 3.3.x bug
206 1.11 lukem cdate Sun Oct 26 01:50:16 UTC 2003
207 1.11 lukem who lukem
208 1.11 lukem port MACHINE_ARCH == arm
209 1.11 lukem file usr.bin/newsyslog/newsyslog.c
210 1.11 lukem pr 22986 23002 23217
211 1.11 lukem descr
212 1.11 lukem newsyslog fails with
213 1.11 lukem newsyslog: config line 7: bad flags
214 1.11 lukem solved when compiled with -fno-gcse-lm
215 1.13 simonb kcah
216 1.13 simonb
217 1.13 simonb hack gcc-pc532-duffs_device
218 1.13 simonb cdate Mon Oct 27 07:23:05 UTC 2003
219 1.13 simonb who simonb
220 1.13 simonb port pc532
221 1.13 simonb file sys/arch/pc532/conf/Makefile.pc532 : 1.71
222 1.13 simonb file sys/arch/pc532/conf/files.pc532 : 1.52
223 1.14 simonb pr GCC PR optimization/5230
224 1.13 simonb descr
225 1.13 simonb gcc incorrectly gives an "unreachable code at beginning of switch
226 1.13 simonb statement" for a Duff's device construct in arch/pc532/dev/ncr.c.
227 1.15 wiz There is no way to disable just this warning, so -Wno-error is
228 1.13 simonb turned on for this file.
229 1.16 cl kcah
230 1.16 cl
231 1.16 cl hack gcc 3.3.2 m68k {u,}int64_t uninitialized bug
232 1.16 cl cdate Tue Oct 28 02:46:46 CET 2003
233 1.16 cl who cl
234 1.16 cl port MACHINE_ARCH == m68k
235 1.16 cl file sys/dev/scsipi/sd.c : 1.212 : 686
236 1.16 cl file sys/dev/ata/wd.c : 1.265 : 483
237 1.16 cl file sys/nfs/nfs_serv.c : 1.84 : 3290
238 1.19 he file sys/conf/Makefile.kern.inc : 1.39
239 1.16 cl descr
240 1.16 cl gcc incorrectly reports {u,}int64_t variables as used uninitialized.
241 1.16 cl Work around by adding explicit initializers.
242 1.16 cl gcc bug report at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12792
243 1.19 he Worked around by disabling uninitialized warnings for m68k.
244 1.17 mrg kcah
245 1.17 mrg
246 1.17 mrg hack gcc 3.3.2/mdsetimage
247 1.17 mrg cdate Tue Oct 28 18:43:05 EST 2003
248 1.17 mrg who fredette
249 1.17 mrg port sun2
250 1.17 mrg file gnu/usr.sbin/mdsetimage/Makefile : 1.15
251 1.17 mrg descr
252 1.17 mrg mdsetimage.c causes cc1 to barf for as-yet unknown reasons. this
253 1.17 mrg hack ues -O0 to avoid the problem.
254 1.17 mrg kcah
255 1.17 mrg
256 1.17 mrg hack gcc 3.3.2/installboot/ffs.c
257 1.17 mrg cdate Tue Oct 28 18:43:05 EST 2003
258 1.17 mrg who fredette
259 1.17 mrg port sun2
260 1.17 mrg file usr.sbin/installboot/Makefile : 1.26
261 1.17 mrg descr
262 1.17 mrg ffs.c causes cc1 to barf for as-yet unknown reasons. this
263 1.17 mrg hack ues -O0 to avoid the problem.
264 1.20 skrll kcah
265 1.20 skrll
266 1.20 skrll hack gcc 3.3.2/arm sys/kern/uipc_socket.c
267 1.20 skrll cdate Tue Oct 28 18:02:16 GMT 2003
268 1.20 skrll who skrll
269 1.20 skrll port MACHINE_ARCH == arm
270 1.20 skrll file sys/conf/arm/Makefile.arm : 1.19
271 1.20 skrll descr
272 1.20 skrll Performing a build.sh tools on a CATS with NFS mounted
273 1.20 skrll obj and src directories results in "panic: receive 1"
274 1.20 skrll The hack is to compile sys/kern/uipc_socket.c with
275 1.20 skrll -fno-strict-aliasing
276 1.1 lukem kcah
277