HACKS revision 1.17
11.17Smrg# $NetBSD: HACKS,v 1.17 2003/10/28 08:22:48 mrg Exp $
21.1Slukem#
31.1Slukem# This file is intended to document workarounds for currently unsolved
41.1Slukem# (mostly) compiler bugs.
51.1Slukem#
61.1Slukem# Format:
71.1Slukem#   hack		title
81.1Slukem#   cdate		creation date
91.1Slukem#   mdate		mod date
101.1Slukem#   who			responsible developer
111.1Slukem#   port		...
121.1Slukem#  	  affected ports, space separated, if not "all"
131.1Slukem#   file		affected file : revision : line from : line to
141.1Slukem#  	  affected files and revision and line numbers describing hack
151.1Slukem#  	  multiple lines if necessary.
161.1Slukem#   pr			NNNN ...
171.1Slukem#  	  problem reports this hack works around, if known. Space
181.1Slukem#  	  separated.
191.1Slukem#   regress		src/regress/directory/where/test/found
201.1Slukem#  	  regression test directories, if available.
211.1Slukem#   descr
221.1Slukem#  	  insert short informal description (multi-line). (Longer ones
231.1Slukem#  	  should be in the PR database. More formal descriptions might
241.1Slukem#  	  be in the regress tree. See above).
251.1Slukem#   kcah
261.1Slukem#  	  closing bracket.
271.1Slukem#
281.1Slukem# this is a comment.
291.1Slukem
301.1Slukemhack	gcc 2.95/vax cannot handle __builtin_ffs()
311.1Slukemcdate	Fri Aug 23 21:31:15 CEST 2002
321.1Slukemwho	ragge
331.1Slukemport	vax
341.1Slukemfile	sys/lib/libkern/libkern.h : 1.42
351.1Slukemdescr
361.1Slukem	__builtin_ffs() is ifdef'd away if __vax__. Matt Thomas has added
371.1Slukem	this feature to GCC 3 so it can be removed when switching.
381.1Slukemkcah
391.1Slukem
401.1Slukemhack	binutil-2.11-sparc64-pltrela
411.1Slukemmdate	14 Aug 2001
421.1Slukemwho	eeh
431.1Slukemport	sparc64
441.1Slukemfile	libexec/ld.elf_so/reloc.c: 1.41 : 597 : 619
451.1Slukemdescr
461.1Slukem	The first for PLT entries are reserved.  There is some disagreement
471.1Slukem	whether they should have associated relocation entries.  Both the
481.1Slukem	SPARC 32-bit and 64-bit ELF specifications say that they should have
491.1Slukem	relocation entries, but the 32-bit SPARC binutils do not generate
501.1Slukem	them, and now the 64-bit SPARC binutils have stopped generating them
511.1Slukem	too.
521.1Slukem
531.1Slukem	To provide binary compatibility, we will check the first entry, if it
541.1Slukem	is reserved it should not be of the type JMP_SLOT.  If it is JMP_SLOT,
551.1Slukem	then the 4 reserved entries were not generated and our index is 4
561.1Slukem	entries too far, so we frob the rela pointer.
571.1Slukemkcah
581.1Slukem
591.1Slukemhack	netstat ieee1394 address printing.
601.1Slukemmdate	14 Nov 2000
611.1Slukemwho	matt
621.1Slukemfile	lib/libc/net/getnameinfo.c	: 1.32 : 497 : 503
631.1Slukemdescr
641.1Slukem	Because the current implementation of IP over IEEE1394, the
651.1Slukem	fw device address contains more than just the IEEE1394 EUI-64.
661.1Slukem	So when printing out IEEE1394 addresses, ignore the extra stuff.
671.1Slukemkcah
681.1Slukem
691.1Slukemhack	xterm vs. libterm
701.1Slukemmdate	01 Aug 2000
711.1Slukemwho	jdc
721.1Slukemfile	xsrc/xc/programs/xterm/main.c	: 1.2 : 3609 : 3614
731.1Slukempr	10383
741.1Slukemdescr
751.1Slukem	In order to extend the termcap string over 1023 bytes, a ZZ entry was
761.1Slukem	introduced to point to a memory location containing the full entry.
771.1Slukem	Without this hack, xterm will export a termcap containing the ZZ
781.1Slukem	entry, which will then be ignored by libterm.  As xterm modifies the
791.1Slukem	exported termcap, this would cause those modifications to be ignored.
801.1Slukemkcah
811.1Slukem
821.1Slukemhack	gcc-sh3-sed
831.1Slukemmdate	23 Apr 2002
841.1Slukemwho	thorpej
851.1Slukemfile	usr.bin/sed/Makefile	: 1.9 : 9 : 13
861.1Slukemdescr
871.1Slukem	The in-tree GCC 2.95.3-based compiler ICEs when building
881.1Slukem	with optimization for SuperH.  Hack is to biuld with -O0.
891.1Slukemkcah
901.1Slukem
911.1Slukemhack	gcc-unsigned-compare
921.1Slukemcdate	09 Mar 2002
931.1Slukemmdate	18 Mar 2002
941.1Slukemwho	bjh21
951.1Slukemport	arm
961.1Slukemfile	dist/bind/lib/nameser/ns_parse.c : 1.3
971.1Slukemfile	dist/dhcp/minires/ns_parse.c : 1.3
981.1Slukemfile	dist/dhcp/omapip/result.c : 1.2
991.1Slukemfile	dist/dhcp/server/failover.c : 1.3
1001.1Slukemfile	gnu/dist/gawk/eval.c : 1.4
1011.1Slukemfile	gnu/dist/toolchain/bfd/bfd.c : 1.2
1021.1Slukemfile	gnu/dist/toolchain/bfd/format.c : 1.2
1031.1Slukemfile	gnu/dist/toolchain/gdb/target.c : 1.2
1041.1Slukemfile	sys/kern/vfs_subr.c : 1.172
1051.1Slukemdescr	When checking that a potentially-unsigned enum is >= 0, assign it
1061.1Slukem	to an int first.  This is necessary to avoid "comparison is always
1071.1Slukem	true" warnings with -fshort-enums.  Casting to an int really should
1081.1Slukem	be enough, but turns out not to be.
1091.1Slukemkcah
1101.1Slukem
1111.1Slukemhack	wi-at-big-endian-bus
1121.1Slukemcdate	15 Mar 2002
1131.1Slukemwho	martin
1141.1Slukemfile	dev/ic/wireg.h
1151.1Slukemdescr	Add an option to access the underlying bus in big endian byte order
1161.1Slukem	to work around deficiencies in bus_space_{read,write}_* macros.
1171.1Slukem	Those don't allow the implementation of a proper pcmcia bus space
1181.1Slukem	tag.
1191.1Slukemkcah
1201.1Slukem
1211.1Slukemhack	gcc-vax-libbz2
1221.1Slukemmdate	27 Jun 2002
1231.1Slukemwho	thorpej
1241.1Slukemport	vax
1251.1Slukemfile	lib/libbz2/Makefile
1261.1Slukemdescr
1271.1Slukem	libbz2 is mis-compiled with optimization with GCC 2.95.3
1281.1Slukem	on VAX.  -O0 works around this problem.
1291.1Slukemkcah
1301.1Slukem
1311.1Slukemhack	egcs-pc532-ip6_mroute
1321.1Slukemcdate	09 Jul 2002
1331.1Slukemwho	simonb
1341.1Slukemport	pc532
1351.1Slukemfile	sys/arch/pc532/conf/Makefile.pc532 : 1.70
1361.1Slukemfile	sys/arch/pc532/conf/files.pc532 : 1.47
1371.1Slukemdescr
1381.1Slukem	egcs 1.1.2 gets an "internal error--insn does not satisfy its
1391.1Slukem	constraints" error compiling ip6_mroute.c with -O2 or greater.
1401.1Slukem	-O1 works around this problem.
1411.1Slukemkcah
1421.1Slukem
1431.1Slukemhack	SuperH SH5 Toolchain Bugs
1441.1Slukemcdate	11 Jul 2002
1451.1Slukemwho	scw
1461.1Slukemport	sh5
1471.1Slukemfile	usr.sbin/ndbootd/ndbootd.c : 1.6
1481.1Slukemfile	usr.sbin/traceroute/traceroute.c : 1.48
1491.1Slukemdescr
1501.1Slukem	The SuperH SH5 toolchain (2.97-sh5-010522) gets an internal
1511.1Slukem	compiler error when assigning a bit-wise inverted value
1521.1Slukem	under some circumstances.
1531.1Slukem	Work around it by splitting the statement into two.
1541.2Shekcah
1551.2She
1561.2Shehack	vax Toolchain bug
1571.2Shecdate	28 Mar 2003
1581.2Shewho	he
1591.2Sheport	vax
1601.2Shefile	sys/arch/vax/vax/intvec.S : 1.5
1611.2Shedescr
1621.2She	Workaround for PR toolchain/20924.  The assembler apparently
1631.2She	tries to range-check byte offsets when it doesn't have
1641.2She	sufficient information to make that decision.
1651.2She	Workaround uses `brw' instead of `brb' instruction.
1661.3Sjdckcah
1671.3Sjdc
1681.3Sjdchack	specific knowledge of colours in curses code
1691.3Sjdccdate	Sun Apr  6 11:05:24 BST 2003
1701.3Sjdcwho	jdc
1711.3Sjdcport	all
1721.3Sjdcfile	lib/libcurses/color.c : r1.24
1731.3Sjdcdescr
1741.3Sjdc	Swap red/blue and yellow/cyan colours for COLOR_OTHER.
1751.3Sjdc	Fix is to enhance libtermcap to understand terminfo-style % sequences.
1761.3Sjdc	See also:
1771.5Ssalo	    http://mail-index.NetBSD.org/tech-userlevel/2003/04/06/0000.html
1781.4Sscwkcah
1791.4Sscw
1801.4Sscwhack	SuperH SH5 Toolchain Bugs
1811.4Sscwcdate	17 May 2003
1821.4Sscwwho	scw
1831.4Sscwport	sh5
1841.4Sscwfile	lib/libpthread/pthread_lock.c : 1.7
1851.4Sscwdescr
1861.4Sscw	The SuperH SH5 toolchain generates incorrect PIC code when faced
1871.4Sscw	with a symbol which is declared extern, but has local scope due
1881.4Sscw	to being defined within an asm() statement (without being declared
1891.4Sscw	.globl in that statement). Work around it by adding the .globl.
1901.7Shekcah
1911.7She
1921.7Shehack	Compensation for differing types of LINUX_USRSTACK and USRSTACK
1931.7Shecdate	21 Aug 2003
1941.7Shewho	he
1951.7Shefile	sys/miscfs/procfs/procfs_linux.c : 1.14
1961.7Shedescr
1971.7She	Not all ports have LINUX_USRSTACK and/or USRSTACK defined as
1981.7She	literals/constants, but refer to variables of a type which is
1991.7She	not "unsigned long", causing compilation of procfs_linux.c to
2001.7She	fail with "makes integer from pointer without a cast".  This
2011.7She	is observed on e.g. the sun3 port.  Ideally the "types" for
2021.7She	symbols should be consistent across all ports.
2031.11Slukemkcah
2041.11Slukem
2051.11Slukemhack	gcc 3.3.x bug
2061.11Slukemcdate	Sun Oct 26 01:50:16 UTC 2003
2071.11Slukemwho	lukem
2081.11Slukemport	MACHINE_ARCH == arm
2091.11Slukemfile	usr.bin/newsyslog/newsyslog.c
2101.11Slukempr	22986 23002 23217
2111.11Slukemdescr
2121.11Slukem	newsyslog fails with
2131.11Slukem		newsyslog: config line 7: bad flags
2141.11Slukem	solved when compiled with -fno-gcse-lm
2151.13Ssimonbkcah
2161.13Ssimonb
2171.13Ssimonbhack	gcc-pc532-duffs_device
2181.13Ssimonbcdate	Mon Oct 27 07:23:05 UTC 2003
2191.13Ssimonbwho	simonb
2201.13Ssimonbport	pc532
2211.13Ssimonbfile	sys/arch/pc532/conf/Makefile.pc532 : 1.71
2221.13Ssimonbfile	sys/arch/pc532/conf/files.pc532 : 1.52
2231.14Ssimonbpr	GCC PR optimization/5230
2241.13Ssimonbdescr
2251.13Ssimonb	gcc incorrectly gives an "unreachable code at beginning of switch
2261.13Ssimonb	statement" for a Duff's device construct in arch/pc532/dev/ncr.c.
2271.15Swiz	There is no way to disable just this warning, so -Wno-error is
2281.13Ssimonb	turned on for this file.
2291.16Sclkcah
2301.16Scl
2311.16Sclhack	gcc 3.3.2 m68k {u,}int64_t uninitialized bug
2321.16Sclcdate	Tue Oct 28 02:46:46 CET 2003
2331.16Sclwho	cl
2341.16Sclport	MACHINE_ARCH == m68k
2351.16Sclfile	sys/dev/scsipi/sd.c : 1.212 : 686
2361.16Sclfile	sys/dev/ata/wd.c : 1.265 : 483
2371.16Sclfile	sys/nfs/nfs_serv.c : 1.84 : 3290
2381.16Scldescr
2391.16Scl	gcc incorrectly reports {u,}int64_t variables as used uninitialized.
2401.16Scl	Work around by adding explicit initializers.
2411.16Scl	gcc bug report at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12792
2421.17Smrgkcah
2431.17Smrg
2441.17Smrghack	gcc 3.3.2/mdsetimage
2451.17Smrgcdate	Tue Oct 28 18:43:05 EST 2003
2461.17Smrgwho	fredette
2471.17Smrgport	sun2
2481.17Smrgfile	gnu/usr.sbin/mdsetimage/Makefile : 1.15
2491.17Smrgdescr
2501.17Smrg	mdsetimage.c causes cc1 to barf for as-yet unknown reasons.  this
2511.17Smrg	hack ues -O0 to avoid the problem.
2521.17Smrgkcah
2531.17Smrg
2541.17Smrghack	gcc 3.3.2/installboot/ffs.c
2551.17Smrgcdate	Tue Oct 28 18:43:05 EST 2003
2561.17Smrgwho	fredette
2571.17Smrgport	sun2
2581.17Smrgfile	usr.sbin/installboot/Makefile : 1.26
2591.17Smrgdescr
2601.17Smrg	ffs.c causes cc1 to barf for as-yet unknown reasons.  this
2611.17Smrg	hack ues -O0 to avoid the problem.
2621.1Slukemkcah
263