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