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