Home | History | Annotate | Line # | Download | only in doc
HACKS revision 1.8
      1 # $NetBSD: HACKS,v 1.8 2003/09/19 08:43:14 mrg 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	gcc-sparc64-memorysize
     83 mdate	17 Sep 2000
     84 who	mrg
     85 port	sparc64
     86 file	lib/libc/hash/sha1.c		: 1.6 : 78 : 129 : 162 : 189
     87 file	sys/lib/libkern/sha1.c		: 1.6 : 78 : 129 : 162 : 189
     88 file	usr.sbin/bind/lib/Makefile	: 1.14 : 87 : 91
     89 descr
     90 	the normal SHA1Transform() function causes the sparc64 compiler to
     91 	use excessive amounts of memory attempting to optimise this function.
     92 	using no optimisation allows the function to build.  this hack
     93 	splits the mathematical functions inside SHA1Transform() into 4
     94 	separate functions, which avoids the optimiser explosion.
     95 kcah
     96 
     97 hack	gcc-sparc64-double-arguments
     98 mdate	18 Sep 2000
     99 who	mrg
    100 port	sparc64
    101 file	xsrc/xc/lib/fonts/Type1/type1.c		: 1.2 : 1461 : 1507 : 1702 : 1709
    102 descr
    103 	in passing 17 "double" arguments to a function, gcc incorrectly tries
    104 	to use a register that doesn't exist, causing an internal error.  this
    105 	hack changes the way arguments are passed to the function, such that
    106 	a pointer to a "double" (really an array) is passed, and the old
    107 	arguments are assigned within the function.
    108 kcah
    109 
    110 hack	gcc-sparc64-gawk
    111 mdate	28 Oct 2000
    112 who	mrg
    113 port	sparc64
    114 file	gnu/usr.bin/gawk/Makefile		: 1.11 : 21 : 24
    115 descr
    116 	gcc fails to build gawk properly, due to double floating point bugs.
    117 	this simple test program will fail to print ``ab'':
    118 		BEGIN { f = "abc"; print substr(f, 1, 2); exit }
    119 	the work around is simple: use -msoft-quad-float.
    120 kcah
    121 
    122 hack    gcc-sparc64-libgcc
    123 mdate   01 Dec 2001
    124 who	jmc
    125 port	sparc64
    126 file	gnu/lib/libgcc/Makefile			: 1.29 : 24 : 27
    127 descr
    128 	gcc fails to do double -> int conversions correctly without 
    129 	soft-quad-float. Add it in there for the internal conversion
    130 	routines. This appears to be more than likely emulations bugs than
    131 	compiler bugs as the assembly looks correct on the surface.
    132 
    133 kcah
    134 
    135 hack	gcc-sparc64-iostat-systat
    136 mdate	04 Feb 2001
    137 who	mrg
    138 port	sparc64
    139 file	usr.sbin/iostat/Makefile	: 1.17 : 7 : 10
    140 file	usr.bin/systat/Makefile		: 1.23 : 6 : 9
    141 descr
    142 	gcc fails to build iostat properly, due to double floating point bugs.
    143 	results will include "Inf" and other garbage.
    144 	the work around is simple: use -msoft-quad-float.
    145 kcah
    146 
    147 hack	gcc-sparc64-nawk
    148 mdate	25 Oct 2001
    149 who	martin
    150 port	sparc64
    151 file	usr.bin/awk/Makefile		: 1.3 : 13 : 15
    152 descr
    153 	Don't use long double on sparc64.
    154 kcah
    155 
    156 hack	gcc-sparc64-ntp
    157 mdate	12 Nov 2000
    158 who	martin
    159 port	sparc64
    160 file	usr.sbin/ntp/Makefile.inc	: 1.5 : 17 : 19
    161 descr
    162 	gcc fails to build ntpd properly, due to double floating point bugs.
    163 	Ntpd will fail to decode incoming packets; ntpdc -s will report
    164 	a delay, offset and dispersion of 0.0000 for all peers.
    165 	the work around is simple: use -msoft-quad-float.
    166 kcah
    167 
    168 hack	gcc-sparc64-x_dhclient
    169 mdate	27 Dec 2000
    170 who	mrg
    171 port	sparc64
    172 file	distrib/utils/x_dhclient/Makefile	: 1.6 : 28 : 30
    173 descr
    174 	gcc fails with an ICE while building dhclient's parse.c with -O2
    175 	and -Os.  the work around is simple: don't use -Os.
    176 kcah
    177 
    178 hack	lint-no-long-double
    179 mdate	17 Aug 2001
    180 who	eeh
    181 port	sparc64
    182 file	usr.bin/xlint/lint1/param.h: 1.14 :
    183 descr
    184 	Don't use long double on sparc64.
    185 kcah
    186 
    187 hack	netstat ieee1394 address printing.
    188 mdate	14 Nov 2000
    189 who	matt
    190 file	lib/libc/net/getnameinfo.c	: 1.32 : 497 : 503
    191 descr
    192 	Because the current implementation of IP over IEEE1394, the
    193 	fw device address contains more than just the IEEE1394 EUI-64.
    194 	So when printing out IEEE1394 addresses, ignore the extra stuff.
    195 kcah
    196 
    197 hack	xterm vs. libterm
    198 mdate	01 Aug 2000
    199 who	jdc
    200 file	xsrc/xc/programs/xterm/main.c	: 1.2 : 3609 : 3614
    201 pr	10383
    202 descr
    203 	In order to extend the termcap string over 1023 bytes, a ZZ entry was
    204 	introduced to point to a memory location containing the full entry.
    205 	Without this hack, xterm will export a termcap containing the ZZ
    206 	entry, which will then be ignored by libterm.  As xterm modifies the
    207 	exported termcap, this would cause those modifications to be ignored.
    208 kcah
    209 
    210 hack	gcc-sh3-sed
    211 mdate	23 Apr 2002
    212 who	thorpej
    213 file	usr.bin/sed/Makefile	: 1.9 : 9 : 13
    214 descr
    215 	The in-tree GCC 2.95.3-based compiler ICEs when building
    216 	with optimization for SuperH.  Hack is to biuld with -O0.
    217 kcah
    218 
    219 hack	gcc-unsigned-compare
    220 cdate	09 Mar 2002
    221 mdate	18 Mar 2002
    222 who	bjh21
    223 port	arm
    224 file	dist/bind/lib/nameser/ns_parse.c : 1.3
    225 file	dist/dhcp/minires/ns_parse.c : 1.3
    226 file	dist/dhcp/omapip/result.c : 1.2
    227 file	dist/dhcp/server/failover.c : 1.3
    228 file	gnu/dist/gawk/eval.c : 1.4
    229 file	gnu/dist/toolchain/bfd/bfd.c : 1.2
    230 file	gnu/dist/toolchain/bfd/format.c : 1.2
    231 file	gnu/dist/toolchain/gdb/target.c : 1.2
    232 file	sys/kern/vfs_subr.c : 1.172
    233 descr	When checking that a potentially-unsigned enum is >= 0, assign it
    234 	to an int first.  This is necessary to avoid "comparison is always
    235 	true" warnings with -fshort-enums.  Casting to an int really should
    236 	be enough, but turns out not to be.
    237 kcah
    238 
    239 hack	wi-at-big-endian-bus
    240 cdate	15 Mar 2002
    241 who	martin
    242 file	dev/ic/wireg.h
    243 descr	Add an option to access the underlying bus in big endian byte order
    244 	to work around deficiencies in bus_space_{read,write}_* macros.
    245 	Those don't allow the implementation of a proper pcmcia bus space
    246 	tag.
    247 kcah
    248 
    249 hack	gcc 2.95.3 -O2 (-fgcse) bug
    250 cdate	Sun May  5 18:36:04 UTC 2002
    251 who	tsutsui
    252 port	macppc
    253 file	sys/arch/macppc/dev/adb_direct.c:	1.24 : 1895 : 1896
    254 pr	16678
    255 descr
    256 	gcc-2.95.3 does generates wrong code on optimization
    257 	by gcc -O2 (-fgcse), and adb_read_date_time() returns
    258 	wrong value on cuda system.
    259 	A null asm statement has been added to avoid this for workaround.
    260 kcah
    261 
    262 hack	gcc-vax-libbz2
    263 mdate	27 Jun 2002
    264 who	thorpej
    265 port	vax
    266 file	lib/libbz2/Makefile
    267 descr
    268 	libbz2 is mis-compiled with optimization with GCC 2.95.3
    269 	on VAX.  -O0 works around this problem.
    270 kcah
    271 
    272 hack	egcs-pc532-ip6_mroute
    273 cdate	09 Jul 2002
    274 who	simonb
    275 port	pc532
    276 file	sys/arch/pc532/conf/Makefile.pc532 : 1.70
    277 file	sys/arch/pc532/conf/files.pc532 : 1.47
    278 descr
    279 	egcs 1.1.2 gets an "internal error--insn does not satisfy its
    280 	constraints" error compiling ip6_mroute.c with -O2 or greater.
    281 	-O1 works around this problem.
    282 kcah
    283 
    284 hack	SuperH SH5 Toolchain Bugs
    285 cdate	11 Jul 2002
    286 who	scw
    287 port	sh5
    288 file	usr.sbin/ndbootd/ndbootd.c : 1.6
    289 file	usr.sbin/traceroute/traceroute.c : 1.48
    290 descr
    291 	The SuperH SH5 toolchain (2.97-sh5-010522) gets an internal
    292 	compiler error when assigning a bit-wise inverted value
    293 	under some circumstances.
    294 	Work around it by splitting the statement into two.
    295 kcah
    296 
    297 hack	vax Toolchain bug
    298 cdate	28 Mar 2003
    299 who	he
    300 port	vax
    301 file	sys/arch/vax/vax/intvec.S : 1.5
    302 descr
    303 	Workaround for PR toolchain/20924.  The assembler apparently
    304 	tries to range-check byte offsets when it doesn't have
    305 	sufficient information to make that decision.
    306 	Workaround uses `brw' instead of `brb' instruction.
    307 kcah
    308 
    309 hack	specific knowledge of colours in curses code
    310 cdate	Sun Apr  6 11:05:24 BST 2003
    311 who	jdc
    312 port	all
    313 file	lib/libcurses/color.c : r1.24
    314 descr
    315 	Swap red/blue and yellow/cyan colours for COLOR_OTHER.
    316 	Fix is to enhance libtermcap to understand terminfo-style % sequences.
    317 	See also:
    318 	    http://mail-index.NetBSD.org/tech-userlevel/2003/04/06/0000.html
    319 kcah
    320 
    321 hack	SuperH SH5 Toolchain Bugs
    322 cdate	17 May 2003
    323 who	scw
    324 port	sh5
    325 file	lib/libpthread/pthread_lock.c : 1.7
    326 descr
    327 	The SuperH SH5 toolchain generates incorrect PIC code when faced
    328 	with a symbol which is declared extern, but has local scope due
    329 	to being defined within an asm() statement (without being declared
    330 	.globl in that statement). Work around it by adding the .globl.
    331 kcah
    332 
    333 hack	Compensation for differing types of LINUX_USRSTACK and USRSTACK
    334 cdate	21 Aug 2003
    335 who	he
    336 file	sys/miscfs/procfs/procfs_linux.c : 1.14
    337 descr
    338 	Not all ports have LINUX_USRSTACK and/or USRSTACK defined as
    339 	literals/constants, but refer to variables of a type which is
    340 	not "unsigned long", causing compilation of procfs_linux.c to
    341 	fail with "makes integer from pointer without a cast".  This
    342 	is observed on e.g. the sun3 port.  Ideally the "types" for
    343 	symbols should be consistent across all ports.
    344 kcah
    345 
    346 hack	i386 / sparc default debugging type in GCC 3.3.1
    347 cdate	19 Sept 2003
    348 who	mrg
    349 file	gnu/dist/gcc/gcc/config/{i386,sparc}/netbsd-elf.h
    350 descr
    351 	Until i386 & sparc* switch to GDB 5.3, the default debugging
    352 	format needs to be stabs not DWARF.
    353 kcah
    354