HACKS revision 1.11 1 # $NetBSD: HACKS,v 1.11 2003/10/26 01:56:54 lukem Exp $
2 #
3 # This file is intended to document workarounds for currently unsolved
4 # (mostly) compiler bugs.
5 #
6 # Format:
7 # hack title
8 # cdate creation date
9 # mdate mod date
10 # who responsible developer
11 # port ...
12 # affected ports, space separated, if not "all"
13 # file affected file : revision : line from : line to
14 # affected files and revision and line numbers describing hack
15 # multiple lines if necessary.
16 # pr NNNN ...
17 # problem reports this hack works around, if known. Space
18 # separated.
19 # regress src/regress/directory/where/test/found
20 # regression test directories, if available.
21 # descr
22 # insert short informal description (multi-line). (Longer ones
23 # should be in the PR database. More formal descriptions might
24 # be in the regress tree. See above).
25 # kcah
26 # closing bracket.
27 #
28 # this is a comment.
29
30 hack gcc 2.95/vax cannot handle __builtin_ffs()
31 cdate Fri Aug 23 21:31:15 CEST 2002
32 who ragge
33 port vax
34 file sys/lib/libkern/libkern.h : 1.42
35 descr
36 __builtin_ffs() is ifdef'd away if __vax__. Matt Thomas has added
37 this feature to GCC 3 so it can be removed when switching.
38 kcah
39
40 hack gcc 2.95.3 -O2 bug
41 cdate Sun Jan 6 23:17:28 UTC 2002
42 who lukem
43 port alpha
44 file sbin/newfs/mkfs.c : (all?)
45 pr 15156
46 descr
47 newfs built with gcc -O2 dumps core part-way through.
48 using -O1 avoids the problem
49 kcah
50
51 hack binutil-2.11-sparc64-pltrela
52 mdate 14 Aug 2001
53 who eeh
54 port sparc64
55 file libexec/ld.elf_so/reloc.c: 1.41 : 597 : 619
56 descr
57 The first for PLT entries are reserved. There is some disagreement
58 whether they should have associated relocation entries. Both the
59 SPARC 32-bit and 64-bit ELF specifications say that they should have
60 relocation entries, but the 32-bit SPARC binutils do not generate
61 them, and now the 64-bit SPARC binutils have stopped generating them
62 too.
63
64 To provide binary compatibility, we will check the first entry, if it
65 is reserved it should not be of the type JMP_SLOT. If it is JMP_SLOT,
66 then the 4 reserved entries were not generated and our index is 4
67 entries too far, so we frob the rela pointer.
68 kcah
69
70 hack gcc-arm32-schedule
71 mdate 04 May 2000
72 who is
73 file lib/libc/stdlib/strtoull.c : 1.3 : 78 : 81
74 file lib/libc/stdlib/strtouq.c : 1.15 : 73 : 76
75 pr 9613
76 descr
77 strtoull() was returning a wrong result for small numbers with bit 31
78 set. This is a gcc/arm32 compiler bug in gcc < 2.95.2. Adding
79 (void)&acc; works around it.
80 kcah
81
82 hack netstat ieee1394 address printing.
83 mdate 14 Nov 2000
84 who matt
85 file lib/libc/net/getnameinfo.c : 1.32 : 497 : 503
86 descr
87 Because the current implementation of IP over IEEE1394, the
88 fw device address contains more than just the IEEE1394 EUI-64.
89 So when printing out IEEE1394 addresses, ignore the extra stuff.
90 kcah
91
92 hack xterm vs. libterm
93 mdate 01 Aug 2000
94 who jdc
95 file xsrc/xc/programs/xterm/main.c : 1.2 : 3609 : 3614
96 pr 10383
97 descr
98 In order to extend the termcap string over 1023 bytes, a ZZ entry was
99 introduced to point to a memory location containing the full entry.
100 Without this hack, xterm will export a termcap containing the ZZ
101 entry, which will then be ignored by libterm. As xterm modifies the
102 exported termcap, this would cause those modifications to be ignored.
103 kcah
104
105 hack gcc-sh3-sed
106 mdate 23 Apr 2002
107 who thorpej
108 file usr.bin/sed/Makefile : 1.9 : 9 : 13
109 descr
110 The in-tree GCC 2.95.3-based compiler ICEs when building
111 with optimization for SuperH. Hack is to biuld with -O0.
112 kcah
113
114 hack gcc-unsigned-compare
115 cdate 09 Mar 2002
116 mdate 18 Mar 2002
117 who bjh21
118 port arm
119 file dist/bind/lib/nameser/ns_parse.c : 1.3
120 file dist/dhcp/minires/ns_parse.c : 1.3
121 file dist/dhcp/omapip/result.c : 1.2
122 file dist/dhcp/server/failover.c : 1.3
123 file gnu/dist/gawk/eval.c : 1.4
124 file gnu/dist/toolchain/bfd/bfd.c : 1.2
125 file gnu/dist/toolchain/bfd/format.c : 1.2
126 file gnu/dist/toolchain/gdb/target.c : 1.2
127 file sys/kern/vfs_subr.c : 1.172
128 descr When checking that a potentially-unsigned enum is >= 0, assign it
129 to an int first. This is necessary to avoid "comparison is always
130 true" warnings with -fshort-enums. Casting to an int really should
131 be enough, but turns out not to be.
132 kcah
133
134 hack wi-at-big-endian-bus
135 cdate 15 Mar 2002
136 who martin
137 file dev/ic/wireg.h
138 descr Add an option to access the underlying bus in big endian byte order
139 to work around deficiencies in bus_space_{read,write}_* macros.
140 Those don't allow the implementation of a proper pcmcia bus space
141 tag.
142 kcah
143
144 hack gcc 2.95.3 -O2 (-fgcse) bug
145 cdate Sun May 5 18:36:04 UTC 2002
146 who tsutsui
147 port macppc
148 file sys/arch/macppc/dev/adb_direct.c: 1.24 : 1895 : 1896
149 pr 16678
150 descr
151 gcc-2.95.3 does generates wrong code on optimization
152 by gcc -O2 (-fgcse), and adb_read_date_time() returns
153 wrong value on cuda system.
154 A null asm statement has been added to avoid this for workaround.
155 kcah
156
157 hack gcc-vax-libbz2
158 mdate 27 Jun 2002
159 who thorpej
160 port vax
161 file lib/libbz2/Makefile
162 descr
163 libbz2 is mis-compiled with optimization with GCC 2.95.3
164 on VAX. -O0 works around this problem.
165 kcah
166
167 hack egcs-pc532-ip6_mroute
168 cdate 09 Jul 2002
169 who simonb
170 port pc532
171 file sys/arch/pc532/conf/Makefile.pc532 : 1.70
172 file sys/arch/pc532/conf/files.pc532 : 1.47
173 descr
174 egcs 1.1.2 gets an "internal error--insn does not satisfy its
175 constraints" error compiling ip6_mroute.c with -O2 or greater.
176 -O1 works around this problem.
177 kcah
178
179 hack SuperH SH5 Toolchain Bugs
180 cdate 11 Jul 2002
181 who scw
182 port sh5
183 file usr.sbin/ndbootd/ndbootd.c : 1.6
184 file usr.sbin/traceroute/traceroute.c : 1.48
185 descr
186 The SuperH SH5 toolchain (2.97-sh5-010522) gets an internal
187 compiler error when assigning a bit-wise inverted value
188 under some circumstances.
189 Work around it by splitting the statement into two.
190 kcah
191
192 hack vax Toolchain bug
193 cdate 28 Mar 2003
194 who he
195 port vax
196 file sys/arch/vax/vax/intvec.S : 1.5
197 descr
198 Workaround for PR toolchain/20924. The assembler apparently
199 tries to range-check byte offsets when it doesn't have
200 sufficient information to make that decision.
201 Workaround uses `brw' instead of `brb' instruction.
202 kcah
203
204 hack specific knowledge of colours in curses code
205 cdate Sun Apr 6 11:05:24 BST 2003
206 who jdc
207 port all
208 file lib/libcurses/color.c : r1.24
209 descr
210 Swap red/blue and yellow/cyan colours for COLOR_OTHER.
211 Fix is to enhance libtermcap to understand terminfo-style % sequences.
212 See also:
213 http://mail-index.NetBSD.org/tech-userlevel/2003/04/06/0000.html
214 kcah
215
216 hack SuperH SH5 Toolchain Bugs
217 cdate 17 May 2003
218 who scw
219 port sh5
220 file lib/libpthread/pthread_lock.c : 1.7
221 descr
222 The SuperH SH5 toolchain generates incorrect PIC code when faced
223 with a symbol which is declared extern, but has local scope due
224 to being defined within an asm() statement (without being declared
225 .globl in that statement). Work around it by adding the .globl.
226 kcah
227
228 hack Compensation for differing types of LINUX_USRSTACK and USRSTACK
229 cdate 21 Aug 2003
230 who he
231 file sys/miscfs/procfs/procfs_linux.c : 1.14
232 descr
233 Not all ports have LINUX_USRSTACK and/or USRSTACK defined as
234 literals/constants, but refer to variables of a type which is
235 not "unsigned long", causing compilation of procfs_linux.c to
236 fail with "makes integer from pointer without a cast". This
237 is observed on e.g. the sun3 port. Ideally the "types" for
238 symbols should be consistent across all ports.
239 kcah
240
241 hack gcc 3.3.x bug
242 cdate Sun Oct 26 01:50:16 UTC 2003
243 who lukem
244 port MACHINE_ARCH == arm
245 file usr.bin/newsyslog/newsyslog.c
246 pr 22986 23002 23217
247 descr
248 newsyslog fails with
249 newsyslog: config line 7: bad flags
250 solved when compiled with -fno-gcse-lm
251 kcah
252