Home | History | Annotate | Line # | Download | only in doc
HACKS revision 1.1
      1 # $NetBSD: HACKS,v 1.1 2002/09/21 08:17:37 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	specific knowledge of xterm escapes in curses code
     31 cdate	Wed, 11 Sep 2002 18:23:25 +0300
     32 who	jdc
     33 port	all
     34 file	lib/libcurses/setterm.c : 1.33
     35 descr
     36 	Recognise that "\E[m" will turn off all attributes for xterm-like
     37 	terminals.  Without this hack, we can't tell when turning off one
     38 	attribute affects another (which we check by comparing sequences).
     39 kcah
     40 
     41 hack	gcc 2.95/vax cannot handle __builtin_ffs()
     42 cdate	Fri Aug 23 21:31:15 CEST 2002
     43 who	ragge
     44 port	vax
     45 file	sys/lib/libkern/libkern.h : 1.42
     46 descr
     47 	__builtin_ffs() is ifdef'd away if __vax__. Matt Thomas has added
     48 	this feature to GCC 3 so it can be removed when switching.
     49 kcah
     50 
     51 hack	gcc 2.95.3 -O2 bug
     52 cdate	Sun Jan  6 23:17:28 UTC 2002
     53 who	lukem
     54 port	alpha
     55 file	sbin/newfs/mkfs.c : (all?)
     56 pr	15156
     57 descr
     58 	newfs built with gcc -O2 dumps core part-way through.
     59 	using -O1 avoids the problem
     60 kcah
     61 
     62 hack	binutil-2.11-sparc64-pltrela
     63 mdate	14 Aug 2001
     64 who	eeh
     65 port	sparc64
     66 file	libexec/ld.elf_so/reloc.c: 1.41 : 597 : 619
     67 descr
     68 	The first for PLT entries are reserved.  There is some disagreement
     69 	whether they should have associated relocation entries.  Both the
     70 	SPARC 32-bit and 64-bit ELF specifications say that they should have
     71 	relocation entries, but the 32-bit SPARC binutils do not generate
     72 	them, and now the 64-bit SPARC binutils have stopped generating them
     73 	too.
     74 
     75 	To provide binary compatibility, we will check the first entry, if it
     76 	is reserved it should not be of the type JMP_SLOT.  If it is JMP_SLOT,
     77 	then the 4 reserved entries were not generated and our index is 4
     78 	entries too far, so we frob the rela pointer.
     79 kcah
     80 
     81 hack	gcc-arm32-schedule
     82 mdate	04 May 2000
     83 who	is
     84 file	lib/libc/stdlib/strtoull.c	: 1.3 : 78 : 81
     85 file	lib/libc/stdlib/strtouq.c	: 1.15 : 73 : 76
     86 pr	9613
     87 descr
     88 	strtoull() was returning a wrong result for small numbers with bit 31
     89 	set. This is a gcc/arm32 compiler bug in gcc < 2.95.2. Adding
     90 	(void)&acc; works around it.
     91 kcah
     92 
     93 hack	gcc-sparc64-memorysize
     94 mdate	17 Sep 2000
     95 who	mrg
     96 port	sparc64
     97 file	lib/libc/hash/sha1.c		: 1.6 : 78 : 129 : 162 : 189
     98 file	sys/lib/libkern/sha1.c		: 1.6 : 78 : 129 : 162 : 189
     99 file	usr.sbin/bind/lib/Makefile	: 1.14 : 87 : 91
    100 descr
    101 	the normal SHA1Transform() function causes the sparc64 compiler to
    102 	use excessive amounts of memory attempting to optimise this function.
    103 	using no optimisation allows the function to build.  this hack
    104 	splits the mathematical functions inside SHA1Transform() into 4
    105 	separate functions, which avoids the optimiser explosion.
    106 kcah
    107 
    108 hack	gcc-sparc64-double-arguments
    109 mdate	18 Sep 2000
    110 who	mrg
    111 port	sparc64
    112 file	xsrc/xc/lib/fonts/Type1/type1.c		: 1.2 : 1461 : 1507 : 1702 : 1709
    113 descr
    114 	in passing 17 "double" arguments to a function, gcc incorrectly tries
    115 	to use a register that doesn't exist, causing an internal error.  this
    116 	hack changes the way arguments are passed to the function, such that
    117 	a pointer to a "double" (really an array) is passed, and the old
    118 	arguments are assigned within the function.
    119 kcah
    120 
    121 hack	gcc-sparc64-gawk
    122 mdate	28 Oct 2000
    123 who	mrg
    124 port	sparc64
    125 file	gnu/usr.bin/gawk/Makefile		: 1.11 : 21 : 24
    126 descr
    127 	gcc fails to build gawk properly, due to double floating point bugs.
    128 	this simple test program will fail to print ``ab'':
    129 		BEGIN { f = "abc"; print substr(f, 1, 2); exit }
    130 	the work around is simple: use -msoft-quad-float.
    131 kcah
    132 
    133 hack    gcc-sparc64-libgcc
    134 mdate   01 Dec 2001
    135 who	jmc
    136 port	sparc64
    137 file	gnu/lib/libgcc/Makefile			: 1.29 : 24 : 27
    138 descr
    139 	gcc fails to do double -> int conversions correctly without 
    140 	soft-quad-float. Add it in there for the internal conversion
    141 	routines. This appears to be more than likely emulations bugs than
    142 	compiler bugs as the assembly looks correct on the surface.
    143 
    144 kcah
    145 
    146 hack	gcc-sparc64-iostat-systat
    147 mdate	04 Feb 2001
    148 who	mrg
    149 port	sparc64
    150 file	usr.sbin/iostat/Makefile	: 1.17 : 7 : 10
    151 file	usr.bin/systat/Makefile		: 1.23 : 6 : 9
    152 descr
    153 	gcc fails to build iostat properly, due to double floating point bugs.
    154 	results will include "Inf" and other garbage.
    155 	the work around is simple: use -msoft-quad-float.
    156 kcah
    157 
    158 hack	gcc-sparc64-nawk
    159 mdate	25 Oct 2001
    160 who	martin
    161 port	sparc64
    162 file	usr.bin/awk/Makefile		: 1.3 : 13 : 15
    163 descr
    164 	Don't use long double on sparc64.
    165 kcah
    166 
    167 hack	gcc-sparc64-ntp
    168 mdate	12 Nov 2000
    169 who	martin
    170 port	sparc64
    171 file	usr.sbin/ntp/Makefile.inc	: 1.5 : 17 : 19
    172 descr
    173 	gcc fails to build ntpd properly, due to double floating point bugs.
    174 	Ntpd will fail to decode incoming packets; ntpdc -s will report
    175 	a delay, offset and dispersion of 0.0000 for all peers.
    176 	the work around is simple: use -msoft-quad-float.
    177 kcah
    178 
    179 hack	gcc-sparc64-x_dhclient
    180 mdate	27 Dec 2000
    181 who	mrg
    182 port	sparc64
    183 file	distrib/utils/x_dhclient/Makefile	: 1.6 : 28 : 30
    184 descr
    185 	gcc fails with an ICE while building dhclient's parse.c with -O2
    186 	and -Os.  the work around is simple: don't use -Os.
    187 kcah
    188 
    189 hack	lint-no-long-double
    190 mdate	17 Aug 2001
    191 who	eeh
    192 port	sparc64
    193 file	usr.bin/xlint/lint1/param.h: 1.14 :
    194 descr
    195 	Don't use long double on sparc64.
    196 kcah
    197 
    198 hack	netstat ieee1394 address printing.
    199 mdate	14 Nov 2000
    200 who	matt
    201 file	lib/libc/net/getnameinfo.c	: 1.32 : 497 : 503
    202 descr
    203 	Because the current implementation of IP over IEEE1394, the
    204 	fw device address contains more than just the IEEE1394 EUI-64.
    205 	So when printing out IEEE1394 addresses, ignore the extra stuff.
    206 kcah
    207 
    208 hack	xterm vs. libterm
    209 mdate	01 Aug 2000
    210 who	jdc
    211 file	xsrc/xc/programs/xterm/main.c	: 1.2 : 3609 : 3614
    212 pr	10383
    213 descr
    214 	In order to extend the termcap string over 1023 bytes, a ZZ entry was
    215 	introduced to point to a memory location containing the full entry.
    216 	Without this hack, xterm will export a termcap containing the ZZ
    217 	entry, which will then be ignored by libterm.  As xterm modifies the
    218 	exported termcap, this would cause those modifications to be ignored.
    219 kcah
    220 
    221 hack	gcc-3-libtelnet
    222 mdate	29 Jan 2002
    223 who	thorpej
    224 file	lib/libtelnet/Makefile	: 1.14 : 14 : 17
    225 descr
    226 	GCC 3.x issues a spurious warning when compiling a Duff's Device
    227 	with optimization, even though it compiles the file correctly.
    228 	GCC PR optimization/5230.  kerberos.c contains a Duff's Device
    229 	in the checksum routine.  Hack is to build libtelnet w/o optimization
    230 	if HAVE_GCC3 is set.
    231 kcah
    232 
    233 hack	gcc-sh3-sed
    234 mdate	23 Apr 2002
    235 who	thorpej
    236 file	usr.bin/sed/Makefile	: 1.9 : 9 : 13
    237 descr
    238 	The in-tree GCC 2.95.3-based compiler ICEs when building
    239 	with optimization for SuperH.  Hack is to biuld with -O0.
    240 kcah
    241 
    242 hack	gcc-unsigned-compare
    243 cdate	09 Mar 2002
    244 mdate	18 Mar 2002
    245 who	bjh21
    246 port	arm
    247 file	dist/bind/lib/nameser/ns_parse.c : 1.3
    248 file	dist/dhcp/minires/ns_parse.c : 1.3
    249 file	dist/dhcp/omapip/result.c : 1.2
    250 file	dist/dhcp/server/failover.c : 1.3
    251 file	gnu/dist/gawk/eval.c : 1.4
    252 file	gnu/dist/toolchain/bfd/bfd.c : 1.2
    253 file	gnu/dist/toolchain/bfd/format.c : 1.2
    254 file	gnu/dist/toolchain/gdb/target.c : 1.2
    255 file	sys/kern/vfs_subr.c : 1.172
    256 descr	When checking that a potentially-unsigned enum is >= 0, assign it
    257 	to an int first.  This is necessary to avoid "comparison is always
    258 	true" warnings with -fshort-enums.  Casting to an int really should
    259 	be enough, but turns out not to be.
    260 kcah
    261 
    262 hack	wi-at-big-endian-bus
    263 cdate	15 Mar 2002
    264 who	martin
    265 file	dev/ic/wireg.h
    266 descr	Add an option to access the underlying bus in big endian byte order
    267 	to work around deficiencies in bus_space_{read,write}_* macros.
    268 	Those don't allow the implementation of a proper pcmcia bus space
    269 	tag.
    270 kcah
    271 
    272 hack	gcc 2.95.3 -O2 (-fgcse) bug
    273 cdate	Sun May  5 18:36:04 UTC 2002
    274 who	tsutsui
    275 port	macppc
    276 file	sys/arch/macppc/dev/adb_direct.c:	1.24 : 1895 : 1896
    277 pr	16678
    278 descr
    279 	gcc-2.95.3 does generates wrong code on optimization
    280 	by gcc -O2 (-fgcse), and adb_read_date_time() returns
    281 	wrong value on cuda system.
    282 	A null asm statement has been added to avoid this for workaround.
    283 kcah
    284 
    285 hack	gcc-vax-libbz2
    286 mdate	27 Jun 2002
    287 who	thorpej
    288 port	vax
    289 file	lib/libbz2/Makefile
    290 descr
    291 	libbz2 is mis-compiled with optimization with GCC 2.95.3
    292 	on VAX.  -O0 works around this problem.
    293 kcah
    294 
    295 hack	egcs-pc532-ip6_mroute
    296 cdate	09 Jul 2002
    297 who	simonb
    298 port	pc532
    299 file	sys/arch/pc532/conf/Makefile.pc532 : 1.70
    300 file	sys/arch/pc532/conf/files.pc532 : 1.47
    301 descr
    302 	egcs 1.1.2 gets an "internal error--insn does not satisfy its
    303 	constraints" error compiling ip6_mroute.c with -O2 or greater.
    304 	-O1 works around this problem.
    305 kcah
    306 
    307 hack	SuperH SH5 Toolchain Bugs
    308 cdate	11 Jul 2002
    309 who	scw
    310 port	sh5
    311 file	usr.sbin/ndbootd/ndbootd.c : 1.6
    312 file	usr.sbin/traceroute/traceroute.c : 1.48
    313 descr
    314 	The SuperH SH5 toolchain (2.97-sh5-010522) gets an internal
    315 	compiler error when assigning a bit-wise inverted value
    316 	under some circumstances.
    317 	Work around it by splitting the statement into two.
    318 kcah
    319