HACKS revision 1.79
11.79Smrg# $NetBSD: HACKS,v 1.79 2006/06/24 05:21:11 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.62Shehack	gcc 3.3.3 wrong uninitialised variable
1141.62Shemdate	12 May 2006
1151.62Shewho	he
1161.62Shefile	usr.bin/msgc/msg_sys.def : 1.33-1.34
1171.63Shefile	distrib/utils/sysinst/aout2elf.c : 1.11
1181.62Shedescr
1191.62She	Gcc 3.3.3 gets some -Wuninitialized warnings wrong.  This is
1201.62She	just one of many in the tree, marked with
1211.62She	/* XXX -Wuninitialized [arch] */
1221.62She	in the source.
1231.62Shekcah
1241.62She
1251.58Smrghack	gcc4 wrong uninitialised variable
1261.58Smrgmdate	10 May 2006
1271.58Smrgwho	mrg
1281.58Smrgfile	bin/ksh/eval.c			: 1.6
1291.58Smrgfile	bin/sh/histedit.c		: 1.39
1301.58Smrgfile	bin/sh/parser.c			: 1.60
1311.58Smrgfile	bin/systrace/systrace.c		: 1.33
1321.58Smrgfile	crypto/dist/heimdal/kdc/524.c	: 1.10
1331.58Smrgfile	crypto/dist/ssh/sftp.c		: 1.20
1341.58Smrgfile	crypto/dist/ssh/ssh-keysign.c	: 1.11
1351.58Smrgfile	dist/ipf/lib/hostname.c		: 1.2
1361.58Smrgfile	dist/ipf/tools/ipmon.c		: 1.8
1371.72Smrgfile	dist/ntp/ntpd/ntp_request.c	: 1.4
1381.58Smrgfile	dist/ntp/ntpd/refclock_shm.c	: 1.4
1391.58Smrgfile	dist/ntp/sntp/timing.c		: 1.3
1401.58Smrgfile	dist/pppd/pppstats/pppstats.c	: 1.3
1411.58Smrgfile	dist/smbfs/lib/smb/rap.c	: 1.6
1421.58Smrgfile	dist/tcpdump/print-zephyr.c	: 1.5
1431.68Smrgfile	distrib/utils/sysinst/aout2elf.c : 1.12
1441.58Smrgfile	gnu/libexec/uucp/uucico/uucico.c : 1.6
1451.58Smrgfile	lib/libc/citrus/citrus_csmapper.c : 1.6
1461.58Smrgfile	lib/libc/citrus/citrus_pivot_factory.c : 1.5
1471.58Smrgfile	lib/libc/inet/inet_cidr_ntop.c	: 1.3
1481.58Smrgfile	lib/libc/inet/inet_ntop.c	: 1.3
1491.58Smrgfile	lib/libc/stdio/vfwprintf.c	: 1.8
1501.69Smrgfile	libexec/ld.elf_so/arch/m68k/mdreloc.c : 1.20
1511.76Smrgfile	libexec/ld.elf_so/arch/powerpc/ppc_reloc.c : 1.40
1521.74Smrgfile	libexec/ld.elf_so/arch/sh3/mdreloc.c : 1.22
1531.69Smrgfile	libexec/ld.elf_so/arch/sparc/mdreloc.c : 1.39
1541.58Smrgfile	libexec/ld.elf_so/arch/sparc64/mdreloc.c : 1.39
1551.74Smrgfile	libexec/ld.elf_so/arch/vax/mdreloc.c	: 1.21
1561.71Sdanfile	libexec/ld.elf_so/arch/x86_64/mdreloc.c	: 1.27
1571.58Smrgfile	sbin/fsck_ext2fs/dir.c		: 1.19
1581.58Smrgfile	sbin/routed/rtquery/rtquery.c	: 1.18
1591.73Sdanfile	sys/arch/amd64/amd64/pmap.c	: 1.26
1601.79Smrgfile	sys/arch/i386/pci/piixpcib.c	: 1.4
1611.58Smrgfile	sys/crypto/cast128/cast128.c	: 1.9
1621.58Smrgfile	sys/ddb/db_command.c		: 1.86
1631.68Smrgfile	sys/dev/cardbus/cardbus_map.c	: 1.21
1641.58Smrgfile	sys/dev/fss.c			: 1.25
1651.69Smrgfile	sys/dev/ic/igsfb.c		: 1.39
1661.68Smrgfile	sys/dev/ic/mb86950.c		: 1.5
1671.58Smrgfile	sys/dev/ic/midway.c		: 1.71
1681.68Smrgfile	sys/dev/kttcp.c			: 1.18
1691.68Smrgfile	sys/dev/rasops/rasops_bitops.h	: 1.9
1701.68Smrgfile	sys/dev/pci/cmpci.c		: 1.31
1711.58Smrgfile	sys/dev/pci/machfb.c		: 1.45
1721.68Smrgfile	sys/dev/usb/ohci.c		: 1.174
1731.68Smrgfile	sys/dev/usb/uhci.c		: 1.196
1741.68Smrgfile	sys/dev/rasops/rasops_bitops.h	: 1.9
1751.58Smrgfile	sys/dist/ipf/netinet/ip_nat.c	: 1.10
1761.58Smrgfile	sys/dist/ipf/netinet/ip_rpcb_pxy.c : 1.8
1771.58Smrgfile	sys/dist/pf/net/pf.c		: 1.22
1781.59Smrgfile	sys/fs/udf/udf_vnops.c		: 1.4
1791.58Smrgfile	sys/kern/kern_sig.c		: 1.219
1801.58Smrgfile	sys/kern/tty.c			: 1.181
1811.58Smrgfile	sys/net/bpf.c			: 1.116
1821.58Smrgfile	sys/net/zlib.c			: 1.26
1831.68Smrgfile	sys/netccitt/if_x25subr.c	: 1.37
1841.58Smrgfile	sys/netinet/in.c		: 1.107
1851.58Smrgfile	sys/netsmb/smb_smb.c		: 1.27
1861.58Smrgfile	sys/netsmb/smb_trantcp.c	: 1.22
1871.58Smrgfile	sys/nfs/nfs_serv.c		: 1.108
1881.58Smrgfile	sys/nfs/nfs_socket.c		: 1.129
1891.58Smrgfile	sys/nfs/nfs_syscalls.c		: 1.91
1901.58Smrgfile	sys/ufs/lfs/lfs_vfsops.c	: 1.207 [also (char *)]
1911.58Smrgfile	usr.bin/ftp/ftp.c		: 1.140
1921.58Smrgfile	usr.bin/find/function.c		: 1.54
1931.58Smrgfile	usr.bin/mail/tty.c		: 1.20
1941.58Smrgfile	usr.bin/nl/nl.c			: 1.7
1951.58Smrgfile	usr.bin/systat/keyboard.c	: 1.23
1961.58Smrgfile	usr.bin/usbhidctl/usbhid.c	: 1.29
1971.58Smrgfile	usr.bin/vi/cl/cl_read.c		: 1.5
1981.58Smrgfile	usr.bin/vi/ex/ex_cscope.c	: 1.12
1991.58Smrgfile	usr.bin/vi/ex/ex_tag.c		: 1.19
2001.58Smrgfile	usr.bin/vi/vi/v_txt.c		: 1.15
2011.58Smrgfile	usr.sbin/altq/altqstat/qdisc_rio.c : 1.4
2021.58Smrgfile	usr.sbin/cron/do_command.c	: 1.19
2031.58Smrgfile	usr.sbin/timed/timed/slave.c	: 1.15
2041.58Smrgdescr
2051.58Smrg	GCC 4.1 gets many uninitialised variable warnings wrong.  We should
2061.58Smrg	really audit all the old hacks like this when older compilers are
2071.58Smrg	removed from the tree, as many are probably no longer required.
2081.65Schristos	The problem is that it does not recognize initialization via function
2091.65Schristos	call pointer. I.e.
2101.65Schristos		int p;
2111.65Schristos		foo(&p);
2121.65Schristos	does not mark p as initialized.
2131.58Smrgkcah
2141.58Smrg
2151.59Smrghack	gcc4 pointer sign and strict aliasing problems
2161.59Smrgmdate	10 May 2006
2171.59Smrgwho	mrg
2181.59Smrgfile	bin/ed/Makefile			: 1.33
2191.60Smrgfile	bin/systrace/Makefile		: 1.12
2201.68Smrgfile	distrib/utils/sysinst/Makefile.inc : 1.44
2211.60Smrgfile	games/bcd/Makefile		: 1.5
2221.60Smrgfile	games/dab/Makefile		: 1.5
2231.60Smrgfile	games/larn/Makefile		: 1.17
2241.60Smrgfile	games/pom/Makefile		: 1.5
2251.60Smrgfile	lib/libasn1/Makefile		: 1.26
2261.60Smrgfile	lib/libcrypt/Makefile		: 1.17
2271.60Smrgfile	lib/libgssapi/Makefile		: 1.16
2281.60Smrgfile	lib/libhdb/Makefile		: 1.20
2291.60Smrgfile	lib/libkadm5clnt/Makefile	: 1.21
2301.60Smrgfile	lib/libkadm5srv/Makefile	: 1.25
2311.60Smrgfile	lib/libkrb5/Makefile		: 1.35
2321.60Smrgfile	lib/libssh/Makefile		: 1.6
2331.60Smrgfile	lib/libtelnet/Makefile		: 1.26
2341.60Smrgfile	libexec/getty/Makefile		: 1.14
2351.60Smrgfile	libexec/kadmind/Makefile	: 1.19
2361.60Smrgfile	libexec/kpasswdd/Makefile	: 1.14
2371.60Smrgfile	sbin/atactl/Makefile		: 1.3
2381.60Smrgfile	sbin/cgdconfig/Makefile		: 1.7
2391.60Smrgfile	sbin/clri/Makefile		: 1.13
2401.60Smrgfile	sbin/dkctl/Makefile		: 1.4
2411.60Smrgfile	sbin/dump/Makefile		: 1.33
2421.60Smrgfile	sbin/fdisk/Makefile		: 1.35
2431.60Smrgfile	sbin/fsck_ext2fs/Makefile	: 1.11
2441.60Smrgfile	sbin/fsck_ffs/Makefile		: 1.29
2451.60Smrgfile	sbin/fsdb/Makefile		: 1.18
2461.60Smrgfile	sbin/mount_smbfs/Makefile	: 1.4
2471.60Smrgfile	sbin/newfs/Makefile		: 1.30
2481.60Smrgfile	sbin/newfs_sysvbfs/Makefile	: 1.2
2491.60Smrgfile	sbin/restore/Makefile		: 1.23
2501.60Smrgfile	sbin/veriexecctl/Makefile	: 1.11
2511.64Smrgfile	sys/lib/libsa/Makefile		: 1.59
2521.68Smrgfile	sys/arch/evbarm/adi_brh/brh_machdep.c : 1.24
2531.59Smrgfile	usr.bin/awk/Makefile		: 1.9
2541.64Smrgfile	usr.bin/crontab/Makefile	: 1.24
2551.60Smrgfile	usr.bin/ctags/Makefile		: 1.8
2561.61Smrgfile	usr.bin/gzip/Makefile		: 1.10
2571.60Smrgfile	usr.bin/ssh/sftp/Makefile	: 1.10
2581.60Smrgfile	usr.bin/ssh/ssh/Makefile	: 1.25
2591.59Smrgfile	usr.bin/vi/build/Makefile	: 1.26
2601.60Smrgfile	usr.bin/telnet/Makefile		: 1.40
2611.60Smrgfile	usr.bin/tn3270/tn3270/Makefile	: 1.36
2621.60Smrgfile	usr.bin/tr/Makefile		: 1.4
2631.59Smrgfile	usr.sbin/amd/amd/Makefile	: 1.27
2641.59Smrgfile	usr.sbin/amd/amq/Makefile	: 1.14
2651.59Smrgfile	usr.sbin/amd/libamu/Makefile	: 1.20
2661.59Smrgfile	usr.sbin/amd/pawd/Makefile	: 1.5
2671.59Smrgfile	usr.sbin/bind/Makefile.inc	: 1.22
2681.60Smrgfile	usr.sbin/bind/libdns/Makefile	: 1.3
2691.60Smrgfile	usr.sbin/bind/named/Makefile	: 1.17
2701.60Smrgfile	usr.sbin/bootp/bootptest/Makefile : 1.2
2711.60Smrgfile	usr.sbin/chrtbl/Makefile	: 1.6
2721.60Smrgfile	usr.sbin/cron/Makefile		: 1.12
2731.59Smrgfile	usr.sbin/dhcp/Makefile.inc	: 1.20
2741.59Smrgfile	usr.sbin/dumplfs/Makefile	: 1.11
2751.60Smrgfile	usr.sbin/hprop/Makefile		: 1.13
2761.60Smrgfile	usr.sbin/installboot/Makefile	: 1.35
2771.59Smrgfile	usr.sbin/ipf/ipftest/Makefile	: 1.32
2781.59Smrgfile	usr.sbin/isdn/isdnd/Makefile	: 1.6
2791.59Smrgfile	usr.sbin/isdn/isdnmonitor/Makefile : 1.3
2801.59Smrgfile	usr.sbin/isdn/isdntel/Makefile	: 1.2
2811.59Smrgfile	usr.sbin/isdn/isdntrace/Makefile : 126
2821.61Smrgfile	usr.sbin/mopd/common/Makefile	: 1.10
2831.61Smrgfile	usr.sbin/mopd/mopd/Makefile	: 1.9
2841.61Smrgfile	usr.sbin/mopd/mopprobe/Makefile	: 1.7
2851.60Smrgfile	usr.sbin/makefs/Makefile	: 1.17
2861.60Smrgfile	usr.sbin/mscdlabel/Makefile	: 1.5
2871.60Smrgfile	usr.sbin/pkg_install/add/Makefile : 1.7
2881.60Smrgfile	usr.sbin/pkg_install/create/Makefile : 1.5
2891.60Smrgfile	usr.sbin/pkg_install/lib/Makefile : 1.28
2901.59Smrgfile	usr.sbin/ntp/ntpd/Makefile	: 1.10/1.11
2911.59Smrgfile	usr.sbin/ntp/ntptime/Makefile	: 1.4/1.5
2921.59Smrgfile	usr.sbin/pppd/Makefile.inc	: 1.3
2931.59Smrgfile	usr.sbin/pppd/pppd/Makefile	: 1.38
2941.60Smrgfile	usr.sbin/rarpd/Makefile		: 1.10
2951.59Smrgfile	usr.sbin/rbootd/Makefile	: 1.10
2961.60Smrgfile	usr.sbin/rpc.pcnfsd/Makefile	: 1.17
2971.59Smrgfile	usr.sbin/rtadvd/Makefile	: 1.9
2981.60Smrgfile	usr.sbin/tcpdump/Makefile	: 1.42
2991.59Smrgfile	usr.sbin/wiconfig/Makefile	: 1.3
3001.59Smrgdescr
3011.59Smrg	GCC 4.1 warns on pointer sign comparision/assignments and lots of
3021.59Smrg	code does not conform.  For now we use -Wno-pointer-sign and
3031.59Smrg	-fno-strict-aliasing.
3041.59Smrgkcah
3051.59Smrg
3061.21Smycroftport	vax
3071.21Smycroft
3081.52Sjmc	hack	gcc 2.95/vax doesn't like abort being used as function pointer
3091.52Sjmc	cdate	Tue Dec 13 05:54:50 GMT 2005
3101.52Sjmc	who	jmc
3111.52Sjmc	file	lib/libc/rpc/svc_vc.c 1.15
3121.52Sjmc	descr
3131.52Sjmc		Provide a local definition for abort which doesn't include
3141.52Sjmc		the noreturn attribute which trips up gcc 2.95 on vax.
3151.52Sjmc	
3161.45Sjmc	hack	gcc 2.95/vax doesn't have stdbool.h and gettext needs it
3171.45Sjmc	cdate	Mon May  9 12:16:22 CDT 2005
3181.45Sjmc	who	jmc
3191.45Sjmc	file	gnu/usr.bin/gettext/Makefile.inc.prog 1.5
3201.45Sjmc		gnu/usr.bin/gettext/libgrep/Makefile 1.3
3211.45Sjmc		gnu/usr.bin/gettext/libnlspr/Makefile 1.5
3221.45Sjmc		gnu/usr.bin/gettext/libnlsut/Makefile 1.3   
3231.45Sjmc	descr
3241.45Sjmc		The latest gettext assumes a C99 environment or at least
3251.45Sjmc		configure checks to work around this. As we don't use configure
3261.45Sjmc		provide a stdbool.h for vax builds locally in directories from
3271.45Sjmc		the template provided by the gettext code.
3281.45Sjmc	
3291.75Schristos	hack	gcc 2.95/vax can't handle __used__
3301.44Sjmc	cdate	Fri May  6 14:30:53 CDT 2005
3311.44Sjmc	who	jmc
3321.44Sjmc	file	src/lib/libc/gmon/mcount.c 1.17
3331.75Schristos		src/usr.bin/config/main.c 1.11
3341.44Sjmc	descr
3351.44Sjmc                Recent changes to mark this as __used__ to prevent optimization
3361.44Sjmc                away on sparc64 don't work on 2.95 vax. Ifdef'd back in the
3371.44Sjmc                old __unused__ if on vax.
3381.44Sjmc	
3391.21Smycroft	hack	gcc 2.95/vax cannot handle __builtin_ffs()
3401.21Smycroft	cdate	Fri Aug 23 21:31:15 CEST 2002
3411.21Smycroft	who	ragge
3421.21Smycroft	file	sys/lib/libkern/libkern.h : 1.42
3431.21Smycroft	descr
3441.21Smycroft		__builtin_ffs() is ifdef'd away if __vax__. Matt Thomas has
3451.21Smycroft		added this feature to GCC 3 so it can be removed when switching.
3461.44Sjmc	
3471.21Smycroft
3481.21Smycroft	hack	gcc-vax-libbz2
3491.21Smycroft	mdate	27 Jun 2002
3501.21Smycroft	who	thorpej
3511.21Smycroft	file	lib/libbz2/Makefile
3521.21Smycroft	descr
3531.21Smycroft		libbz2 is mis-compiled with optimization with GCC 2.95.3
3541.24Sragge		on VAX.  -O0 works around this problem.
3551.24Sragge	kcah
3561.24Sragge
3571.24Sragge	hack	gawk
3581.24Sragge	mdate	8 Nov 2003
3591.24Sragge	who	ragge
3601.24Sragge	file	gnu/usr.bin/gawk/Makefile
3611.24Sragge	descr
3621.24Sragge		gawk is mis-compiled with optimization with GCC 2.95.3
3631.21Smycroft		on VAX.  -O0 works around this problem.
3641.21Smycroft	kcah
3651.21Smycroft
3661.21Smycroft	hack	vax Toolchain bug
3671.21Smycroft	cdate	28 Mar 2003
3681.21Smycroft	who	he
3691.21Smycroft	file	sys/arch/vax/vax/intvec.S : 1.5
3701.21Smycroft	descr
3711.21Smycroft		Workaround for PR toolchain/20924.  The assembler apparently
3721.21Smycroft		tries to range-check byte offsets when it doesn't have
3731.21Smycroft		sufficient information to make that decision.
3741.21Smycroft		Workaround uses `brw' instead of `brb' instruction.
3751.23She	kcah
3761.23She
3771.23She	hack	vax gcc 2.95.3 -Wuninitialized workarounds
3781.23She	cdate	6 Nov 2003
3791.23She	who	he
3801.23She	file	sys/dev/bi/if_ni.c : 1.22
3811.23She	file	sys/arch/vax/vax/ctu.c : 1.20
3821.23She	descr
3831.23She		Workaround for gcc 2.95.3 failing to detect that certain
3841.23She		variables will be initialized; so that this code compiles
3851.23She		with -Wuninitialized.  Should be reviewed and possibly
3861.23She		reverted when gcc 3.3.2 is ready for vax.
3871.21Smycroft	kcah
3881.21Smycroft
3891.34Scl	hack	vax gcc 2.95.3 structure initialization
3901.34Scl	cdat	13 May 2004
3911.34Scl	who	cl
3921.34Scl	file	sys/miscfs/kernfs/kernfs_vnops.c : 1.104
3931.34Scl	descr
3941.34Scl		Workaround for gcc 2.95.3 failing to initialize structures
3951.34Scl		and/or unions inside structures using nested designators.
3961.34Scl		Should be reverted when gcc >=3.3.3 is ready for vax.
3971.34Scl	kcah
3981.21Smycroft
3991.35She	hack	vax gcc 2.95.3 needs -I. to build nslexer.c
4001.35She	cdat	6 Jun 2004
4011.36She	who	mhitch
4021.36She	file	lib/libc/arch/vax/Makefile.inc : 1.6
4031.35She	descr
4041.35She		It appears necessary to add -I. to CPPFLAGS when building
4051.35She		nslesxer.c.  This may be caused by gcc 2.95.3 being used.
4061.35She		Should be reverted when a newer gcc is ready for vax.
4071.35She	kcah
4081.35She
4091.43Stron	hack	vax gcc 2.95.3 doesn't understand "-std=c99"
4101.43Stron	cdat	5 April 2005
4111.43Stron	who	tron
4121.43Stron	file	src/share/mk/bsd.sys.mk
4131.43Stron	descr
4141.43Stron		We cannot use "-std=c99" for compiler warning level 4 and above
4151.43Stron		because gcc 2.95.3 doesn't support that option.
4161.43Stron	kcah
4171.43Stron
4181.54She	hack	declare boolean_t in two IPF user-mode programs
4191.54She	cdate	Tue Mar  7 19:19:20 CET 2006
4201.54She	who	he
4211.54She	file	dist/ipf/ipsend/iptests.c : 1.8
4221.54She		dist/ipf/ipsend/sock.c : 1.7
4231.54She	descr
4241.54She		The IPF user-mode programs ipsend and iptest first
4251.54She		include <sys/types.h> without _KERNEL defined, and
4261.54She		later include <sys/file.h> with _KERNEL defined.
4271.54She		This causes a build failure when building for vax,
4281.54She		since <sys/device.h> ends up being included without
4291.54She		bollean_t being defined by <sys/types.h>.
4301.54She		Build failure and further details documented in
4311.54She		PR#32907.
4321.54She	kcah
4331.54She
4341.21Smycroftport	sparc64
4351.21Smycroft
4361.21Smycroft	hack	binutil-2.11-sparc64-pltrela
4371.21Smycroft	mdate	14 Aug 2001
4381.21Smycroft	who	eeh
4391.21Smycroft	file	libexec/ld.elf_so/arch/sparc64/mdreloc.c
4401.21Smycroft	descr
4411.39Sskrll		The first four PLT entries are reserved.  There is some
4421.21Smycroft		disagreement whether they should have associated relocation
4431.21Smycroft		entries.  Both the SPARC 32-bit and 64-bit ELF specifications
4441.21Smycroft		say that they should have relocation entries, but the 32-bit
4451.21Smycroft		SPARC binutils do not generate them, and now the 64-bit SPARC
4461.21Smycroft		binutils have stopped generating them too.
4471.21Smycroft
4481.21Smycroft		To provide binary compatibility, we will check the first entry,
4491.21Smycroft		if it is reserved it should not be of the type JMP_SLOT.  If it
4501.21Smycroft		is JMP_SLOT, then the 4 reserved entries were not generated and
4511.21Smycroft		our index is 4 entries too far, so we frob the rela pointer.
4521.21Smycroft	kcah
4531.21Smycroft
4541.21Smycroft
4551.21Smycroftport	arm
4561.21Smycroft
4571.21Smycroft	hack	gcc-unsigned-compare
4581.21Smycroft	cdate	09 Mar 2002
4591.21Smycroft	mdate	18 Mar 2002
4601.21Smycroft	who	bjh21
4611.21Smycroft	file	dist/bind/lib/nameser/ns_parse.c : 1.3
4621.21Smycroft	file	dist/dhcp/minires/ns_parse.c : 1.3
4631.21Smycroft	file	dist/dhcp/omapip/result.c : 1.2
4641.21Smycroft	file	dist/dhcp/server/failover.c : 1.3
4651.21Smycroft	file	gnu/dist/gawk/eval.c : 1.4
4661.21Smycroft	file	gnu/dist/toolchain/bfd/bfd.c : 1.2
4671.21Smycroft	file	gnu/dist/toolchain/bfd/format.c : 1.2
4681.21Smycroft	file	gnu/dist/toolchain/gdb/target.c : 1.2
4691.21Smycroft	file	sys/kern/vfs_subr.c : 1.172
4701.21Smycroft	descr	When checking that a potentially-unsigned enum is >= 0, assign
4711.21Smycroft		it to an int first.  This is necessary to avoid "comparison is
4721.21Smycroft		always true" warnings with -fshort-enums.  Casting to an int
4731.21Smycroft		really should be enough, but turns out not to be.
4741.21Smycroft	kcah
4751.21Smycroft
4761.21Smycroft	hack	gcc 3.3.2/arm sys/kern/uipc_socket.c
4771.21Smycroft	cdate	Tue Oct 28 18:02:16 GMT 2003
4781.21Smycroft	who	skrll
4791.41Sbjh21	pr	23044
4801.41Sbjh21	file	sys/arch/arm/conf/Makefile.arm : 1.19
4811.21Smycroft	descr
4821.21Smycroft		Performing a build.sh tools on a CATS with NFS mounted 
4831.21Smycroft		obj and src directories results in "panic: receive 1"
4841.21Smycroft		The hack is to compile sys/kern/uipc_socket.c with
4851.21Smycroft		-fno-strict-aliasing
4861.21Smycroft	kcah
4871.21Smycroft
4881.21Smycroft
4891.13Ssimonbport	pc532
4901.16Scl
4911.21Smycroft	hack	egcs-pc532-ip6_mroute
4921.21Smycroft	cdate	09 Jul 2002
4931.21Smycroft	who	simonb
4941.21Smycroft	file	sys/arch/pc532/conf/Makefile.pc532 : 1.70
4951.21Smycroft	file	sys/arch/pc532/conf/files.pc532 : 1.47
4961.21Smycroft	descr
4971.21Smycroft		egcs 1.1.2 gets an "internal error--insn does not satisfy its
4981.21Smycroft		constraints" error compiling ip6_mroute.c with -O2 or greater.
4991.21Smycroft		-O1 works around this problem.
5001.21Smycroft	kcah
5011.21Smycroft
5021.21Smycroft	hack	gcc-pc532-duffs_device
5031.21Smycroft	cdate	Mon Oct 27 07:23:05 UTC 2003
5041.21Smycroft	who	simonb
5051.21Smycroft	file	sys/arch/pc532/conf/Makefile.pc532 : 1.71
5061.21Smycroft	file	sys/arch/pc532/conf/files.pc532 : 1.52
5071.21Smycroft	pr	GCC PR optimization/5230
5081.21Smycroft	descr
5091.21Smycroft		gcc incorrectly gives an "unreachable code at beginning of
5101.21Smycroft		switch statement" for a Duff's device construct in
5111.21Smycroft		arch/pc532/dev/ncr.c.  There is no way to disable just this
5121.21Smycroft		warning, so -Wno-error is turned on for this file.
5131.21Smycroft	kcah
5141.21Smycroft
5151.26Ssimonb	hack	gcc332-cppmacro-ice
5161.26Ssimonb	cdate	Sun Dec  7 12:48:33 UTC 2003
5171.26Ssimonb	who	simonb
5181.26Ssimonb	file	gnu/usr.bin/gcc3/libcpp/Makefile : 1.2
5191.26Ssimonb	descr
5201.26Ssimonb		gcc 3.3.2 gets an ICE when compiling cppmacro.c with -O2.
5211.26Ssimonb		The hack is to use -O1 for this file.  Fixed in gcc
5221.26Ssimonb		-current mainline, unable to work out where the fix is
5231.26Ssimonb		right now.
5241.26Ssimonb	kcah
5251.26Ssimonb
5261.21Smycroft
5271.21Smycroftport	sh3
5281.21Smycroft
5291.74Smrg	hack	gcc4-sh3-bz2
5301.74Smrg	mdate	20 May 2006
5311.74Smrg	who	mrg
5321.74Smrg	file	lib/libbz2/Makefile	: 1.10
5331.74Smrg	descr
5341.74Smrg		The in-tree GCC 4.1-based compiler generated too-far
5351.74Smrg		pc-relative addresses.  Hack is to build with -O0.
5361.74Smrg	kcah
5371.74Smrg
5381.21Smycroft
5391.21Smycroftport	sh5
5401.21Smycroft
5411.21Smycroft	hack	SuperH SH5 Toolchain Bugs
5421.21Smycroft	cdate	11 Jul 2002
5431.21Smycroft	who	scw
5441.21Smycroft	file	usr.sbin/ndbootd/ndbootd.c : 1.6
5451.21Smycroft	file	usr.sbin/traceroute/traceroute.c : 1.48
5461.21Smycroft	descr
5471.21Smycroft		The SuperH SH5 toolchain (2.97-sh5-010522) gets an internal
5481.21Smycroft		compiler error when assigning a bit-wise inverted value
5491.21Smycroft		under some circumstances.
5501.21Smycroft		Work around it by splitting the statement into two.
5511.21Smycroft	kcah
5521.21Smycroft
5531.21Smycroft	hack	SuperH SH5 Toolchain Bugs
5541.21Smycroft	cdate	17 May 2003
5551.21Smycroft	who	scw
5561.21Smycroft	file	lib/libpthread/pthread_lock.c : 1.7
5571.21Smycroft	descr
5581.21Smycroft		The SuperH SH5 toolchain generates incorrect PIC code when
5591.21Smycroft		faced with a symbol which is declared extern, but has local
5601.21Smycroft		scope due to being defined within an asm() statement (without
5611.21Smycroft		being declared .globl in that statement). Work around it by
5621.21Smycroft		adding the .globl.
5631.27Sscw	kcah
5641.27Sscw
5651.27Sscw	hack	gcc 3.3.2 on sh5 - ICE compiling reload1.c at -O2
5661.27Sscw	cdate	Sun Dec  7 19:44:05 GMT 2003
5671.27Sscw	who	scw
5681.27Sscw	file	gnu/usr.bin/gcc3/backend/Makefile : 1.13
5691.27Sscw	descr
5701.27Sscw		Gcc3 for sh5 gets an ICE compiling reload1.c at -O2.
5711.27Sscw		Drop to -O1 for now when building for sh5.
5721.27Sscw	kcah
5731.28Sscw
5741.28Sscw	hack	gcc 3.3.2 on sh5 - ICE compiling elf32.c/elf64.c at -O2
5751.28Sscw	cdate	Sun Dec  7 21:10:46 GMT 2003
5761.28Sscw	who	scw
5771.28Sscw	file	gnu/lib/libbfd/Makefile : 1.39
5781.28Sscw	descr
5791.28Sscw		Gcc3 for sh5 gets an ICE compiling libbfd's elf32.c
5801.28Sscw		and elf64.c at -O2.
5811.28Sscw		Drop to -O1 for now when building for sh5.
5821.28Sscw	kcah
5831.28Sscw
5841.27Sscw
5851.27Sscw	hack	gcc 3.3.2 on sh5 - fatal warning compiling function.c
5861.27Sscw	cdate	Sun Dec  7 19:44:05 GMT 2003
5871.27Sscw	who	scw
5881.27Sscw	file	gnu/usr.bin/gcc3/backend/Makefile : 1.13
5891.27Sscw	descr
5901.27Sscw		Gcc3 for sh5 issues a warning:
5911.27Sscw		.../gnu/dist/gcc/gcc/function.c:4742: warning: `and' of
5921.27Sscw		    mutually exclusive equal-tests is always 0.
5931.27Sscw		This causes the build to fail because of -Werror.
5941.27Sscw		Work-around by defining NOGCCERROR when building for sh5.
5951.27Sscw	kcah
5961.27Sscw
5971.40She	hack	gcc 3.3.3 on sh5 - ICE compiling rbtdb.c and rbtdb64.c
5981.40She	cdate	Thu Nov 11 00:35:33 UTC 2004
5991.40She	who	he
6001.40She	file	usr.sbin/bind/libdns/Makefile/1.2
6011.27Sscw	descr
6021.40She		Gcc3 for sh5 gets an ICE compiling these files at -O2.
6031.27Sscw		Drop to -O1 for now when building for sh5.
6041.21Smycroft	kcah
6051.17Smrg
6061.48She	hack	gcc 3.3.3 nb3 on sh5 - ICE compiling bsd-comp.c
6071.48She	cdate	Thu May 25 23:05:20 UTC 2005
6081.48She	who	he
6091.48She	file	sys/lkm/net/bsdcomp/Makefile : 1.3
6101.48She	descr
6111.48She		Gcc3 for sh5 gets an ICE compiling this at -O2,
6121.48She		"could not split insn".  Drop to -O1 for sh5.
6131.48She	kcah
6141.17Smrg
6151.53Sscw	hack	gcc 3.3.3 nb3 on sh5 - ICE compiling strtod.c
6161.53Sscw	cdate	Tue Jan 31 10:51:52 GMT 2006
6171.53Sscw	who	scw
6181.53Sscw	file	lib/libc/gdtoa/Makefile.inc : 1.2
6191.53Sscw	descr
6201.53Sscw		Gcc3 for sh5 gets an ICE compiling this at -O2,
6211.53Sscw		"could not split insn".  Drop to -O1 for sh5.
6221.53Sscw	kcah
6231.53Sscw
6241.17Smrgport	sun2
6251.20Sskrll
6261.21Smycroft	hack	gcc 3.3.2/mdsetimage
6271.21Smycroft	cdate	Tue Oct 28 18:43:05 EST 2003
6281.21Smycroft	who	fredette
6291.21Smycroft	file	gnu/usr.sbin/mdsetimage/Makefile : 1.15
6301.21Smycroft	descr
6311.21Smycroft		mdsetimage.c causes cc1 to barf for as-yet unknown reasons.
6321.26Ssimonb		this hack uses -O0 to avoid the problem.
6331.21Smycroft	kcah
6341.21Smycroft
6351.21Smycroft	hack	gcc 3.3.2/installboot/ffs.c
6361.21Smycroft	cdate	Tue Oct 28 18:43:05 EST 2003
6371.21Smycroft	who	fredette
6381.21Smycroft	file	usr.sbin/installboot/Makefile : 1.26
6391.21Smycroft	descr
6401.21Smycroft		ffs.c causes cc1 to barf for as-yet unknown reasons.  this
6411.26Ssimonb		hack uses -O0 to avoid the problem.
6421.22Smrg	kcah
6431.22Smrg
6441.79Smrg	hack	gcc 4.1.1/fsck_ffs/pass1.c
6451.79Smrg	cdate	Fri Jun 23 10:30:25 PDT 2006
6461.79Smrg	who	mrg
6471.79Smrg	file	sbin/fsck_ffs/Makefile : 1.30
6481.79Smrg	file	sbin/fsdb/Makefile : 1.19
6491.79Smrg	file	sbin/dump_lfs/Makefile : 1.9
6501.79Smrg	file	usr.sbin/ndbootd/Makefile : 1.2
6511.79Smrg	descr
6521.79Smrg		pass1.c causes cc1 to barf for as-yet unknown reasons.  this
6531.79Smrg		hack uses -O0 to avoid the problem. (these all seem to be the
6541.79Smrg		same problem.)
6551.79Smrg	kcah
6561.79Smrg
6571.22Smrg
6581.56Stsutsuiport	m68000
6591.22Smrg
6601.22Smrg	hack	gcc 3.3.2/gcc/ra-colorize.c
6611.22Smrg	cdate	Wed Nov  5 11:03:13 EST 2003
6621.22Smrg	who	mrg
6631.46Schs	file	gnu/usr.bin/gcc3/backend/Makefile : 1.11
6641.22Smrg	descr
6651.22Smrg		ra-colorize.c causes a whole spew of unreferenced .L* local
6661.22Smrg		symbols.  using -O0 (or even -O2 reportedly) avoids the problem.
6671.56Stsutsui		Note this has been fixed in 3.3.3 at least on m68k,
6681.56Stsutsui		but it hasn't been confirmed on sun2/m68000.
6691.56Stsutsui		(it's too slow even on emulator and unlikely to build
6701.56Stsutsui		 toolchains on sun2 with its maximum 4MB RAM)
6711.21Smycroft	kcah
6721.31Smartin
6731.31Smartinport	sparc64
6741.31Smartin
6751.31Smartin	hack	disable optimzations for uvm_bio.c on 32 bit kernels
6761.31Smartin	cdate	Sun Mar 21 14:14:04 MET 2004
6771.31Smartin	who	martin
6781.32Smartin	file	sys/arch/sparc64/conf/Makefile.sparc64 : 1.53-1.54
6791.32Smartin	file	sys/arch/sparc64/conf/files.sparc64 : 1.93
6801.31Smartin	descr
6811.31Smartin		The sparc compiler miscompiles uvm_bio.c when using
6821.31Smartin		any optimization. This results in ubc_release panics.
6831.31Smartin	kcah
6841.42Schristos
6851.42Schristosport	macppc
6861.42Schristos
6871.42Schristos	hack	remove inline from rotate_{left,right}
6881.42Schristos	cdate	Tue Feb 22 13:43:25 EST 2005
6891.42Schristos	who	christos
6901.42Schristos	file	src/dist/bind/lib/dns/rbt.c
6911.42Schristos	descr
6921.42Schristos		The macppc gcc-3.3 compiler miscompiles rbt.c when these
6931.42Schristos		functions are inlined. The error is:
6941.42Schristos		.* named[368]: rbt.c:1584: INSIST(child != (void *)0) >failed
6951.42Schristos		.* named[368]: exiting (due to assertion failure)
6961.42Schristos		This is reportedly fixed in gcc-3.4
6971.42Schristos	kcah
6981.46Schs
6991.46Schsport	hppa
7001.46Schs
7011.46Schs	hack	hppa-gcc-3.3.3/grep/dfa.c
7021.46Schs	cdate	Sun Aug  8 08:34:32 PDT 2004
7031.46Schs	who	chs
7041.46Schs	file	gnu/usr.bin/grep/grep/Makefile : 1.4
7051.46Schs	descr
7061.46Schs		gcc 3.3.3 generates bad code for dfa.c with -O2,
7071.46Schs		reduce optimization to -O1 to avoid the bug.
7081.46Schs	kcah
7091.47Schs
7101.47Schs	hack	hppa boot-from-disk memory corruption
7111.47Schs	cdate	Wed May 18 06:56:07 PDT 2005
7121.47Schs	who	chs
7131.47Schs	file	src/sys/dev/scsipi/scsipiconf.h : 1.98
7141.47Schs	descr
7151.47Schs		There is some bug with DMA on hppa that corrupts scsipi_xfer
7161.47Schs		structures, but it only shows up when booting from disk.
7171.47Schs		For now, we'll add some padding to scsipi_xfer so that
7181.47Schs		the corrupted memory is not otherwise used.
7191.47Schs	kcah
7201.51Ssimonb
7211.51Ssimonbport	mips
7221.51Ssimonb
7231.51Ssimonb	hack	mips-shared-linker-load-address
7241.51Ssimonb	cdate	Fri Oct  7 08:33:10 UTC 2005
7251.51Ssimonb	who	simonb
7261.51Ssimonb	file	src/sys/kern/exec_elf32.c : 1.107
7271.51Ssimonb	descr
7281.51Ssimonb		With COMPAT_16 or previous enabled (which enables
7291.51Ssimonb		ELF_INTERP_NON_RELOCATABLE) a recent ld.elf_so will
7301.51Ssimonb		load and run at address 0.  The check to fix this in
7311.51Ssimonb		rev 1.107 only checks the first psection of the ELF
7321.51Ssimonb		executable, which may not be loadable.  A more correct
7331.51Ssimonb		fix is to check the first loadable psection instead of
7341.51Ssimonb		just the first psection.
7351.51Ssimonb	kcah
7361.54She
737