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