HACKS revision 1.59
11.59Smrg# $NetBSD: HACKS,v 1.59 2006/05/11 09:39:58 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	netstat ieee1394 address printing.
311.1Slukemmdate	14 Nov 2000
321.1Slukemwho	matt
331.1Slukemfile	lib/libc/net/getnameinfo.c	: 1.32 : 497 : 503
341.1Slukemdescr
351.1Slukem	Because the current implementation of IP over IEEE1394, the
361.1Slukem	fw device address contains more than just the IEEE1394 EUI-64.
371.1Slukem	So when printing out IEEE1394 addresses, ignore the extra stuff.
381.1Slukemkcah
391.1Slukem
401.1Slukemhack	xterm vs. libterm
411.1Slukemmdate	01 Aug 2000
421.1Slukemwho	jdc
431.1Slukemfile	xsrc/xc/programs/xterm/main.c	: 1.2 : 3609 : 3614
441.1Slukempr	10383
451.1Slukemdescr
461.1Slukem	In order to extend the termcap string over 1023 bytes, a ZZ entry was
471.1Slukem	introduced to point to a memory location containing the full entry.
481.1Slukem	Without this hack, xterm will export a termcap containing the ZZ
491.1Slukem	entry, which will then be ignored by libterm.  As xterm modifies the
501.1Slukem	exported termcap, this would cause those modifications to be ignored.
511.1Slukemkcah
521.1Slukem
531.1Slukemhack	wi-at-big-endian-bus
541.1Slukemcdate	15 Mar 2002
551.1Slukemwho	martin
561.1Slukemfile	dev/ic/wireg.h
571.1Slukemdescr	Add an option to access the underlying bus in big endian byte order
581.1Slukem	to work around deficiencies in bus_space_{read,write}_* macros.
591.1Slukem	Those don't allow the implementation of a proper pcmcia bus space
601.1Slukem	tag.
611.1Slukemkcah
621.1Slukem
631.3Sjdchack	specific knowledge of colours in curses code
641.3Sjdccdate	Sun Apr  6 11:05:24 BST 2003
651.3Sjdcwho	jdc
661.3Sjdcfile	lib/libcurses/color.c : r1.24
671.3Sjdcdescr
681.3Sjdc	Swap red/blue and yellow/cyan colours for COLOR_OTHER.
691.3Sjdc	Fix is to enhance libtermcap to understand terminfo-style % sequences.
701.3Sjdc	See also:
711.5Ssalo	    http://mail-index.NetBSD.org/tech-userlevel/2003/04/06/0000.html
721.4Sscwkcah
731.4Sscw
741.7Shehack	Compensation for differing types of LINUX_USRSTACK and USRSTACK
751.7Shecdate	21 Aug 2003
761.7Shewho	he
771.7Shefile	sys/miscfs/procfs/procfs_linux.c : 1.14
781.7Shedescr
791.7She	Not all ports have LINUX_USRSTACK and/or USRSTACK defined as
801.7She	literals/constants, but refer to variables of a type which is
811.7She	not "unsigned long", causing compilation of procfs_linux.c to
821.7She	fail with "makes integer from pointer without a cast".  This
831.7She	is observed on e.g. the sun3 port.  Ideally the "types" for
841.7She	symbols should be consistent across all ports.
851.25Smrgkcah
861.25Smrg
871.25Smrghack	GCC2 isn't C99
881.25Smrgcdate	5 December 2003
891.25Smrgwho	mrg
901.25Smrgfile	gnu/dist/binutils/ld/ldlex.c: r1.2
911.25Smrgdescr
921.25Smrg	ldlex.c is generated from ldlex.l and we get macro redefinition
931.25Smrg	errors from it if __STDC_VERSION__ is not C99 compliant.  This
941.25Smrg	hack forces NetBSD 1.6 and later systems to also include <stdint.h>
951.25Smrg	to get the relevant definitions.  This hack should be backed out
961.25Smrg	when all platforms have switched away from GCC2.
971.11Slukemkcah
981.11Slukem
991.37Sjunyounghack	gcc-strict-aliasing
1001.37Sjunyoungcdate	6 August 2004
1011.37Sjunyoungwho	junyoung
1021.37Sjunyoungpr	26516
1031.37Sjunyoungfile	src/usr.sbin/racoon/racoon/Makefile : 1.21
1041.37Sjunyoungdescr
1051.37Sjunyoung	GCC issues a warning "dereferencing type-punned pointer will break
1061.37Sjunyoung	strict-aliasing rules" when compiling
1071.37Sjunyoung	crypto/dist/kame/racoon/crypto/openssl.c with -O[23s]. Note that this
1081.38Sjunyoung	is due to use of type casting in a non-standard way in the code and
1091.38Sjunyoung	not a compiler bug. Once a new release of KAME with a proper fix
1101.38Sjunyoung	applied is imported this should be backed out.
1111.37Sjunyoungkcah
1121.37Sjunyoung
1131.58Smrghack	gcc4 wrong uninitialised variable
1141.58Smrgmdate	10 May 2006
1151.58Smrgwho	mrg
1161.58Smrgfile	bin/ksh/eval.c			: 1.6
1171.58Smrgfile	bin/sh/histedit.c		: 1.39
1181.58Smrgfile	bin/sh/parser.c			: 1.60
1191.58Smrgfile	bin/systrace/systrace.c		: 1.33
1201.58Smrgfile	crypto/dist/heimdal/kdc/524.c	: 1.10
1211.58Smrgfile	crypto/dist/ssh/sftp.c		: 1.20
1221.58Smrgfile	crypto/dist/ssh/ssh-keysign.c	: 1.11
1231.58Smrgfile	dist/ipf/lib/hostname.c		: 1.2
1241.58Smrgfile	dist/ipf/tools/ipmon.c		: 1.8
1251.58Smrgfile	dist/ntp/ntpd/refclock_shm.c	: 1.4
1261.58Smrgfile	dist/ntp/sntp/timing.c		: 1.3
1271.58Smrgfile	dist/pppd/pppstats/pppstats.c	: 1.3
1281.58Smrgfile	dist/smbfs/lib/smb/rap.c	: 1.6
1291.58Smrgfile	dist/tcpdump/print-zephyr.c	: 1.5
1301.58Smrgfile	gnu/libexec/uucp/uucico/uucico.c : 1.6
1311.58Smrgfile	lib/libc/citrus/citrus_csmapper.c : 1.6
1321.58Smrgfile	lib/libc/citrus/citrus_pivot_factory.c : 1.5
1331.58Smrgfile	lib/libc/inet/inet_cidr_ntop.c	: 1.3
1341.58Smrgfile	lib/libc/inet/inet_ntop.c	: 1.3
1351.58Smrgfile	lib/libc/stdio/vfwprintf.c	: 1.8
1361.58Smrgfile	libexec/ld.elf_so/arch/sparc64/mdreloc.c : 1.39
1371.58Smrgfile	sbin/fsck_ext2fs/dir.c		: 1.19
1381.58Smrgfile	sbin/routed/rtquery/rtquery.c	: 1.18
1391.58Smrgfile	sys/crypto/cast128/cast128.c	: 1.9
1401.58Smrgfile	sys/ddb/db_command.c		: 1.86
1411.58Smrgfile	sys/dev/fss.c			: 1.25
1421.58Smrgfile	sys/dev/ic/midway.c		: 1.71
1431.58Smrgfile	sys/dev/pci/machfb.c		: 1.45
1441.58Smrgfile	sys/dist/ipf/netinet/ip_nat.c	: 1.10
1451.58Smrgfile	sys/dist/ipf/netinet/ip_rpcb_pxy.c : 1.8
1461.58Smrgfile	sys/dist/pf/net/pf.c		: 1.22
1471.59Smrgfile	sys/fs/udf/udf_vnops.c		: 1.4
1481.58Smrgfile	sys/kern/kern_sig.c		: 1.219
1491.58Smrgfile	sys/kern/tty.c			: 1.181
1501.58Smrgfile	sys/net/bpf.c			: 1.116
1511.58Smrgfile	sys/net/zlib.c			: 1.26
1521.58Smrgfile	sys/netinet/in.c		: 1.107
1531.58Smrgfile	sys/netsmb/smb_smb.c		: 1.27
1541.58Smrgfile	sys/netsmb/smb_trantcp.c	: 1.22
1551.58Smrgfile	sys/nfs/nfs_serv.c		: 1.108
1561.58Smrgfile	sys/nfs/nfs_socket.c		: 1.129
1571.58Smrgfile	sys/nfs/nfs_syscalls.c		: 1.91
1581.58Smrgfile	sys/ufs/lfs/lfs_vfsops.c	: 1.207 [also (char *)]
1591.58Smrgfile	usr.bin/ftp/ftp.c		: 1.140
1601.58Smrgfile	usr.bin/find/function.c		: 1.54
1611.58Smrgfile	usr.bin/mail/tty.c		: 1.20
1621.58Smrgfile	usr.bin/nl/nl.c			: 1.7
1631.58Smrgfile	usr.bin/systat/keyboard.c	: 1.23
1641.58Smrgfile	usr.bin/usbhidctl/usbhid.c	: 1.29
1651.58Smrgfile	usr.bin/vi/cl/cl_read.c		: 1.5
1661.58Smrgfile	usr.bin/vi/ex/ex_cscope.c	: 1.12
1671.58Smrgfile	usr.bin/vi/ex/ex_tag.c		: 1.19
1681.58Smrgfile	usr.bin/vi/vi/v_txt.c		: 1.15
1691.58Smrgfile	usr.sbin/altq/altqstat/qdisc_rio.c : 1.4
1701.58Smrgfile	usr.sbin/cron/do_command.c	: 1.19
1711.58Smrgfile	usr.sbin/timed/timed/slave.c	: 1.15
1721.58Smrgdescr
1731.58Smrg	GCC 4.1 gets many uninitialised variable warnings wrong.  We should
1741.58Smrg	really audit all the old hacks like this when older compilers are
1751.58Smrg	removed from the tree, as many are probably no longer required.
1761.58Smrgkcah
1771.58Smrg
1781.59Smrghack	gcc4 pointer sign and strict aliasing problems
1791.59Smrgmdate	10 May 2006
1801.59Smrgwho	mrg
1811.59Smrgfile	bin/ed/Makefile			: 1.33
1821.59Smrgfile	bin/systrace/Makefile		: 1.
1831.59Smrgfile	usr.bin/awk/Makefile		: 1.9
1841.59Smrgfile	usr.bin/vi/build/Makefile	: 1.26
1851.59Smrgfile	usr.bin/ssh/ssh/Makefile	: 1.24
1861.59Smrgfile	usr.sbin/amd/amd/Makefile	: 1.27
1871.59Smrgfile	usr.sbin/amd/amq/Makefile	: 1.14
1881.59Smrgfile	usr.sbin/amd/libamu/Makefile	: 1.20
1891.59Smrgfile	usr.sbin/amd/pawd/Makefile	: 1.5
1901.59Smrgfile	usr.sbin/bind/Makefile.inc	: 1.22
1911.59Smrgfile	usr.sbin/dhcp/Makefile.inc	: 1.20
1921.59Smrgfile	usr.sbin/dumplfs/Makefile	: 1.11
1931.59Smrgfile	usr.sbin/ipf/ipftest/Makefile	: 1.32
1941.59Smrgfile	usr.sbin/isdn/isdnd/Makefile	: 1.6
1951.59Smrgfile	usr.sbin/isdn/isdnmonitor/Makefile : 1.3
1961.59Smrgfile	usr.sbin/isdn/isdntel/Makefile	: 1.2
1971.59Smrgfile	usr.sbin/isdn/isdntrace/Makefile : 126
1981.59Smrgfile	usr.sbin/ntp/ntpd/Makefile	: 1.10/1.11
1991.59Smrgfile	usr.sbin/ntp/ntptime/Makefile	: 1.4/1.5
2001.59Smrgfile	usr.sbin/pppd/Makefile.inc	: 1.3
2011.59Smrgfile	usr.sbin/pppd/pppd/Makefile	: 1.38
2021.59Smrgfile	usr.sbin/rbootd/Makefile	: 1.10
2031.59Smrgfile	usr.sbin/rtadvd/Makefile	: 1.9
2041.59Smrgfile	usr.sbin/tcpdump/Makefile	: 1.41
2051.59Smrgfile	usr.sbin/wiconfig/Makefile	: 1.3
2061.59Smrgdescr
2071.59Smrg	GCC 4.1 warns on pointer sign comparision/assignments and lots of
2081.59Smrg	code does not conform.  For now we use -Wno-pointer-sign and
2091.59Smrg	-fno-strict-aliasing.
2101.59Smrgkcah
2111.59Smrg
2121.13Ssimonb
2131.21Smycroftport	vax
2141.21Smycroft
2151.52Sjmc	hack	gcc 2.95/vax doesn't like abort being used as function pointer
2161.52Sjmc	cdate	Tue Dec 13 05:54:50 GMT 2005
2171.52Sjmc	who	jmc
2181.52Sjmc	file	lib/libc/rpc/svc_vc.c 1.15
2191.52Sjmc	descr
2201.52Sjmc		Provide a local definition for abort which doesn't include
2211.52Sjmc		the noreturn attribute which trips up gcc 2.95 on vax.
2221.52Sjmc	
2231.45Sjmc	hack	gcc 2.95/vax doesn't have stdbool.h and gettext needs it
2241.45Sjmc	cdate	Mon May  9 12:16:22 CDT 2005
2251.45Sjmc	who	jmc
2261.45Sjmc	file	gnu/usr.bin/gettext/Makefile.inc.prog 1.5
2271.45Sjmc		gnu/usr.bin/gettext/libgrep/Makefile 1.3
2281.45Sjmc		gnu/usr.bin/gettext/libnlspr/Makefile 1.5
2291.45Sjmc		gnu/usr.bin/gettext/libnlsut/Makefile 1.3   
2301.45Sjmc	descr
2311.45Sjmc		The latest gettext assumes a C99 environment or at least
2321.45Sjmc		configure checks to work around this. As we don't use configure
2331.45Sjmc		provide a stdbool.h for vax builds locally in directories from
2341.45Sjmc		the template provided by the gettext code.
2351.45Sjmc	
2361.44Sjmc	hack	gcc 2.95/vax can't handle __used__ in mcount.c
2371.44Sjmc	cdate	Fri May  6 14:30:53 CDT 2005
2381.44Sjmc	who	jmc
2391.44Sjmc	file	src/lib/libc/gmon/mcount.c 1.17
2401.44Sjmc	descr
2411.44Sjmc                Recent changes to mark this as __used__ to prevent optimization
2421.44Sjmc                away on sparc64 don't work on 2.95 vax. Ifdef'd back in the
2431.44Sjmc                old __unused__ if on vax.
2441.44Sjmc	
2451.21Smycroft	hack	gcc 2.95/vax cannot handle __builtin_ffs()
2461.21Smycroft	cdate	Fri Aug 23 21:31:15 CEST 2002
2471.21Smycroft	who	ragge
2481.21Smycroft	file	sys/lib/libkern/libkern.h : 1.42
2491.21Smycroft	descr
2501.21Smycroft		__builtin_ffs() is ifdef'd away if __vax__. Matt Thomas has
2511.21Smycroft		added this feature to GCC 3 so it can be removed when switching.
2521.44Sjmc	
2531.21Smycroft
2541.21Smycroft	hack	gcc-vax-libbz2
2551.21Smycroft	mdate	27 Jun 2002
2561.21Smycroft	who	thorpej
2571.21Smycroft	file	lib/libbz2/Makefile
2581.21Smycroft	descr
2591.21Smycroft		libbz2 is mis-compiled with optimization with GCC 2.95.3
2601.24Sragge		on VAX.  -O0 works around this problem.
2611.24Sragge	kcah
2621.24Sragge
2631.24Sragge	hack	gawk
2641.24Sragge	mdate	8 Nov 2003
2651.24Sragge	who	ragge
2661.24Sragge	file	gnu/usr.bin/gawk/Makefile
2671.24Sragge	descr
2681.24Sragge		gawk is mis-compiled with optimization with GCC 2.95.3
2691.21Smycroft		on VAX.  -O0 works around this problem.
2701.21Smycroft	kcah
2711.21Smycroft
2721.21Smycroft	hack	vax Toolchain bug
2731.21Smycroft	cdate	28 Mar 2003
2741.21Smycroft	who	he
2751.21Smycroft	file	sys/arch/vax/vax/intvec.S : 1.5
2761.21Smycroft	descr
2771.21Smycroft		Workaround for PR toolchain/20924.  The assembler apparently
2781.21Smycroft		tries to range-check byte offsets when it doesn't have
2791.21Smycroft		sufficient information to make that decision.
2801.21Smycroft		Workaround uses `brw' instead of `brb' instruction.
2811.23She	kcah
2821.23She
2831.23She	hack	vax gcc 2.95.3 -Wuninitialized workarounds
2841.23She	cdate	6 Nov 2003
2851.23She	who	he
2861.23She	file	sys/dev/bi/if_ni.c : 1.22
2871.23She	file	sys/arch/vax/vax/ctu.c : 1.20
2881.23She	descr
2891.23She		Workaround for gcc 2.95.3 failing to detect that certain
2901.23She		variables will be initialized; so that this code compiles
2911.23She		with -Wuninitialized.  Should be reviewed and possibly
2921.23She		reverted when gcc 3.3.2 is ready for vax.
2931.21Smycroft	kcah
2941.21Smycroft
2951.34Scl	hack	vax gcc 2.95.3 structure initialization
2961.34Scl	cdat	13 May 2004
2971.34Scl	who	cl
2981.34Scl	file	sys/miscfs/kernfs/kernfs_vnops.c : 1.104
2991.34Scl	descr
3001.34Scl		Workaround for gcc 2.95.3 failing to initialize structures
3011.34Scl		and/or unions inside structures using nested designators.
3021.34Scl		Should be reverted when gcc >=3.3.3 is ready for vax.
3031.34Scl	kcah
3041.21Smycroft
3051.35She	hack	vax gcc 2.95.3 needs -I. to build nslexer.c
3061.35She	cdat	6 Jun 2004
3071.36She	who	mhitch
3081.36She	file	lib/libc/arch/vax/Makefile.inc : 1.6
3091.35She	descr
3101.35She		It appears necessary to add -I. to CPPFLAGS when building
3111.35She		nslesxer.c.  This may be caused by gcc 2.95.3 being used.
3121.35She		Should be reverted when a newer gcc is ready for vax.
3131.35She	kcah
3141.35She
3151.43Stron	hack	vax gcc 2.95.3 doesn't understand "-std=c99"
3161.43Stron	cdat	5 April 2005
3171.43Stron	who	tron
3181.43Stron	file	src/share/mk/bsd.sys.mk
3191.43Stron	descr
3201.43Stron		We cannot use "-std=c99" for compiler warning level 4 and above
3211.43Stron		because gcc 2.95.3 doesn't support that option.
3221.43Stron	kcah
3231.43Stron
3241.54She	hack	declare boolean_t in two IPF user-mode programs
3251.54She	cdate	Tue Mar  7 19:19:20 CET 2006
3261.54She	who	he
3271.54She	file	dist/ipf/ipsend/iptests.c : 1.8
3281.54She		dist/ipf/ipsend/sock.c : 1.7
3291.54She	descr
3301.54She		The IPF user-mode programs ipsend and iptest first
3311.54She		include <sys/types.h> without _KERNEL defined, and
3321.54She		later include <sys/file.h> with _KERNEL defined.
3331.54She		This causes a build failure when building for vax,
3341.54She		since <sys/device.h> ends up being included without
3351.54She		bollean_t being defined by <sys/types.h>.
3361.54She		Build failure and further details documented in
3371.54She		PR#32907.
3381.54She	kcah
3391.54She
3401.21Smycroftport	sparc64
3411.21Smycroft
3421.21Smycroft	hack	binutil-2.11-sparc64-pltrela
3431.21Smycroft	mdate	14 Aug 2001
3441.21Smycroft	who	eeh
3451.21Smycroft	file	libexec/ld.elf_so/arch/sparc64/mdreloc.c
3461.21Smycroft	descr
3471.39Sskrll		The first four PLT entries are reserved.  There is some
3481.21Smycroft		disagreement whether they should have associated relocation
3491.21Smycroft		entries.  Both the SPARC 32-bit and 64-bit ELF specifications
3501.21Smycroft		say that they should have relocation entries, but the 32-bit
3511.21Smycroft		SPARC binutils do not generate them, and now the 64-bit SPARC
3521.21Smycroft		binutils have stopped generating them too.
3531.21Smycroft
3541.21Smycroft		To provide binary compatibility, we will check the first entry,
3551.21Smycroft		if it is reserved it should not be of the type JMP_SLOT.  If it
3561.21Smycroft		is JMP_SLOT, then the 4 reserved entries were not generated and
3571.21Smycroft		our index is 4 entries too far, so we frob the rela pointer.
3581.21Smycroft	kcah
3591.21Smycroft
3601.21Smycroft
3611.21Smycroftport	arm
3621.21Smycroft
3631.21Smycroft	hack	gcc-unsigned-compare
3641.21Smycroft	cdate	09 Mar 2002
3651.21Smycroft	mdate	18 Mar 2002
3661.21Smycroft	who	bjh21
3671.21Smycroft	file	dist/bind/lib/nameser/ns_parse.c : 1.3
3681.21Smycroft	file	dist/dhcp/minires/ns_parse.c : 1.3
3691.21Smycroft	file	dist/dhcp/omapip/result.c : 1.2
3701.21Smycroft	file	dist/dhcp/server/failover.c : 1.3
3711.21Smycroft	file	gnu/dist/gawk/eval.c : 1.4
3721.21Smycroft	file	gnu/dist/toolchain/bfd/bfd.c : 1.2
3731.21Smycroft	file	gnu/dist/toolchain/bfd/format.c : 1.2
3741.21Smycroft	file	gnu/dist/toolchain/gdb/target.c : 1.2
3751.21Smycroft	file	sys/kern/vfs_subr.c : 1.172
3761.21Smycroft	descr	When checking that a potentially-unsigned enum is >= 0, assign
3771.21Smycroft		it to an int first.  This is necessary to avoid "comparison is
3781.21Smycroft		always true" warnings with -fshort-enums.  Casting to an int
3791.21Smycroft		really should be enough, but turns out not to be.
3801.21Smycroft	kcah
3811.21Smycroft
3821.21Smycroft	hack	gcc 3.3.2/arm sys/kern/uipc_socket.c
3831.21Smycroft	cdate	Tue Oct 28 18:02:16 GMT 2003
3841.21Smycroft	who	skrll
3851.41Sbjh21	pr	23044
3861.41Sbjh21	file	sys/arch/arm/conf/Makefile.arm : 1.19
3871.21Smycroft	descr
3881.21Smycroft		Performing a build.sh tools on a CATS with NFS mounted 
3891.21Smycroft		obj and src directories results in "panic: receive 1"
3901.21Smycroft		The hack is to compile sys/kern/uipc_socket.c with
3911.21Smycroft		-fno-strict-aliasing
3921.21Smycroft	kcah
3931.21Smycroft
3941.21Smycroft
3951.13Ssimonbport	pc532
3961.16Scl
3971.21Smycroft	hack	egcs-pc532-ip6_mroute
3981.21Smycroft	cdate	09 Jul 2002
3991.21Smycroft	who	simonb
4001.21Smycroft	file	sys/arch/pc532/conf/Makefile.pc532 : 1.70
4011.21Smycroft	file	sys/arch/pc532/conf/files.pc532 : 1.47
4021.21Smycroft	descr
4031.21Smycroft		egcs 1.1.2 gets an "internal error--insn does not satisfy its
4041.21Smycroft		constraints" error compiling ip6_mroute.c with -O2 or greater.
4051.21Smycroft		-O1 works around this problem.
4061.21Smycroft	kcah
4071.21Smycroft
4081.21Smycroft	hack	gcc-pc532-duffs_device
4091.21Smycroft	cdate	Mon Oct 27 07:23:05 UTC 2003
4101.21Smycroft	who	simonb
4111.21Smycroft	file	sys/arch/pc532/conf/Makefile.pc532 : 1.71
4121.21Smycroft	file	sys/arch/pc532/conf/files.pc532 : 1.52
4131.21Smycroft	pr	GCC PR optimization/5230
4141.21Smycroft	descr
4151.21Smycroft		gcc incorrectly gives an "unreachable code at beginning of
4161.21Smycroft		switch statement" for a Duff's device construct in
4171.21Smycroft		arch/pc532/dev/ncr.c.  There is no way to disable just this
4181.21Smycroft		warning, so -Wno-error is turned on for this file.
4191.21Smycroft	kcah
4201.21Smycroft
4211.26Ssimonb	hack	gcc332-cppmacro-ice
4221.26Ssimonb	cdate	Sun Dec  7 12:48:33 UTC 2003
4231.26Ssimonb	who	simonb
4241.26Ssimonb	file	gnu/usr.bin/gcc3/libcpp/Makefile : 1.2
4251.26Ssimonb	descr
4261.26Ssimonb		gcc 3.3.2 gets an ICE when compiling cppmacro.c with -O2.
4271.26Ssimonb		The hack is to use -O1 for this file.  Fixed in gcc
4281.26Ssimonb		-current mainline, unable to work out where the fix is
4291.26Ssimonb		right now.
4301.26Ssimonb	kcah
4311.26Ssimonb
4321.21Smycroft
4331.21Smycroftport	sh3
4341.21Smycroft
4351.21Smycroft	hack	gcc-sh3-sed
4361.21Smycroft	mdate	23 Apr 2002
4371.21Smycroft	who	thorpej
4381.21Smycroft	file	usr.bin/sed/Makefile	: 1.9 : 9 : 13
4391.21Smycroft	descr
4401.21Smycroft		The in-tree GCC 2.95.3-based compiler ICEs when building
4411.26Ssimonb		with optimization for SuperH.  Hack is to build with -O0.
4421.21Smycroft	kcah
4431.21Smycroft
4441.21Smycroft
4451.21Smycroftport	sh5
4461.21Smycroft
4471.21Smycroft	hack	SuperH SH5 Toolchain Bugs
4481.21Smycroft	cdate	11 Jul 2002
4491.21Smycroft	who	scw
4501.21Smycroft	file	usr.sbin/ndbootd/ndbootd.c : 1.6
4511.21Smycroft	file	usr.sbin/traceroute/traceroute.c : 1.48
4521.21Smycroft	descr
4531.21Smycroft		The SuperH SH5 toolchain (2.97-sh5-010522) gets an internal
4541.21Smycroft		compiler error when assigning a bit-wise inverted value
4551.21Smycroft		under some circumstances.
4561.21Smycroft		Work around it by splitting the statement into two.
4571.21Smycroft	kcah
4581.21Smycroft
4591.21Smycroft	hack	SuperH SH5 Toolchain Bugs
4601.21Smycroft	cdate	17 May 2003
4611.21Smycroft	who	scw
4621.21Smycroft	file	lib/libpthread/pthread_lock.c : 1.7
4631.21Smycroft	descr
4641.21Smycroft		The SuperH SH5 toolchain generates incorrect PIC code when
4651.21Smycroft		faced with a symbol which is declared extern, but has local
4661.21Smycroft		scope due to being defined within an asm() statement (without
4671.21Smycroft		being declared .globl in that statement). Work around it by
4681.21Smycroft		adding the .globl.
4691.27Sscw	kcah
4701.27Sscw
4711.27Sscw	hack	gcc 3.3.2 on sh5 - ICE compiling reload1.c at -O2
4721.27Sscw	cdate	Sun Dec  7 19:44:05 GMT 2003
4731.27Sscw	who	scw
4741.27Sscw	file	gnu/usr.bin/gcc3/backend/Makefile : 1.13
4751.27Sscw	descr
4761.27Sscw		Gcc3 for sh5 gets an ICE compiling reload1.c at -O2.
4771.27Sscw		Drop to -O1 for now when building for sh5.
4781.27Sscw	kcah
4791.28Sscw
4801.28Sscw	hack	gcc 3.3.2 on sh5 - ICE compiling elf32.c/elf64.c at -O2
4811.28Sscw	cdate	Sun Dec  7 21:10:46 GMT 2003
4821.28Sscw	who	scw
4831.28Sscw	file	gnu/lib/libbfd/Makefile : 1.39
4841.28Sscw	descr
4851.28Sscw		Gcc3 for sh5 gets an ICE compiling libbfd's elf32.c
4861.28Sscw		and elf64.c at -O2.
4871.28Sscw		Drop to -O1 for now when building for sh5.
4881.28Sscw	kcah
4891.28Sscw
4901.27Sscw
4911.27Sscw	hack	gcc 3.3.2 on sh5 - fatal warning compiling function.c
4921.27Sscw	cdate	Sun Dec  7 19:44:05 GMT 2003
4931.27Sscw	who	scw
4941.27Sscw	file	gnu/usr.bin/gcc3/backend/Makefile : 1.13
4951.27Sscw	descr
4961.27Sscw		Gcc3 for sh5 issues a warning:
4971.27Sscw		.../gnu/dist/gcc/gcc/function.c:4742: warning: `and' of
4981.27Sscw		    mutually exclusive equal-tests is always 0.
4991.27Sscw		This causes the build to fail because of -Werror.
5001.27Sscw		Work-around by defining NOGCCERROR when building for sh5.
5011.27Sscw	kcah
5021.27Sscw
5031.40She	hack	gcc 3.3.3 on sh5 - ICE compiling rbtdb.c and rbtdb64.c
5041.40She	cdate	Thu Nov 11 00:35:33 UTC 2004
5051.40She	who	he
5061.40She	file	usr.sbin/bind/libdns/Makefile/1.2
5071.27Sscw	descr
5081.40She		Gcc3 for sh5 gets an ICE compiling these files at -O2.
5091.27Sscw		Drop to -O1 for now when building for sh5.
5101.21Smycroft	kcah
5111.17Smrg
5121.48She	hack	gcc 3.3.3 nb3 on sh5 - ICE compiling bsd-comp.c
5131.48She	cdate	Thu May 25 23:05:20 UTC 2005
5141.48She	who	he
5151.48She	file	sys/lkm/net/bsdcomp/Makefile : 1.3
5161.48She	descr
5171.48She		Gcc3 for sh5 gets an ICE compiling this at -O2,
5181.48She		"could not split insn".  Drop to -O1 for sh5.
5191.48She	kcah
5201.17Smrg
5211.53Sscw	hack	gcc 3.3.3 nb3 on sh5 - ICE compiling strtod.c
5221.53Sscw	cdate	Tue Jan 31 10:51:52 GMT 2006
5231.53Sscw	who	scw
5241.53Sscw	file	lib/libc/gdtoa/Makefile.inc : 1.2
5251.53Sscw	descr
5261.53Sscw		Gcc3 for sh5 gets an ICE compiling this at -O2,
5271.53Sscw		"could not split insn".  Drop to -O1 for sh5.
5281.53Sscw	kcah
5291.53Sscw
5301.17Smrgport	sun2
5311.20Sskrll
5321.21Smycroft	hack	gcc 3.3.2/mdsetimage
5331.21Smycroft	cdate	Tue Oct 28 18:43:05 EST 2003
5341.21Smycroft	who	fredette
5351.21Smycroft	file	gnu/usr.sbin/mdsetimage/Makefile : 1.15
5361.21Smycroft	descr
5371.21Smycroft		mdsetimage.c causes cc1 to barf for as-yet unknown reasons.
5381.26Ssimonb		this hack uses -O0 to avoid the problem.
5391.21Smycroft	kcah
5401.21Smycroft
5411.21Smycroft	hack	gcc 3.3.2/installboot/ffs.c
5421.21Smycroft	cdate	Tue Oct 28 18:43:05 EST 2003
5431.21Smycroft	who	fredette
5441.21Smycroft	file	usr.sbin/installboot/Makefile : 1.26
5451.21Smycroft	descr
5461.21Smycroft		ffs.c causes cc1 to barf for as-yet unknown reasons.  this
5471.26Ssimonb		hack uses -O0 to avoid the problem.
5481.22Smrg	kcah
5491.22Smrg
5501.22Smrg
5511.56Stsutsuiport	m68000
5521.22Smrg
5531.22Smrg	hack	gcc 3.3.2/gcc/ra-colorize.c
5541.22Smrg	cdate	Wed Nov  5 11:03:13 EST 2003
5551.22Smrg	who	mrg
5561.46Schs	file	gnu/usr.bin/gcc3/backend/Makefile : 1.11
5571.22Smrg	descr
5581.22Smrg		ra-colorize.c causes a whole spew of unreferenced .L* local
5591.22Smrg		symbols.  using -O0 (or even -O2 reportedly) avoids the problem.
5601.56Stsutsui		Note this has been fixed in 3.3.3 at least on m68k,
5611.56Stsutsui		but it hasn't been confirmed on sun2/m68000.
5621.56Stsutsui		(it's too slow even on emulator and unlikely to build
5631.56Stsutsui		 toolchains on sun2 with its maximum 4MB RAM)
5641.21Smycroft	kcah
5651.31Smartin
5661.31Smartinport	sparc64
5671.31Smartin
5681.31Smartin	hack	disable optimzations for uvm_bio.c on 32 bit kernels
5691.31Smartin	cdate	Sun Mar 21 14:14:04 MET 2004
5701.31Smartin	who	martin
5711.32Smartin	file	sys/arch/sparc64/conf/Makefile.sparc64 : 1.53-1.54
5721.32Smartin	file	sys/arch/sparc64/conf/files.sparc64 : 1.93
5731.31Smartin	descr
5741.31Smartin		The sparc compiler miscompiles uvm_bio.c when using
5751.31Smartin		any optimization. This results in ubc_release panics.
5761.31Smartin	kcah
5771.42Schristos
5781.42Schristosport	macppc
5791.42Schristos
5801.42Schristos	hack	remove inline from rotate_{left,right}
5811.42Schristos	cdate	Tue Feb 22 13:43:25 EST 2005
5821.42Schristos	who	christos
5831.42Schristos	file	src/dist/bind/lib/dns/rbt.c
5841.42Schristos	descr
5851.42Schristos		The macppc gcc-3.3 compiler miscompiles rbt.c when these
5861.42Schristos		functions are inlined. The error is:
5871.42Schristos		.* named[368]: rbt.c:1584: INSIST(child != (void *)0) >failed
5881.42Schristos		.* named[368]: exiting (due to assertion failure)
5891.42Schristos		This is reportedly fixed in gcc-3.4
5901.42Schristos	kcah
5911.46Schs
5921.46Schsport	hppa
5931.46Schs
5941.46Schs	hack	hppa-gcc-3.3.3/grep/dfa.c
5951.46Schs	cdate	Sun Aug  8 08:34:32 PDT 2004
5961.46Schs	who	chs
5971.46Schs	file	gnu/usr.bin/grep/grep/Makefile : 1.4
5981.46Schs	descr
5991.46Schs		gcc 3.3.3 generates bad code for dfa.c with -O2,
6001.46Schs		reduce optimization to -O1 to avoid the bug.
6011.46Schs	kcah
6021.47Schs
6031.55She	hack	hppa-gcc-3.3.3 / make/buf.c
6041.55She	cdate	Mon May  8 13:02:36 CEST 2006
6051.55She	who	he
6061.55She	file	usr.bin/make/Makefile : 1.34
6071.55She	descr
6081.55She		gcc 3.3.3 nb3 gets an "unrecognized insn" internal
6091.55She		compiler error when building this file with -O2,
6101.55She		reduce optimization to -O1 to avoid the bug.
6111.55She	kcah
6121.55She
6131.47Schs	hack	hppa boot-from-disk memory corruption
6141.47Schs	cdate	Wed May 18 06:56:07 PDT 2005
6151.47Schs	who	chs
6161.47Schs	file	src/sys/dev/scsipi/scsipiconf.h : 1.98
6171.47Schs	descr
6181.47Schs		There is some bug with DMA on hppa that corrupts scsipi_xfer
6191.47Schs		structures, but it only shows up when booting from disk.
6201.47Schs		For now, we'll add some padding to scsipi_xfer so that
6211.47Schs		the corrupted memory is not otherwise used.
6221.47Schs	kcah
6231.51Ssimonb
6241.51Ssimonbport	mips
6251.51Ssimonb
6261.51Ssimonb	hack	mips-shared-linker-load-address
6271.51Ssimonb	cdate	Fri Oct  7 08:33:10 UTC 2005
6281.51Ssimonb	who	simonb
6291.51Ssimonb	file	src/sys/kern/exec_elf32.c : 1.107
6301.51Ssimonb	descr
6311.51Ssimonb		With COMPAT_16 or previous enabled (which enables
6321.51Ssimonb		ELF_INTERP_NON_RELOCATABLE) a recent ld.elf_so will
6331.51Ssimonb		load and run at address 0.  The check to fix this in
6341.51Ssimonb		rev 1.107 only checks the first psection of the ELF
6351.51Ssimonb		executable, which may not be loadable.  A more correct
6361.51Ssimonb		fix is to check the first loadable psection instead of
6371.51Ssimonb		just the first psection.
6381.51Ssimonb	kcah
6391.54She
640