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